I’m using the Argus lib to dynamically control the CSI cameras connected to my Nano, and then pass the camera frames to GStreamer via EGLStreams to output the frames to a virtual video device created with v4l2loopback. Although I can see video in the virtual devices, a few frames are dropped every three or four seconds, which is very noticeable when cameras are capturing movement.
After v4l2loopback is installed, I create the virtual video device with this command:
sudo modprobe v4l2loopback video_nr="10" card_label="virtcam" exclusive_caps=1 max_buffers=2
My GStreamer pipeline is the following (see vi_out_v4l2sink.cpp for details):
nveglstreamsrc display=<egl_disp> eglstream=<in_stream> ! nvvidconv ! identity drop-allocation=true ! v4l2sink device=</dev/videoX>
If I replace nveglstreamsrc with nvarguscamerasrc and I run the pipeline with gst-launch-1.0, the bug disappears and the video is fluid, but I cannot control the cameras streams from here.
gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! identity drop-allocation=true ! v4l2sink device=</dev/videoX>
I reduced the frame rate and resolution of the camera frames using Argus to 10fps and 480p, but the bug is still there, so perhaps this is not a performance issue.
In my code ( vi_out_v4l2sink.cpp ), I also noticed that If I change v4l2sink to nvoverlaysink, the bug disappears:
nveglstreamsrc display=<egl_disp> eglstream=<in_stream> ! nvvidconv ! nvoverlaysink
But reappears if I use ximagesink instead:
nveglstreamsrc display=<egl_disp> eglstream=<in_stream> ! nvvidconv ! ximagesink
So maybe it’s something related to nvvidconv moving the buffers produced in nveglstreamsrc from GPU and CPU for v4l2sink to consume.
Could you please help me with this bug? Also, if there are some other alternatives to connect the EGLStream from Argus to the V4L2 virtual device, I’ll be more than happy to try other solutions.
Thanks in advance.
vi_out_v4l2sink.cpp (9.2 KB)