-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cropped pipewire source spills over the bounding box #4982
Labels
Linux
Affects Linux
Comments
GeorgesStavracas
added a commit
to GeorgesStavracas/obs-studio
that referenced
this issue
Jul 7, 2021
The gs_draw_sprite_subregion() function is used when a cropping rectangle is received from PipeWire. It is usually used by compositors to implement window screencast - where a large and mostly empty frame is sent, the window contents are only a small part of it, and the crop rectangle tells us that. Recently the wlroots implementation of portals started to use it to implement cropping, and it exposed a bug in the PipeWire code in OBS Studio. The gs_draw_sprite_subregion() function takes a pair of floats representing position (x, y) and a pair of floats representing size (width, height). The PipeWire code, however, passes a second pair of positions (x2, y2) instead of sizes, and it causes overrendering the crop area. This bug wasn't hit yet because both GNOME and KDE implementations always send (0, 0) as position, which practically never trigger this condition. Pass only width and height to gs_draw_sprite_subregion(), instead of summing them with x and y. Fixes obsproject#4982
6 tasks
GeorgesStavracas
added a commit
to GeorgesStavracas/obs-studio
that referenced
this issue
Jul 7, 2021
The gs_draw_sprite_subregion() function is used when a cropping rectangle is received from PipeWire. It is usually used by compositors to implement window screencast - where a large and mostly empty frame is sent, the window contents are only a small part of it, and the crop rectangle tells us that. Recently the wlroots implementation of portals started to use it to implement cropping, and it exposed a bug in the PipeWire code in OBS Studio. The gs_draw_sprite_subregion() function takes a pair of floats representing position (x, y) and a pair of floats representing size (width, height). The PipeWire code, however, passes a second pair of positions (x2, y2) instead of sizes, and it causes overrendering the crop area. This bug wasn't hit yet because both GNOME and KDE implementations always send (0, 0) as position, which practically never trigger this condition. Pass only width and height to gs_draw_sprite_subregion(), instead of adding x and y to them. Fixes obsproject#4982
GeorgesStavracas
added a commit
to GeorgesStavracas/obs-studio
that referenced
this issue
Jul 7, 2021
The gs_draw_sprite_subregion() function is used when a cropping rectangle is received from PipeWire. It is usually used by compositors to implement window screencast - where a large and mostly empty frame is sent, the window contents are only a small part of it, and the crop rectangle tells us that. Recently the wlroots implementation of portals started to use it to implement cropping, and it exposed a bug in the PipeWire code in OBS Studio. The gs_draw_sprite_subregion() function takes a pair of integers representing position (x, y) and a pair of integers representing size (width, height). The PipeWire code, however, passes a second pair of positions (x2, y2) instead of sizes, and it causes overrendering the crop area. This bug wasn't hit yet because both GNOME and KDE implementations always send (0, 0) as position, which practically never trigger this condition. Pass only width and height to gs_draw_sprite_subregion(), instead of adding x and y to them. Fixes obsproject#4982
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Operating System Info
Other
Other OS
Arch Linux
OBS Studio Version
27.0.1
OBS Studio Version (Other)
No response
OBS Studio Log URL
https://obsproject.com/logs/6ZlEHr2nRlovNAUT
OBS Studio Crash Log URL
No response
Expected Behavior
When capturing a cropped Pipewire source, the source should be rendered as expected in OBS.
Current Behavior
When capturing a cropped Pipewire source, the crop is correctly applied to the left side of the source, but the right side spills over the bounding box. Screenshot:
In this case I am running OBS on a 5120x1440 monitor with Pipewire set up to share a 2560x1440 rectangle at the center of the monitor. OBS appears to correctly display the bounding box, but it's not actually cropping the right side of the source.
If I apply a local crop in the Transform settings of the source in OBS, the overflow immediately disappears:
It doesn't matter which side of the bounding box I add the crop to. I just need to add 1 px to any side.
Steps to Reproduce
It may also spill over the bottom bounding box, but I haven't tested that.
Anything else we should know?
See emersion/xdg-desktop-portal-wlr#154 for the context of how this bug was discovered
The text was updated successfully, but these errors were encountered: