obsproject / obsproject/obs-studio
linux-v4l2: Adjusting camera controls (Zoom, Focus, etc.) triggers stream restarts on USB3 4k webcam (Elgato 4k facecam)
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 76.4k
- Forks
- 10.2k
- Avg merge
- 4d 23h
- Merged PRs (30d)
- 12
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in plugins/linux-v4l2/v4l2-input.c at v4l2_settings_changed, especially the framerate comparison and the v4l2_framerate_list value it uses. Verify that changing zoom or focus does not trigger v4l2_terminate and v4l2_init when the framerate is unchanged, then test the control adjustment with the affected USB3 webcam.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100