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

MacOs sonoma scrcpy 2.6.1 app starts but there is no window #5182

Closed
ravmiecznik opened this issue Aug 10, 2024 · 12 comments
Closed

MacOs sonoma scrcpy 2.6.1 app starts but there is no window #5182

ravmiecznik opened this issue Aug 10, 2024 · 12 comments

Comments

@ravmiecznik
Copy link

ravmiecznik commented Aug 10, 2024

Environment

  • MacOs Sonoma 14.4.1
  • 2.6.1
  • brew install scrcpy and manual build from sources
  • Onyx Boox
  • Android14

After installation of latest scrcpy 2.6.1 with brew install scrcpy I am running it from terminal: scrcpy, I've also tried few options like scrcpy -m1024. Every time I can see scrcpy icon appears in the dock, I can also switch to this app with CMD+TAB but there is no window of this app visible.
I tried to rebuild the same version manually according to: https://github.com/Genymobile/scrcpy/blob/master/doc/build.md but the result was the same. In this case I tried to run it from repo location with ./run x -m1024 the effect was the same.

After switching to tag 2.1 and building it again the application works just fine. It seems there is some bug somewhere between version 2.1 and 2.6.1 and it seems this is more related to application display because despite the screencast is not visible in the latest version all other options seems to work fine.

@rom1v
Copy link
Collaborator

rom1v commented Aug 10, 2024

After switching to tag 2.1 and building it again the application works just fine. It seems there is some bug somewhere between version 2.1 and 2.6.1 and it seems this is more related to application display because despite the screencast is not visible in the latest version all other options seems to work fine.

Could you please test the versions in between?

Even better, could you git bisect to find the exact commit which causes the problem for you?

@ravmiecznik
Copy link
Author

ravmiecznik commented Aug 10, 2024

Sure I can help ;)

╰─$ git bisect bad                                                                                                                                                                                                                                       2 ↵
2b6089cbfc29c41643e0c0e8049bda3ede777b61 is the first bad commit
commit 2b6089cbfc29c41643e0c0e8049bda3ede777b61
Author: Romain Vimont <[email protected]>
Date:   Wed Jul 31 00:43:03 2024 +0200

    Enable workarounds by default

    Workarounds were disabled by default, and only enabled for some devices
    or under specific conditions.

    But it seems they are needed for more and more devices, so enable them
    by default. They could be disabled for specific devices if necessary in
    the future.

    In the past, these workarounds caused a (harmless) exception to be
    printed on some Xiaomi devices [1]. But this is not a problem anymore
    since commit b8c5853aa6ac9cfbe3fb4e46bf10978b3fa212e3.

    They also caused problems for audio on Vivo devices [2], but it seems
    this is not the case anymore [3].

    They might also impact an old Nvidia Shield [4], but hopefully this is
    fixed now.

    [1]: <https://github.com/Genymobile/scrcpy/issues/4015#issuecomment-1595382142>
    [2]: <https://github.com/Genymobile/scrcpy/issues/3805#issuecomment-1596148031>
    [3]: <https://github.com/Genymobile/scrcpy/issues/3805#issuecomment-2260205882>
    [4]: <https://github.com/Genymobile/scrcpy/issues/940>

    PR #5154 <https://github.com/Genymobile/scrcpy/pull/5154>

 .../main/java/com/genymobile/scrcpy/Server.java    |  4 +-
 .../java/com/genymobile/scrcpy/Workarounds.java    | 58 ++--------------------
 2 files changed, 7 insertions(+), 55 deletions(-)

This version has the bug:

╰─$ ./run x --version
scrcpy 2.5 <https://github.com/Genymobile/scrcpy>

Dependencies (compiled / linked):
 - SDL: 2.30.6 / 2.30.6
 - libavcodec: 61.3.100 / 61.3.100
 - libavformat: 61.1.100 / 61.1.100
 - libavutil: 59.8.100 / 59.8.100
 - libusb: - / 1.0.27

@rom1v
Copy link
Collaborator

rom1v commented Aug 10, 2024

Thank you very much 👍

Can you please post the whole scrcpy output (which contains your device model, manufacturer and brand) so that I add an exception for your device model?

@ravmiecznik
Copy link
Author

ravmiecznik commented Aug 10, 2024

scrcpy 2.6.1 https://github.com/Genymobile/scrcpy
INFO: ADB device found:
INFO: --> (usb) BCCFA18 device NoteAir2P
x/server/scrcpy-server: 1 file pushed, 0 skipped. 268.7 MB/s (71112 bytes in 0.000s)
[server] INFO: Device: [ONYX] ONYX NoteAir2P (Android 11)
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: Error 0xfffffff4
[server] INFO: Retrying with -m1600...
[server] INFO: Retrying...
INFO: Renderer: metal
INFO: Texture: 1400x1872

@rom1v
Copy link
Collaborator

rom1v commented Aug 10, 2024

Here, on master, there are two calls:

fillAppInfo();
fillAppContext();

fillAppInfo();
fillAppContext();

Could you please test and report which ones of the 3 changes work for you:

fillAppInfo();
// fillAppContext();  // remove
// fillAppInfo();  // remove
fillAppContext();
// fillAppInfo(); // remove
// fillAppContext();  // remove

?

@ravmiecznik
Copy link
Author

ravmiecznik commented Aug 10, 2024

THIS WORKS:

        // fillAppInfo();
        fillAppContext();

If I comment fillAppContext(); or both below error is visible

[server] INFO: Device: [ONYX] ONYX NoteAir2P (Android 11)
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: Error 0xfffffff4
[server] INFO: Retrying with -m1600...
[server] INFO: Retrying...
INFO: Renderer: metal
INFO: Texture: 1400x1872
[server] ERROR: Audio capture error
java.io.IOException: Could not read audio: 0
        at com.genymobile.scrcpy.audio.AudioEncoder.inputThread(AudioEncoder.java:105)
        at com.genymobile.scrcpy.audio.AudioEncoder.lambda$encode$1$com-genymobile-scrcpy-audio-AudioEncoder(AudioEncoder.java:207)
        at com.genymobile.scrcpy.audio.AudioEncoder$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0)
        at java.lang.Thread.run(Thread.java:923)

============================================================================

rom1v added a commit that referenced this issue Aug 10, 2024
Calling fillAppInfo() breaks video mirroring on ONYX devices.

Fixes #5182 <#5182>
Refs 2b6089c
@rom1v
Copy link
Collaborator

rom1v commented Aug 10, 2024

Please test branch issue5182 (0c95794).

If it works, I merged into dev.

rom1v added a commit that referenced this issue Aug 10, 2024
Calling fillAppInfo() breaks video mirroring on ONYX devices.

Fixes #5182 <#5182>
Refs 2b6089c
@ravmiecznik
Copy link
Author

ravmiecznik commented Aug 10, 2024

this works fine: no errors visible, screencast works fine

╰─$ echo "$(git branch)"
* issue5182
  master
43 actionable tasks: 9 executed, 34 up-to-date
[67/68] Linking target app/scrcpy
scrcpy 2.6.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  BCCFA18                         device  NoteAir2P
x/server/scrcpy-server: 1 file pushed, 0 skipped. 279.3 MB/s (71096 bytes in 0.000s)
[server] INFO: Device: [ONYX] ONYX NoteAir2P (Android 11)
INFO: Renderer: metal
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: Error 0xfffffff4
INFO: Texture: 1400x1872
[server] INFO: Retrying with -m1600...
[server] INFO: Retrying...
INFO: Texture: 1200x1600
WARN: Killing the server...

@rom1v
Copy link
Collaborator

rom1v commented Aug 10, 2024

👍 Thank you very much for your help.

Merged into dev.

[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: Error 0xfffffff4
[server] INFO: Retrying with -m1600...

Does it work at the native resolution with another encoder?

@rom1v rom1v closed this as completed Aug 10, 2024
@ravmiecznik
Copy link
Author

No problem, thank you for this great application !

@ravmiecznik
Copy link
Author

ravmiecznik commented Aug 10, 2024

For encoders test, so the right encoder will be the one which does not produce error ?:

[server] ERROR: Encoding error: android.media.MediaCodec$CodecException:

╰─$ scrcpy --list-encoders
scrcpy 2.6.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  BCCFA18                         device  NoteAir2P
/opt/homebrew/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 99.3 MB/s (71096 bytes in 0.001s)
[server] INFO: Device: [ONYX] ONYX NoteAir2P (Android 11)
[server] INFO: List of video encoders:
    --video-codec=h264 --video-encoder='OMX.qcom.video.encoder.avc'
    --video-codec=h264 --video-encoder='c2.android.avc.encoder'
    --video-codec=h264 --video-encoder='OMX.google.h264.encoder'
    --video-codec=h265 --video-encoder='OMX.qcom.video.encoder.hevc'
    --video-codec=h265 --video-encoder='OMX.qcom.video.encoder.hevc.cq'
    --video-codec=h265 --video-encoder='c2.android.hevc.encoder'
[server] INFO: List of audio encoders:
    --audio-codec=opus --audio-encoder='c2.android.opus.encoder'
    --audio-codec=aac --audio-encoder='c2.android.aac.encoder'
    --audio-codec=aac --audio-encoder='OMX.google.aac.encoder'
    --audio-codec=flac --audio-encoder='c2.android.flac.encoder'
    --audio-codec=flac --audio-encoder='OMX.google.flac.encoder'

The only one which works without error is:

╰─$ scrcpy --video-codec=h264 --video-encoder='c2.android.avc.encoder'
scrcpy 2.6.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  BCCFA18                         device  NoteAir2P
/opt/homebrew/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 109.7 MB/s (71096 bytes in 0.001s)
[server] INFO: Device: [ONYX] ONYX NoteAir2P (Android 11)
INFO: Renderer: metal
INFO: Texture: 1400x1872

@rom1v
Copy link
Collaborator

rom1v commented Aug 18, 2024

This is merged into dev, but until this is released, for convenience for users with a ONYX device impacted by this issue, here is a binary generated from the current dev branch (0c95794):

  • scrcpy-server SHA-256: 584673ead9b884f56d970e895e0a0f2c3cec18cc43efc07b6bfd8d5d66609df

On Windows, replace this server in your scrcpy 2.6.1 release directory.

On Linux or macOS:

export SCRCPY_SERVER_PATH=/path/to/scrcpy-server  # adapt the path
scrcpy

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

No branches or pull requests

2 participants