Skip to content
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

Use crop, drag source, ui block occurs #11917

Open
zengsansui opened this issue Mar 4, 2025 · 1 comment · May be fixed by #11922
Open

Use crop, drag source, ui block occurs #11917

zengsansui opened this issue Mar 4, 2025 · 1 comment · May be fixed by #11922

Comments

@zengsansui
Copy link

Operating System Info

Windows 11

Other OS

No response

OBS Studio Version

Other

OBS Studio Version (Other)

31.0.0

OBS Studio Log URL

https://obsproject.com/logs/WwflVz53z6u6DLaI

OBS Studio Crash Log URL

No response

Expected Behavior

obs do not cause UI block

Current Behavior

After setting corp, resize source, obs has UI block

Steps to Reproduce

  1. add color source, selected it.
  2. edit transform, update corp left 1000px, right 1000px.
  3. resize source

Anything else we should know?

Image

1111.mp4
@kkartaltepe kkartaltepe changed the title Use corp, drag source, ui block occurs Use crop, drag source, ui block occurs Mar 4, 2025
@Lain-B Lain-B linked a pull request Mar 5, 2025 that will close this issue
5 tasks
@Lain-B
Copy link
Collaborator

Lain-B commented Mar 5, 2025

I debugged this to the root cause of the actual issue. The root cause was line in OBSBasicPreview.cpp:

		size.x = float(obs_source_get_width(source) - crop.left - crop.right) * scale.x;
		size.y = float(obs_source_get_height(source) - crop.top - crop.bottom) * scale.y;

As you can see here, first it gets the width of the source: 1920, the default size of a color source. Then it subtracts the left crop size and the right crop size, which are both 1000. size.x thus should be -920, which is an invalid size value of course.

However, obs_source_get_width returns a uint32_t. While the member variables of the obs_sceneitem_crop structure are all int, the mix of signed and unsigned integers here caused the result of that equation to be 4294967216, i.e. an integer overflow.

This overflow would cause a near-infinite loop in DrawStripedLine() in OBSBasicPreview.cpp, which additionally has such bad perf to begin with that it just has no chance of ending any time soon. Perf fixes will additionally need to be deployed to help reduce mutex lock time.

I have fixed this in #11922, and I will also fix draw performance in this file in a subsequent PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants