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 the VirtualDisplay method to fix the SurfaceControl API changes. #4657

Closed
wants to merge 1 commit into from

Conversation

DerekWuYD
Copy link
Contributor

#4646

Use DisplayManager to create VirtualDisplay object replace origin SurfaceControl method.
Add the MediaProjectionGlobal workaround for some transitional version Android ROM.

Use DisplayManager to create VirtualDisplay object replace origin SurfaceControl method
Add the MediaProjectionGlobal workaround for some transitional version Android ROM.
rom1v pushed a commit that referenced this pull request Feb 9, 2024
The method SurfaceControl.createDisplay() has been removed in AOSP.

Use DisplayManager to create a VirtualDisplay object instead.

Fixes #4646 <#4646>
Fixes #4656 <#4656>
PR #4657 <#4657>

Signed-off-by: Romain Vimont <rom@rom1v.com>
@rom1v
Copy link
Collaborator

rom1v commented Feb 9, 2024

Awesome, thank you very much! ❤️

I made some changes, the main one is to try the SurfaceControl API first, for several reasons:

(Btw, do you know how to support cropping and capture orientation with this new method?)

And I removed the MediaProjectionGlobal workaround:

Branch display_manager_api (currently based on master, but in the end it will be merged into dev).

For users looking for a fix, use v2.4 or higher. Here is a binary to replace in your scrcpy 2.3.1 release:

  • scrcpy-server SHA-256: 38d3aaeb1ecb8aaed9c7c471232f53309e02d6f98fb50bea645ce264ac228f0
oldAnd old version which did not use the configured displayId (it always used 0):

  • scrcpy-server SHA-256: cbc1302cfaf501bdb158ae4ef70ccf8a183b7fc5e2e336aa087508d0016fc11

Review and feedbacks welcome.

@rom1v rom1v mentioned this pull request Feb 9, 2024
2 tasks
@MemeCornucopia
Copy link

Thank you @DerekWuYD it works!

rom1v pushed a commit that referenced this pull request Feb 9, 2024
The method SurfaceControl.createDisplay() has been removed in AOSP.

Use DisplayManager to create a VirtualDisplay object instead.

Fixes #4646 <#4646>
Fixes #4656 <#4656>
PR #4657 <#4657>

Signed-off-by: Romain Vimont <rom@rom1v.com>
@DerekWuYD
Copy link
Contributor Author

@rom1v Thanks for your review and optimize.

@DerekWuYD
Copy link
Contributor Author

Unfortunately, I'm not sure how to support the cropping and orientation with the VirutalDisplay class.

rom1v pushed a commit that referenced this pull request Feb 10, 2024
The method SurfaceControl.createDisplay() has been removed in AOSP.

Use DisplayManager to create a VirtualDisplay object instead.

Fixes #4646 <#4646>
Fixes #4656 <#4656>
PR #4657 <#4657>

Signed-off-by: Romain Vimont <rom@rom1v.com>
@rom1v
Copy link
Collaborator

rom1v commented Feb 10, 2024

Merged into dev: be3f949

@ballo
Copy link

ballo commented Feb 11, 2024

For users looking for a fix, here is a binary to replace in your scrcpy 2.3.1 release:

  • scrcpy-server SHA-256: 38d3aaeb1ecb8aaed9c7c471232f53309e02d6f98fb50bea645ce264ac228f0

This works for me, thank you!

@eiyooooo
Copy link
Contributor

eiyooooo commented Apr 12, 2024

I made some changes, the main one is to try the SurfaceControl API first

In my opinion, Android 14 should not try SurfaceControl, because it will cause some issues blame to orientation has changed to auto calculate.

Android 14 incorrect capture fixed at 7e3b935

armm29393 added a commit to armm29393/scrcpy-root that referenced this pull request May 24, 2024
scrcpy v2.4

Changes since v2.3.1:
 - Add UHID keyboard and mouse support (Genymobile#4473)
 - Simulate tilt multitouch by pressing Shift (Genymobile#4529)
 - Add rotation support for non-default display (Genymobile#4698)
 - Improve audio player (Genymobile#4572)
 - Adapt to display API changes in Android 15 (Genymobile#4646, Genymobile#4656, Genymobile#4657)
 - Adapt audio workarounds to Android 14 (Genymobile#4492)
 - Fix clipboard for IQOO devices on Android 14 (Genymobile#4492, Genymobile#4589, Genymobile#4703)
 - Fix integer overflow for audio packet duration (Genymobile#4536)
 - Rework cleanup (Genymobile#4649)
 - Upgrade FFmpeg to 6.1.1 in Windows releases (Genymobile#4713)
 - Upgrade libusb to 1.0.27 in Windows releases (Genymobile#4713)
 - Various technical fixes
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.

5 participants