Skip to content

error attempting to open more then 16 video devices #5422

Open

Description

@jclab-joseph

Operating System Info

Ubuntu 20.10

Other OS

No response

OBS Studio Version

Git

OBS Studio Version (Other)

39aedc6 (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

  1. Create a V4L2 input.
  2. Enter V4L2 settings.
  3. (It is still normal.)
  4. Select an un-normal device.
  5. After that, v4l2 no longer works.

Anything else we should know?

A device expressed as an un-normal device is a v4l2-m2m codec device.

Activity

  1. jclab-joseph commented on Oct 17, 2021

    @jclab-joseph
    Author

    if (v4l2_get_input_caps(dev, input, &caps) < 0)

    -	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

    image

  2. kkartaltepe commented on Oct 17, 2021

    @kkartaltepe
    Collaborator

    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 08d4456 is applied and see if that fixes the loop issue for your device.

  3. added
    platform/linux
    on Oct 17, 2021
  4. added a commit that references this issue on Oct 17, 2021
  5. jclab-joseph commented on Oct 17, 2021

    @jclab-joseph
    Author
  6. kkartaltepe commented on Oct 18, 2021

    @kkartaltepe
    Collaborator

    Hmmm I think i can replicate this by just returning false in input_selected with a c920.

  7. jclab-joseph commented on Oct 18, 2021

    @jclab-joseph
    Author

    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.

  8. gruzilla commented on Jun 22, 2022

    @gruzilla

    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.

  9. ethagnawl commented on Jan 22, 2024

    @ethagnawl

    @gruzilla's workaround worked for me on a Pi 4 B, too.

  10. vicary commented on Feb 2, 2024

    @vicary

    The workaround doesn't work for Raspberry Pi 5, I guess the latest OS is not using these mods?

  11. mh5 commented on Jan 3, 2026

    @mh5

    On my Raspberry Pi 5, a driver named pisp_be is responsible for several /dev/video* files.

    $ for device in /dev/video*; do udevadm info -q path "$device"; done | grep pisp
    /devices/platform/axi/1000880000.pisp_be/video4linux/video20
    /devices/platform/axi/1000880000.pisp_be/video4linux/video21
    /devices/platform/axi/1000880000.pisp_be/video4linux/video22
    /devices/platform/axi/1000880000.pisp_be/video4linux/video23
    /devices/platform/axi/1000880000.pisp_be/video4linux/video24
    /devices/platform/axi/1000880000.pisp_be/video4linux/video25
    /devices/platform/axi/1000880000.pisp_be/video4linux/video26
    /devices/platform/axi/1000880000.pisp_be/video4linux/video27
    /devices/platform/axi/1000880000.pisp_be/video4linux/video28
    /devices/platform/axi/1000880000.pisp_be/video4linux/video29
    /devices/platform/axi/1000880000.pisp_be/video4linux/video30
    /devices/platform/axi/1000880000.pisp_be/video4linux/video31
    /devices/platform/axi/1000880000.pisp_be/video4linux/video32
    /devices/platform/axi/1000880000.pisp_be/video4linux/video33
    /devices/platform/axi/1000880000.pisp_be/video4linux/video34
    /devices/platform/axi/1000880000.pisp_be/video4linux/video35
    

    My understanding is that those files are for the camera modules that attach through the IO ports, which are different from USB cameras.

    I unloaded the module, and that resolved the camera problems with OBS.

    sudo rmmod pisp_be
    

    This command does not persist after reboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform/linux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions