我正在玩 v4l2loopback,并且尝试让 gstreamer 消费者在没有生产者但失败时使用默认超时图像运行。
v4l2loopback 设备如何设置:
sudo utils/v4l2loopback-ctl set-fps /dev/video20 20
v4l2-ctl -d /dev/video20 -c timeout=50
sudo utils/v4l2loopback-ctl set-caps /dev/video20 "UYVY:640x480@20/1"
sudo utils/v4l2loopback-ctl set-timeout-image /dev/video20 <path_to_black_image>
生产者和消费者的命令:
#Producer
gst-launch-1.0 videotestsrc pattern=ball ! video/x-raw,width=640,height=480,format=UYVY,framerate=20/1 ! timeoverlay ! v4l2sink device=/dev/video20
#Consumer
gst-launch-1.0 v4l2src device=/dev/video20 ! video/x-raw,format=UYVY,width=640,height=480 ! videoconvert ! fpsdisplaysink video-sink=xvimagesink
当生产者首先连接到环回设备,然后是消费者时,它可以完美地工作。在这种情况下,当生产者被移除时,消费者将使用配置的 FPS 播放超时图像。
但是,如果尝试在没有生产者的情况下运行消费者,则会出现如下错误。
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
gstv4l2src.c(658): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:00.006248059
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
知道如何克服这个问题吗?