linux-v4l2: Adjusting camera controls (Zoom, Focus, etc.) triggers stream restarts on USB3 4k webcam (Elgato 4k facecam)
Operating System Info
Other
Other OS
CachyOS
OBS Studio Version
32.2.2
OBS Studio Version (Other)
No response
OBS Studio Log URL
https://obsproject.com/logs/VSSgX2ym6OQxeCBf
OBS Studio Crash Log URL
No response
Expected Behavior
- Click the + button to add a new source or right click to edit the properties of an existing V4L2 source
- Go to settings like zoom that have a slider
- It sets the setting without issue
Current Behavior
- Click the + button to add a new source or right click to edit the properties of an existing V4L2 source
- Go to settings like zoom that have a slider
- It sets the setting but the webcam will have a flashing blue light and drop frames
Steps to Reproduce
Basically as described in the current behaviour. I tried mainly with the zoom setting.
Anything else we should know?
I already dug into the issue myself already. I think the issue is related to the v4l2_settings_changed method:
https://github.com/obsproject/obs-studio/blob/master/plugins/linux-v4l2/v4l2-input.c#L989-L1026
What happens is:
res |= (data->framerate != obs_data_get_int(settings, "framerate")) && (obs_data_get_int(settings, "framerate") != -1);
Will always be evaluated as true because 60fps is the frame rate in the settings and the v4l2_framerate_list returns a packed tuple so you get for 60fps a comparison of 4294967356 != 60 so always true. That calls v4l2_terminate and v4l2_init because it assumes it needs a restart every time the slider moves.
Source: obsproject/obs-studio