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

linux-capture: Log error if adjusted size geometry is zero #11564

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dfaure-kdab
Copy link

@dfaure-kdab dfaure-kdab commented Nov 26, 2024

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

  • Tweak (improved error handling)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
    Not sure what this means. It's a MR for the master branch, shouldn't it be?
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@Lain-B
Copy link
Collaborator

Lain-B commented Nov 26, 2024

Not sure what this means. It's a MR for the master branch, shouldn't it be?

We mean master branch of your fork. Just keeps things tidy and prevents situations where the submitter might need to sync and rebase.

@norihiro
Copy link
Contributor

The commit title should start from a verb and it should be capitalized.
Maybe, "Log error if adjusted size geometry is zero" would be better.

@WizardCM WizardCM added Enhancement Improvement to existing functionality Linux Affects Linux labels Nov 30, 2024
Copy link
Collaborator

@Lain-B Lain-B left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this is fine. Anyone else have an opinion on the wording?

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.
@dfaure-kdab dfaure-kdab changed the title linux-capture: better error if the adjusted size is 0x0 linux-capture: Log error if adjusted size geometry is zero Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improvement to existing functionality Linux Affects Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants