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

Add a shortcut to pause/unpause display #4748

Merged
merged 1 commit into from
Mar 30, 2024
Merged

Add a shortcut to pause/unpause display #4748

merged 1 commit into from
Mar 30, 2024

Conversation

rom1v
Copy link
Collaborator

@rom1v rom1v commented Mar 9, 2024

Pause on MOD+z, unpause on MOD+Shift+z.

It only impacts rendering, the device is still captured, the video stream transmitted to the device, and recorded if recording is enabled.

Fixes #1632

rom1v added a commit that referenced this pull request Mar 9, 2024
Pause/unpause display on MOD+Shift+p.

It only impacts rendering, the device is still captured, the video
stream transmitted to the device and recorded (if recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
rom1v added a commit that referenced this pull request Mar 9, 2024
Pause/unpause display on MOD+Shift+p.

It only impacts rendering, the device is still captured, the video
stream transmitted to the device and recorded (if recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
@rom1v
Copy link
Collaborator Author

rom1v commented Mar 9, 2024

@ttschnz (#1632 (comment)) please test the updated PR, keyboard and mouse should be disabled while in pause.

@rom1v
Copy link
Collaborator Author

rom1v commented Mar 9, 2024

Maybe Alt+z would be better (in reference to Ctrl+z which stops a process on Linux)? What do you think?

@ttschnz
Copy link

ttschnz commented Mar 10, 2024

Here are two features I discovered to still work during the freeze:

  1. volume can be changed via shortcut
  2. files can be transferred (also apps)

I would argue for these two to stay, because:

  1. We freeze the screen to pause updating what's happening on the screen, I see it as a feature to still be able to control volume.
  2. For this action to be triggered, something bust be done on purpose, and as a end-user I wouldn't expect a screen-freeze to also disable this.

During my (short) tests, I came to one or two occurences where the frame would not update as soon as I unfreezed, allthough it would then continue as soon as there was another update (through direct input on the device or through an interaction with the stream). However, I could not reproduce it on purouse, I will reach out as soon as I know more about this - I will certainly use the feature extensively during the next week.

As of the shortcut, I've come to like mod+z, one could persume "z", as in freeze.

rom1v added a commit that referenced this pull request Mar 10, 2024
Pause/unpause display on MOD+Shift+p.

It only impacts rendering, the device is still captured, the video
stream transmitted to the device and recorded (if recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
@rom1v
Copy link
Collaborator Author

rom1v commented Mar 10, 2024

volume can be changed via shortcut

Oops, I forgot this one. For consistency with other shortcuts actions, I think they should be disabled on pause.

Files can be transferred (also apps)

I think this one can be kept, it is quite independent.

During my (short) tests, I came to one or two occurences where the frame would not update as soon as I unfreezed

Oops, I did not update correctly. I started to fix, but there's still something missing. I will fix tomorrow.

@ttschnz
Copy link

ttschnz commented Mar 10, 2024

Another flash of insight I just had: during the freeze you could add a shortcut that updates the screen, but then refreezes, as if I pressed mod+z twice. Since the inputs don't redirect to the device during the paused display, a simple r would be enough (allthough inconsistent with the default behaviour).
This could however be challenging to implement, and I also don't want to push this feature too far, KISS principle applies...

rom1v added a commit that referenced this pull request Mar 11, 2024
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continue to be transmitted to the device and recorded (if
recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
@rom1v
Copy link
Collaborator Author

rom1v commented Mar 11, 2024

Then I propose the following:

  • MOD+z: pause (or refresh if already paused)
  • MOD+Shift+z: unpause

Another benefit is that we don't need to know the current state (which is not always obvious) to pause or unpause. I updated the PR.

rom1v added a commit that referenced this pull request Mar 11, 2024
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continue to be transmitted to the device and recorded (if
recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
rom1v added a commit that referenced this pull request Mar 11, 2024
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continue to be transmitted to the device and recorded (if
recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
@ttschnz
Copy link

ttschnz commented Mar 19, 2024

I've been testing commit b9cc6f7 during last and this week - I haven't found anything to complain about, so I'd say it's good like that.

For the shortcuts, I'd leave it the way it is, I find it convenient.

Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continues to be transmitted to the device and recorded (if
recording is enabled).

Fixes #1632 <#1632>
PR #4748 <#4748>
@rom1v rom1v changed the base branch from master to dev March 30, 2024 13:26
@rom1v
Copy link
Collaborator Author

rom1v commented Mar 30, 2024

Let's merge this 🚀

@rom1v rom1v merged commit 1c3801a into dev Mar 30, 2024
@Helaer
Copy link

Helaer commented May 12, 2024

@rom1v Hello, I found that although the screen is paused, there is still a large amount of CPU occupied on the computer side. Can you stop rendering processing on the computer side when the screen is paused?

@rom1v
Copy link
Collaborator Author

rom1v commented May 12, 2024

Can you stop rendering processing on the computer side when the screen is paused?

This feature just prevents the frame to be refreshed in the display. It does not impact other components.

The video stream is still transmitted, demuxed and decoded. The intermediate frames (at least a few ones) need to be decoded anyway, because the current frame (on unpause) may depend on them. In addition, other components may need the decoded frames (v4l2).

The feature is very local (non intrusive) to the display component, it does not impact other components. It's just a mean to "hide" a transition during a presentation, it does not release any resources.

FreedomBen pushed a commit to FreedomBen/scrcpy that referenced this pull request Aug 2, 2024
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continues to be transmitted to the device and recorded (if
recording is enabled).

Fixes Genymobile#1632 <Genymobile#1632>
PR Genymobile#4748 <Genymobile#4748>
Gottox pushed a commit to Gottox/scrcpy that referenced this pull request Sep 29, 2024
Pause/unpause display on MOD+z and MOD+Shift+z.

It only impacts rendering, the device is still captured, the video
stream continues to be transmitted to the device and recorded (if
recording is enabled).

Fixes Genymobile#1632 <Genymobile#1632>
PR Genymobile#4748 <Genymobile#4748>
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 this pull request may close these issues.

Pause and resume screen mirroring using a shortcut
3 participants