cuGraphicsEGLRegisterImage makes gstreamer plugin not recognized

I am trying to use a custom cuda kernel (no opencv) in my gstreamer plugin and I followed this instruction on how to map an egl image. I am also orienting myself on gstdsexample.cpp, so I created the NvBufSurface current_frame exactly the same way, NvBufSurface surface is created in the example.

Then I map it:

  CHECK_NVBUFSURFACE_STATUS(NvBufSurfaceMap(current_frame, -1, -1, NVBUF_MAP_READ_WRITE), "Couldn't map current frame buffer");
  CHECK_NVBUFSURFACE_STATUS(NvBufSurfaceSyncForCpu(current_frame, -1, -1), "Can't sync current frame to cpu");
  CHECK_NVBUFSURFACE_STATUS(NvBufSurfaceMapEglImage(current_frame, -1), "Could not map egl image from current frame");

Then I register the egl image with a CUgraphicsResource :

CUgraphicsResource current_frame_ressource = nullptr;
CHECK_CUDAEGL_STATUS(
    cuGraphicsEGLRegisterImage(&current_frame_ressource, current_frame->surfaceList[0].mappedAddr.eglImage, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE),
    "Could not register egl image");

And after successful compilation I start it with the following pipeline:

GST_DEBUG=3 gst-launch-1.0 nvarguscamerasrc bufapi-version=1 ! 'video/x-raw(memory:NVMM),width=3264,height=2464,format=(string)NV12, framerate=21/1' ! mx.sink_0 nvstreammux width=3264 height=2464 batch-size=1 name=mx ! myplugin ! fakesink
              

I get the following error and the execution is terminated:

~$ GST_DEBUG=3 gst-launch-1.0 nvarguscamerasrc bufapi-version=1 ! 'video/x-raw(memory:NVMM),width=3264,height=2464,format=(string)NV12, framerate=21/1' ! mx.sink_0 nvstreammux width=3264 height=2464 batch-size=1 name=mx ! myplugin ! fakesink
0:00:00.091920432 29459   0x55b110a4f0 WARN     GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "myplugin"!
0:00:00.091992569 29459   0x55b110a4f0 ERROR           GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "myplugin"
0:00:00.092034393 29459   0x55b110a4f0 ERROR           GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no sink [source=@0x55b11d4280]
0:00:00.093516501 29459   0x55b110a4f0 ERROR           GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=@0x55b11dd1e0]
WARNING: erroneous pipeline: no element "myplugin"

I only get this with the addition of the call to the cuGraphicsEGLRegisterImage function.

Why is that?

Hi,
Are you able to use dsexample and put your implementation into the plugin? Since it is an existing implementation and open source, you may use the plugin directly.

Hi,

I solved the issue at hand.
It was a missing linked lib that you suggested in this post, but isn’t mentioned in this post.

1 Like