Open jclab-joseph opened 3 years ago
- if (v4l2_get_input_caps(dev, input, &caps) < 0)
+ if (v4l2_get_input_caps(dev, input, &caps) < 0) {
+ v4l2_close(dev);
return false;
+ }
I found a leak in this part. But if I fix this part, I get an infinite loop now.
Log: https://gist.github.com/jclab-joseph/1db7cfe71b4c48b6d8391fd0fd6f9215
The red text is the logging I added. The device number continues to increment. (the leak seems to be happening)
Im not convinced this is a sign of a leak. Instead a new device id is likely chosen every time you open a new device.
The proposed change seems good if you want to submit a PR for it.
If you find yourself in a infinite loop consider rebuilding at head now that https://github.com/obsproject/obs-studio/commit/08d4456339339b90892f268afa3dab3073bdd292 is applied and see if that fixes the loop issue for your device.
Applying the latest commits has the same problem. When entering the settings page, input_selected is called infinitely.
Log : https://gist.github.com/jclab-joseph/b4ac47a6f8d3b166282d442e72f32aa3 Branch : https://github.com/jclab-joseph/obs-studio/tree/fix/v4l2-leak
Hmmm I think i can replicate this by just returning false in input_selected
with a c920.
https://gist.github.com/jclab-joseph/cac9faa679164a8a365c432ac730262a
obs_property_modified : pixelformat / 6 / Video Format
obs_property_modified : resolution / 6 / Resolution
obs_property_modified : framerate / 6 / Frame Rate
obs_property_modified : input / 6 / Input
Four obs_property_modified above causes infinity. Can you tell me who triggers obs_property_modified? I'm debugging to fix this issue.
I just experienced the same problem on a raspberry pi 4.
as a workaround i rmmod bcm2835_isp
and rmmod bcm2835_v4l2
to reduce the amount of v4l2 devices and it worked around.
@gruzilla's workaround worked for me on a Pi 4 B, too.
The workaround doesn't work for Raspberry Pi 5, I guess the latest OS is not using these mods?
Operating System Info
Ubuntu 20.10
Other OS
No response
OBS Studio Version
Git
OBS Studio Version (Other)
39aedc6c2ffdca9a89940117ee6dfcbfd0d955c4 (Sun Jun 6 11:01:40 2021 +0200)
OBS Studio Log URL
https://gist.github.com/jclab-joseph/442d197f0adbb27cac0a523a304e2f34
The red text is the logging I added. The device number continues to increment. (the leak seems to be happening)
OBS Studio Crash Log URL
No response
Expected Behavior
Regardless of the number of video devices, and even if an error occurs, it should be ignored and work fine.
Current Behavior
If there is a video device that is un-normal camera device (can't get parameters normally?), If click the device list on the v4l2 settings page, or click an un-normal device, After that, v4l2 no longer works.
There are currently 9 v4l2 devices, some may not get the parameters properly. (Not sure.)
Steps to Reproduce
Anything else we should know?
A device expressed as an un-normal device is a v4l2-m2m codec device.