Precent data from Cuda to EGLStream

Hello, please help me to understand my mistake with EGLStream.
My task is to provide images handled by CUDA to EGLStream for FrameConsumer. Than get the frame and encode to JPEG with IImageJPEG.

I started with EGLStreams_CUDA_Interop example.

Here is the code for connecting producer to stream:

// EGLDisplayHolder m_display;
// EGLStreamHolder m_stream;
// CUeglStreamConnection m_cudaConn;

m_display.initialize();

PROPAGATE_ERROR(m_stream.create(m_display.get()));
CHECK_STREAM_STATE(m_stream, CREATED);

if (CUDA_SUCCESS == (status = cuEGLStreamProducerConnect(&m_cudaConn, m_stream.get(), STREAM_SIZE.width(), STREAM_SIZE.height()))) {
    printf("Connect CUDA producer Done, CudaProducer %p\n", m_cudaConn);
} else {
    printf("Connect CUDA producer FAILED with error %d\n", status);
    return status;
}

Code produces error:
Connect CUDA producer FAILED with error 999.
Which is actually CUDA_ERROR_UNKNOWN.

Please help me to find solution.

Hi,

Have you checked our multimedia sample? It can give you some information about your use case.

For example, the sample cudaHistogram:

cuResult = cuEGLStreamConsumerAcquireFrame(&cudaConnection, &cudaResource, &cudaStream, -1);
cuResult = cuGraphicsResourceGetMappedEglFrame(&cudaEGLFrame, cudaResource, 0, 0);
...
cudaResourceDesc.res.array.hArray = cudaEGLFrame.frame.pArray[0];

Thanks.

Thanks for your answer.
I did check this sample and it can not be used as starting point for development.
Because my use case is different: I need to implement EGLStream CUDA producer. And then use this EGLStream with Argus modules to JPEG encode and display preview of CUDA-handled video stream.

And as for CUDA consumer, it works fine: frames can be acquired and released, frame data is accessible for CUDA kernels via surface.

I was able to register the producer, for this I had to first register the consumer.
Quite unobvious way out.
In any case, thanks.