obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording
https://obsproject.com
GNU General Public License v2.0
60.21k stars 7.97k forks source link

Changing camera resolution breaks the camera portal #10399

Open shetozz opened 7 months ago

shetozz commented 7 months ago

Operating System Info

Other

Other OS

Fedora 39 workstation eddition

OBS Studio Version

30.1.0

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/hsHQW4pOfOAh58Ey

OBS Studio Crash Log URL

No response

Expected Behavior

Changing camera resolution should keep the camera working.

Current Behavior

Changing the camera resolution breaks the portal -camera turns off and the video freezes-, and changing it back doesn't fix it. You have to restart OBS.

Steps to Reproduce

  1. Create a new camera source using the pipewire camera portal.
  2. Change the resolution from the dropdown menu.
  3. the camera source will break, you'll have to. ...

Anything else we should know?

No response

mihawk90 commented 7 months ago

Have you tested if you are getting the same result when using the V4L2 capture instead?

I can say from my own experience that some capture devices are just buggy like that. They don't allow changing capture parameters until turned off and on. This was consistent with other camera-applications.

Not doubting there could be an issue, just wanting to make sure this is actually related to the portal implementation.

shetozz commented 7 months ago

Have you tested if you are getting the same result when using the V4L2 capture instead?

Yeah, using the V4L2 works as expected, but I found another way to get the bug to go away other than restarting the app, I can just change the camera source in the portal settings and change it back.

GeorgesStavracas commented 7 months ago

Hi @shetozz, can you please reproduce this issue while you run $ pw-mon in a terminal, and share the output with us?

Please double check if the logs don't contain sensitive information before uploading them!

shetozz commented 7 months ago

@GeorgesStavracas
obs.txt

stephematician commented 4 weeks ago

I see this same behaviour too.

Seems to give pipewire a hard time, as audio drops out in firefox and I have to restart the pipewire service.

Here's the debug output:

info: [camera-portal] Selected resolution for 'libcamera_input.__SB_.PCI0.GP17.XHC1.RHUB.PRT1-1.3_1.0-046d_0825'
info: [camera-portal] Selected format for 'libcamera_input.__SB_.PCI0.GP17.XHC1.RHUB.PRT1-1.3_1.0-046d_0825'
info: [camera-portal] selected camera 'libcamera_input.__SB_.PCI0.GP17.XHC1.RHUB.PRT1-1.3_1.0-046d_0825'
info: [camera-portal] Updating pixel formats
info: [camera-portal] Selected format for 'libcamera_input.__SB_.PCI0.GP17.XHC1.RHUB.PRT1-1.3_1.0-046d_0825'
info: [camera-portal] Selected resolution for 'libcamera_input.__SB_.PCI0.GP17.XHC1.RHUB.PRT1-1.3_1.0-046d_0825'
info: [pipewire] Renegotiating stream
info: [camera-portal] Updating device libcamera_input.__SB_.PCI0.GP17.XHC1.RHUB.PRT1-1.3_1.0-046d_0825
info: [pipewire] Stream 0x70839c0034a0 state: "error" (error: error set output format: -22 (Invalid argument))
error: [pipewire] Error id:5 seq:31 res:-32 (Broken pipe): error set output format: -22 (Invalid argument)
error: [pipewire] Error id:0 seq:255 res:-32 (Broken pipe): connection error
info: [pipewire] Stream 0x70839c0034a0 state: "unconnected" (error: connection error)
stephematician commented 4 weeks ago

Hi @shetozz, can you please reproduce this issue while you run $ pw-mon in a terminal, and share the output with us?

pw-mon crashes immediately.

Here's the pw-mon output pre-crash when I switch from 320x240 [YUYV] to 160x120 [YUYV]: pipewire_obs_pre_crash.txt

If I restart pipewire and run obs, the camera is at the new resolution. So it does change the settings, but something else fails along the way.

stephematician commented 4 weeks ago

Using journalctl -u pipewire -a -o cat --user -r I scroll down and see that this is where things kick off, some error reported by libcamera:

[0:52:11.277887757] [20407] ERROR Camera camera.cpp:696 Camera in Running state trying configure() requiring state between Acquired and Configured

If I select a camera whose backend is v4l2 (not libcamera) then this crash doesn't happen (there are other glitches, similar to #10588 - I have to switch back and forth sometimes to get a particular framerate working).