EGLStream and Argus problems

Hi all,

We want to acquire camera frame in multi process at the same time, like yolo, preview, record and so on.
So we managed to use libargus + EGL Stream to accomplish it to achieve zero copy.



Can not get correct FD(EGL_NO_FILE_DESCRIPTOR_KHR) from EGLStreamKHR even though the EGLStreamKHR’s state is EGL_STREAM_STATE_CREATED_KHR.
Is eglGetStreamFileDescriptorKHR() has previously been called on this stream inside Argus?


For using EGLStream producer/consumer, the case of single producer and multiple consumers is not supported. So your use-case may not work properly. Are you able to run in single process? It shall work by creating multiple OutputStream as demonstrated in 09_camera_jpeg_capture.

okay, just think about single producer and single consumer cross process.
why I can’t get correctly FD from EGLStreamKHR?

Official documents described as folloows:

    On failure the functions returns EGL_NO_FILE_DESCRIPTOR_KHR and
    generates an error

        - EGL_BAD_DISPLAY is generated if <dpy> is not a valid
          initialized EGLDisplay

        - EGL_BAD_STREAM_KHR is generated if <stream> is not a valid
          EGLStreamKHR handle created for <dpy>.

        - EGL_BAD_STATE_KHR is generated if <stream> is not in the
          EGL_STREAM_STATE_CREATED_KHR state or if
          eglGetStreamFileDescriptorKHR() has previously been called
          on this <stream>.

        - EGL_BAD_STATE_KHR is generated if <stream> was not created
          by eglCreateStreamKHR (e.g. if it was created by

the EGLStreamKHR’s state is right(EGL_STREAM_STATE_CREATED_KHR), So the eglGetStreamFileDescriptorKHR() has previously been called on this EGLStreamKHR inside Aegus???


By default we have demonstration of producer/consumer in
Problems getting EGL Stream transferred to another process on same machine - #7 by DaneLLL

Could you try to run eglstreamcube as consumer and see if it can receive frames from the Argus producer?


I have successfully transfer data with opengl and cuda through EGLStream.

Argus producer==>Frame comsumer —cuda produce,r====>cuda comsumer
As you see above, there are two producer and two comsumer, Is there any way to achieve it just with one argus producer and one frame comsumer?

Could you give me a answer about EGLStream and Argus problems - #4 by cloundliu?


Hi DaneLLL,

The proposed demonstration of producer/consumer in graphics_demos work as expected.
However, in this demonstration, the EGLStream is firstly created by consumer, and the corresponding ‘fd’ of this EGL stream is obtained and sent via unix domain socket to producer from the consumer.

Here, we need to firstly create the EGL outputStream by producer (by calling libargus API, ICaptureSession::createOutputStream()), and get its ‘fd’ (by calling eglGetStreamFileDescriptorKHR()), and send this ‘fd’ to consumer (also via unix domain socket). Then the consumer tries to recover the same EGL stream by calling eglCreateStreamFromFileDescriptorKHR() with the ‘fd’ sent by the producer.
So the procedure is a little bit different from that in the producer / consumer demonstration in graphics_demos.

The problem is that, when tying to get the ‘fd’ of the EGL outputstream, eglGetStreamFileDescriptorKHR() returns EGL_NO_FILE_DESCRIPTOR_KHR and generates an error “EGL_BAD_STATE_KHR”. Also we can confirm the EGL stream state is ‘STREAM_STATE_CREATED_KHR’. According to KHR official document, it is highly possible that the ‘fd’ of the ARGUS EGL outputstream has already been obtained by calling eglGetStreamFileDescriptorKHR() inside the libargus implementation, and this will cause the eglGetStreamFileDescriptorKHR() call in our application fail to obtain the fd.

Is it possible for the application to obtain the fd of the EGL outputstream of libargus?
E.g, adding new libargus API to export this ‘fd’ to libargus client application?