linux-capture: Log error if adjusted size geometry is zero #11564
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
If after adjustments (crop settings) the size is 0x0 or negative in one component, the error message was just "shm failed".
Motivation and Context
What happened was, I used obs a long time ago on a 4k screen,
and wanted to record only the topleft quarter, so I had
crop right: 1920px, crop bottom: 1080px.
On an HD screen, this left... nothing. The adjusted size was 0x0
and shmget(0) returns an error, so all I could see on stderr was
"xshm-input: failed to attach shm !"
This made me dig very much into xshm problems, when in fact
a simple message about the adjusted size being 0x0 would have
helped tremendously.
While at it, also catch the case of crop being bigger than the screen.
How Has This Been Tested?
Tested on Linux with a Screen Capture source where the crop is equal or bigger than the screen dimension.
Types of changes
Checklist:
Not sure what this means. It's a MR for the master branch, shouldn't it be?