-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
The Meizu phone cannot display the screen. #4143
Comments
Does it work with scrcpy 2.0 (the previous version)? Does it work with another video encoder (see |
[server] INFO: List of video encoders: DEBUG: Using server (portable): D:\zuomina\scrcpy-win64-v2.0\scrcpy-win64-v2.0\scrcpy-server |
I tested several Meizu phones in succession,scrcpy2.1 version of all Meizu mobile phones can not load the screen normally. |
Thank you for your report. Could you please find out which commit introduced the problem between 2.0 and 2.1? See #4146 |
@Helaer Thank you. Could you please test which combinaison of scrcpy/server/src/main/java/com/genymobile/scrcpy/Workarounds.java Lines 68 to 76 in 625934f
|
Even with the 3 enabled at the same time? Or any 2? or any 1? or none? (there are 8 combinations) Will have to find the offending commit with |
@rom1v Sorry, I may not have forgotten to replace the file, Now I retest this branch (6ba99a6) is also not work properly, Here is the scrcpy2.0 log prompt. [server] INFO: Device: Meizu 16th Plus (Android 8.1.0) |
Oh, you will need to chery-pick c0f3c08. |
In fact, you are not testing the correct scrcpy-server, since the exception in the stack trace is related to |
I don't know what can be done, but what is clear is that the problem is out on this branch (6ba99a6). |
@rom1v Do you have a fix for Meizu? I can test it for you. |
What is the problem/error message observed if you build and run on this commit? It could not be the stacktrace you posted in #4143 (comment) (the code/line numbers do not match). |
I built on windows using MSYS2 MINGW64 without any errors.I have two Meizu phones, one with Android 8.1 and one with Android 11, and neither of them can use version 2.1 of ScrCPy. $ ./server/scripts/build-wrapper.sh "server" "server/scrcpy-server" "release" BUILD SUCCESSFUL in 8s |
@Helaer I understand that on your devices, it works on scrcpy v2.0 but not on v2.1. I just point out that in your tests to find the culprit commit, you said that you built the version from commit 6ba99a6 and that running this version did not work for your Meizu phone. But you posted this stacktrace:
The code and line numbers do not match commit 6ba99a6, so definitely the scrcpy-server you tested is not the expected one. Therefore, we cannot conclude if 6ba99a6 is ok or not (and what is the real error/problem when the built scrcpy-server matches the commit). |
Sorry, limited ability can not help you more, I just posted the cmd display information. |
OK thank you for the test :)
The problem is between 6ba99a6 and v2.1. If you could try git bisect start
git bisect good 6ba99a62ff51c0ce209db78a9ed17f1633170027
git bisect bad v2.1
# CHECKPOINT
# it checkouts a version to test
# build it and run to see if it works
ninja -Cx && ./run x
# if it works (the window is opened normally):
git bisect good
# or if it does not work (the problem is the same as v2.1):
git bit bad
# goto CHECKPOINT |
@rom1v Problem found, branch is located in (feab870), the log is as follows: mr.zhang@DESKTOP-K371ALP MINGW64 /d/scrcpy ((92483fe...)|BISECTING) mr.zhang@DESKTOP-K371ALP MINGW64 /d/scrcpy ((7d33798...)|BISECTING) mr.zhang@DESKTOP-K371ALP MINGW64 /d/scrcpy ((be86e14...)|BISECTING) mr.zhang@DESKTOP-K371ALP MINGW64 /d/scrcpy ((feab870...)|BISECTING) mr.zhang@DESKTOP-K371ALP MINGW64 /d/scrcpy ((751a365...)|BISECTING)
.../java/com/genymobile/scrcpy/AsyncProcessor.java | 11 ++++- |
@rom1v Can you analyze the problem as soon as possible now, and release a repair code, so that I can quickly help you test, I will soon get off work. |
Oh, I think I have an explanation: IIRC the meizu phone requires that the encoder thread has a looper. The commit changing the thread of the video screen encoder broke this assumption. Calling |
I don't know what to do, but if you have a fix, I can help you test it. |
Please test scrcpy-server.zip diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index db15d5f3..0559c451 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -8,6 +8,7 @@ import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.os.Build;
import android.os.IBinder;
+import android.os.Looper;
import android.os.SystemClock;
import android.view.Surface;
@@ -68,6 +69,8 @@ public class ScreenEncoder implements Device.RotationListener, Device.FoldListen
}
private void streamScreen() throws IOException, ConfigurationException {
+ Looper.prepare();
+
Codec codec = streamer.getCodec();
MediaCodec mediaCodec = createMediaCodec(codec, encoderName);
MediaFormat format = createFormat(codec.getMimeType(), videoBitRate, maxFps, codecOptions); |
Thank you, this patch is effective, my Meizu phone can work normally. |
@rom1v You are too bull, this method is effective, my Meizu mobile phone can normally use scrcpy2.1 version. |
Perfect 👌 Is audio encoding also impacted on v2.1?
(since your phone runs Android 11, don't forget to switch on and unlock the device before running the command) |
Audio forwarding works properly. |
7e936fa pushed to Please re-test the current |
I tried booting with and without audio, but both stuck and couldn't open the window.
C:\Scrcpy>scrcpy -Vdebug
scrcpy 2.1 https://github.com/Genymobile/scrcpy
DEBUG: ADB device found:
DEBUG: --> (usb) Z91QGFWT22376 device meizu_17_Pro
DEBUG: Device serial: Z91QGFWT22376
DEBUG: Using server (portable):C:\Scrcpy\s
crcpy-server
C:\Scrcpy...ped. 60.1 MB/s (58091 bytes in 0.001s)
[server] INFO: Device: [meizu] meizu meizu 17 Pro (Android 11)
[server] DEBUG: Using video encoder: 'OMX.qcom.video.encoder.avc'
DEBUG: Server connected
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
INFO: Renderer: direct3d
DEBUG: Trilinear filtering disabled (not an OpenGL renderer
DEBUG: Using icon (portable): C:\Scrcpy\ico
n.png
DEBUG: Demuxer 'video': starting thread
DEBUG: Demuxer 'audio': starting thread
INFO: Texture: 1080x2336
[server] DEBUG: Using audio encoder: 'c2.android.opus.encoder'
[server] ERROR: Audio capture error
java.io.IOException: Could not read audio: 0
at com.genymobile.scrcpy.AudioEncoder.inputThread(AudioEncoder.java:98)
at com.genymobile.scrcpy.AudioEncoder.lambda$encode$1$com-genymobile-scr
cpy-AudioEncoder(AudioEncoder.java:198)
at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda1.run(Unkn
own Source:4)
at java.lang.Thread.run(Thread.java:923)
[server] DEBUG: Audio encoder stopped
C:\Scrcpy>scrcpy --no-audio -Vdebug
scrcpy 2.1 https://github.com/Genymobile/scrcpy
DEBUG: ADB device found:
DEBUG: --> (usb) Z91QGFWT22376 device meizu_17_Pro
DEBUG: Device serial: Z91QGFWT22376
DEBUG: Using server (portable): C:\Scrcpy\s
crcpy-server
C:\Scrcpy...ped. 89.4 MB/s (58091 bytes in 0.001s)
[server] INFO: Device: [meizu] meizu meizu 17 Pro (Android 11)
DEBUG: Server connected
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
[server] DEBUG: Using video encoder: 'OMX.qcom.video.encoder.avc'
INFO: Renderer: direct3d
DEBUG: Trilinear filtering disabled (not an OpenGL renderer
DEBUG: Using icon (portable): C:\Scrcpy\ico
n.png
DEBUG: Demuxer 'video': starting thread
INFO: Texture: 1080x2336
The text was updated successfully, but these errors were encountered: