v4l2src format problem since the move to clutter-gst-3.0
Submitted by Fabrice Bellet
Link to original bug (#776207)
Description
Since the move to clutter-gst 3.0, I noticed that the v4l2src input element fails to set the video mode, with this error:
Call to S_FMT failed for BGR3 @ 320x240: Device or resource busy
The problem seems to be that the v4l2src element, initially sets the mode to I420, then switches to RGB some seconds after, triggered by a reconfigure event:
0:00:42.444479706 12925 0x6070007f6b40 DEBUG v4l2src gstv4l2src.c:385:gst_v4l2src_negotiate:<v4l2src0>
caps: video/x-raw, format=(string)I420, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, framerate=(fraction)30/1
[...]
0:00:42.444692683 12925 0x6070007f6b40 DEBUG v4l2 gstv4l2object.c:3263:gst_v4l2_object_set_format_full:<v4l2src0>
Desired format is 320x240, format YU12, nb planes 1
0:00:42.444712163 12925 0x6070007f6b40 DEBUG v4l2 gstv4l2object.c:3272:gst_v4l2_object_set_format_full:<v4l2src0>
stride 320
[...]
0:00:42.991747392 12925 0x6070007f6b40 LOG GST_PADS gstpad.c:5251:gst_pad_push_event_unchecked:videorate0:sink sent event 0x60b001edec90 (reconfigure) to peerpad v4l2src0:src, ret ok
[...]
0:00:44.759630509 12925 0x6070007f6b40 DEBUG v4l2src gstv4l2src.c:385:gst_v4l2src_negotiate:<v4l2src0>
caps: video/x-raw, format=(string)BGR, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, framerate=(fraction)30/1
[...]
0:00:44.759939406 12925 0x6070007f6b40 DEBUG v4l2 gstv4l2object.c:3212:gst_v4l2_object_set_format_full:<v4l2src0>
Desired format 320x240, format BGR3 stride: 960
0:00:44.759973294 12925 0x6070007f6b40 DEBUG v4l2 gstv4l2object.c:3263:gst_v4l2_object_set_format_full:<v4l2src0>
Desired format is 320x240, format BGR3, nb planes 1
0:00:44.760000962 12925 0x6070007f6b40 DEBUG v4l2 gstv4l2object.c:3272:gst_v4l2_object_set_format_full:<v4l2src0>
stride 960
[...]
0:00:45.550643787 12925 0x6070007f6b40 DEBUG v4l2 gstv4l2object.c:3212:gst_v4l2_object_set_format_full:<v4l2src0>
Desired format 320x240, format BGR3 stride: 960
0:00:45.550674761 12925 0x6070007f6b40 DEBUG v4l2 gstv4l2object.c:3263:gst_v4l2_object_set_format_full:<v4l2src0>
Desired format is 320x240, format BGR3, nb planes 1
0:00:45.550709123 12925 0x6070007f6b40 DEBUG v4l2 gstv4l2object.c:3272:gst_v4l2_object_set_format_full:<v4l2src0>
stride 960
0:00:45.550903968 12925 0x6070007f6b40 WARN default v4l2-utils.c:188:gst_v4l2_error:<v4l2src0>
error: Device '/dev/video0' is busy
0:00:45.550938836 12925 0x6070007f6b40 WARN default v4l2-utils.c:191:gst_v4l2_error:<v4l2src0>
error: Call to S_FMT failed for BGR3 @ 320x240: Device or resource busy
What is odd to me is that the video mode is initially tried with the VIDIOC_TRY_FMT ioctl command, and then really set with the VIDIOC_S_FMT command. The first ioctl works, and the second one fails, presumably with the same format parameter...
This situation was avoided with clutter-gst 2.0, because the video mode format was set to I420 and not modified after that.
A possible workaround for me is just to add the desired I420 format to the caps in empathy-video-src.c: gst_caps_set_simple (caps,
-
"format", G_TYPE_STRING, "I420", "framerate", GST_TYPE_FRACTION_RANGE, 1, 1, 30, 1, NULL);
But this may not be a generic solution that works for most people. Are other people having the same problem ?
Version: 3.12.x