Enabling dynamic resolution with UVC sink

Hello, I am testing UVCsink app on a embedded board. When I connect the cameracontrols app and open the uvcstream configured on the embedded device, I notice that it works for a predefined resolution.

When the camera controls host requests, a new resolution, the uvcsink plugin does not let it with the error message: " Device or resource busy" and lets the cameracontrols app run in the static original resolution/caps.

Is it possible to enable uvcsink based events such as STREAM_ON , Send reconfigure and catch them as a signal? If that would be possible, I would like to change caps dynamically in my gstreamer application.

Thank you

What is the cameracontrols app? If the app is running on the host, it should be possible to switch resolutions on the fly. The uvcsink is exposing its predefined formats/resolutions via configfs. Whatever the host is seeing from the descriptors should be possible to get via the uvc gadget. It’s the applications work to gaurantee that the format/res is available from the source via the caps on the uvcsink.

If you mean like switching the exporting formats from the gadget side? That would rather not be possible since the host is expecting something that it actually has allocated memory. It should not be possible to send the host something else then it expects.

For the first case though, there should be everything available to switch resoltions.

Thanks

Hi @mgrzeschik

thanks for the quick response. Yes, the configfs is set up to have 2 resolutions 1080p, 720p YUYV format. I see it also exposed at the Cameracontrols app. This is just a GUI client that opens the UVC stream on a Linux-NUC. GitHub - soyersoyer/cameractrls: Camera controls for Linux

I have attached a screenshot where the host side client output resource busy


My pipeline is serving FHD stream:

gst-launch-1.0 -e -v qtiqmmfsrc camera=0 name=camsrc ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1  !  videoconvert ! video/x-raw,format=YUY2,
width=1920,height=1080,framerate=30/1   !  tee name=t  t. ! queue  max-size-buffers=30 ! uvcsink message-forward=true async-handling=true v4l2sink::device=/dev/video4

I logged some info at the uvc host selected and the reconfigure events:

5403476 e[32m 1711e[00m 0x55baa20640 e[37mDEBUG e[00m e[00m uvcsink uvc.c:261:uvc_events_process_data:e[00m setting commit control
Width from debug = 1920, Height = 1080
0:00:36.175803789 e[32m 1711e[00m 0x55baa20640 e[36mINFO e[00m e[00m uvcsink gstuvcsink.c:638:gst_uvc_sink_task:e[00m UVC host selected video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string){ 2:4:7:1 }, framerate=(fraction)30/1
0:00:36.175860976 e[32m 1711e[00m 0x55baa20640 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:590:gst_uvc_sink_task:e[00m UVC_EVENT_STREAMON
0:00:36.196043372 e[32m 1711e[00m 0x55baa20400 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:417:gst_uvc_sink_sinkpad_idle_probe:e[00m Send reconfigure
0:00:36.197007955 e[32m 1711e[00m 0x55baa20520 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:295:gst_uvc_sink_query:e[00m caps video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string){ 2:4:7:1 }, framerate=(fraction)30/1
0:00:36.197028632 e[32m 1711e[00m 0x55baa20520 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:379:gst_uvc_sink_to_v4l2sink:e[00m switching to v4l2sink

state_changed_cb called

state_changed_cb called

0:00:36.214429466 e[32m 1711e[00m 0x55baa20520 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:295:gst_uvc_sink_query:e[00m caps video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string){ 2:4:7:1 }, framerate=(fraction)30/1
0:00:47.257857066 e[32m 1711e[00m 0x55baa20640 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:607:gst_uvc_sink_task:e[00m UVC_EVENT_SETUP
0:00:47.257988889 e[32m 1711e[00m 0x55baa20640 e[37mDEBUG e[00m e[00m uvcsink uvc.c:403:uvc_events_process_setup:e[00m bRequestType a1 bRequest 87 wValue 0200 wIndex 0200 wLength 0002
0:00:47.258026024 e[32m 1711e[00m 0x55baa20640 e[37mDEBUG e[00m e[00m uvcsink uvc.c:363:uvc_events_parse_control:e[00m UVC_PU_BRIGHTNESS_CONTROL: GET_DEF
0:00:47.258947014 e[32m 1711e[00m 0x55baa20640 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:607:gst_uvc_sink_task:e[00m UVC_EVENT_SETUP
0:00:47.259010139 e[32m 1711e[00m 0x55baa20640 e[37mDEBUG e[00m e[00m uvcsink uvc.c:403:uvc_events_process_setup:e[00m bRequestType a1 bRequest 81 wValue 0200 wIndex 0000 wLength 0001
0:00:47.259033576 e[32m 1711e[00m 0x55baa20640 e[37mDEBUG e[00m e[00m uvcsink uvc.c:352:uvc_events_parse_control:e[00m UVC_VC_REQUEST_ERROR_CODE_CONTROL
0:01:23.616962781 e[32m 1711e[00m 0x55baa20640 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:599:gst_uvc_sink_task:e[00m UVC_EVENT_STREAMOFF
0:01:23.631585073 e[32m 1711e[00m 0x55baa20400 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:417:gst_uvc_sink_sinkpad_idle_probe:e[00m Send reconfigure
0:01:23.631704135 e[32m 1711e[00m 0x55baa20400 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:352:gst_uvc_sink_to_fakesink:e[00m switching to fakesink

state_changed_cb called

0:01:23.632669291 e[32m 1711e[00m 0x55baa20520 e[37mDEBUG e[00m e[00m uvcsink gstuvcsink.c:295:gst_uvc_sink_query:e[00m caps video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string){ 2:4:7:1 }, framerate=(fraction)30/1