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

Make available resources about building/using newer versions with Meizu phones #2656

Closed
1 task done
Daniel-Brum opened this issue Sep 22, 2021 · 19 comments
Closed
1 task done

Comments

@Daniel-Brum
Copy link

Is your feature request related to a problem? Please describe.
I can't seem to make scrcpy work with my Meizu M6 Note phone whenever I use any version above 1.13. I've seen in another issue that the "culprit commit" was identified and that it did pose other problems, so I can understand it might be needed.
But there are some changes and new features that are present in newer versions that are pretty much inaccessible on some setups for that reason.

Describe the solution you'd like
However, if it's possible, I'd like to see an alternative to the phones that don't work with the change introduced in 1.14 and above. It doesn't even need to be prebuilt; having written resources about how to do it would be enough.

Describe alternatives you've considered
I've tried all the workarounds I've found in all related issues (like changing bitrate, encoder and even cables/ports). But none of them worked on newer versions.

@rom1v
Copy link
Collaborator

rom1v commented Sep 22, 2021

I've seen in another issue that the "culprit commit" was identified and that it did pose other problems, so I can understand it might be needed.

I'm pretty sure we can make it work nevertheless, but I have no Meizu device.

Could you please help by testing this: #240 (comment)

Otherwise, building steps are described here: https://github.com/Genymobile/scrcpy/blob/master/BUILD.md

@Daniel-Brum
Copy link
Author

Daniel-Brum commented Sep 22, 2021

Following the instructions in 240-comment, I get the same "freezing" problem, but there's no message displayed after

[server] INFO: ### 1
[server] INFO: ### 2
INFO: Renderer: direct3d
INFO: Initial texture: 1080x1920

Are there any logs I can try to get and paste here? If so, how can I do it?

@rom1v
Copy link
Collaborator

rom1v commented Sep 22, 2021

Please replace the server from v1.19 release by this one:
scrcpy-server sha256:4587ff4a115ca535cb6bf249cb09add2005e650e177b4335281e2d2df731d39d

Does it freeze? Please post the whole console output.

diff
diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index 2f7109c5..df73d60a 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -9,6 +9,7 @@ import android.media.MediaCodecList;
 import android.media.MediaFormat;
 import android.os.Build;
 import android.os.IBinder;
+import android.os.Looper;
 import android.view.Surface;
 
 import java.io.FileDescriptor;
@@ -55,7 +56,10 @@ public class ScreenEncoder implements Device.RotationListener {
     }
 
     public void streamScreen(Device device, FileDescriptor fd) throws IOException {
-        Workarounds.prepareMainLooper();
+        Ln.i("Manufacturer: [" + Build.MANUFACTURER + "]");
+        Ln.i("Brand: [" + Build.BRAND + "]");
+        Ln.i("Model: [" + Build.MODEL + "]");
+        Looper.prepare();
 
         try {
             internalStreamScreen(device, fd);

@Daniel-Brum
Copy link
Author

I get this:

[server] INFO: Device: Meizu M6 Note (Android 7.1.2)
[server] INFO: Manufacturer: [Meizu]
[server] INFO: Brand: [Meizu]
[server] INFO: Model: [M6 Note]
INFO: Renderer: direct3d
INFO: Initial texture: 1080x1920

and then nothing happens. Anything else I could try?

@rom1v
Copy link
Collaborator

rom1v commented Sep 22, 2021

And this one?

scrcpy-server sha256:971189967483880579dfb428ceb0e16e401592f931efa605446e167c3776b6f8

diff
diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index 2f7109c5..ec9330bb 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -56,6 +56,9 @@ public class ScreenEncoder implements Device.RotationListener {
 
     public void streamScreen(Device device, FileDescriptor fd) throws IOException {
         Workarounds.prepareMainLooper();
+        if (Build.BRAND.equalsIgnoreCase("meizu")) {
+            Workarounds.fillAppInfo();
+        }
 
         try {
             internalStreamScreen(device, fd);

@Daniel-Brum
Copy link
Author

[server] INFO: Device: Meizu M6 Note (Android 7.1.2)
[server] INFO: Manufacturer: [Meizu]
[server] INFO: Brand: [Meizu]
[server] INFO: Model: [M6 Note]
INFO: Renderer: direct3d
INFO: Initial texture: 1080x1920

I've yet to try the encoder options though, but for now, no success.

@rom1v
Copy link
Collaborator

rom1v commented Sep 22, 2021

Oops, the last link was incorrect (it was the same as the first one). I fixed it. Could you retry, please?

@Daniel-Brum
Copy link
Author

It worked! Thanks a lot!

I still have to check the new features (I got really attracted by the --max-fps option), but so far it's working fine.

rom1v added a commit that referenced this issue Sep 22, 2021
Workarounds.fillAppInfo() is necessary for Meizu devices even before the
first call to internalStreamScreen(), but it is harmful on other
devices (#940).

Therefore, simplify the workaround, by calling fillAppInfo() only if
Build.BRAND equals "meizu" (case insensitive).

Fixes #240 <#240> (again)
Fixes #2656 <#2656>
@rom1v
Copy link
Collaborator

rom1v commented Sep 22, 2021

Fixed on dev: 8df42ce

Just to be sure, could you test the final version:
scrcpy-server sha256:7f2d14cf95ff3c490d6402100bf8f04261a5bc9bc050dfff83e6ee48ec5ac5d6

@Daniel-Brum
Copy link
Author

It worked fine too. Would be nice having this server file "pinned" or something like that, if possible. Thanks a lot for your help!

@rom1v
Copy link
Collaborator

rom1v commented Sep 22, 2021

Would be nice having this server file "pinned" or something like that

What do you mean?

@Daniel-Brum
Copy link
Author

Pinned is not the correct word for it, I suppose, but it would be nice to have the "alternative server" someplace easier to come by (though the ones who need it will probably search for it anyways, so not having that isn't a problem), Somewhere like in the Releases page for each version? Only if it isn't troublesome, of course.

@rom1v
Copy link
Collaborator

rom1v commented Sep 22, 2021

The problem is fixed on dev branch, so the next release will work as expected.

It was just a "bug" like many others, there are no backports to older versions.

@Daniel-Brum
Copy link
Author

Oh, good to hear that then. Thanks!

rom1v added a commit that referenced this issue Oct 21, 2021
Workarounds.fillAppInfo() is necessary for Meizu devices even before the
first call to internalStreamScreen(), but it is harmful on other
devices (#940).

Therefore, simplify the workaround, by calling fillAppInfo() only if
Build.BRAND equals "meizu" (case insensitive).

Fixes #240 <#240> (again)
Fixes #2656 <#2656>
@veselcraft
Copy link

Still not works on Meizu PRO 5

image

@rom1v
Copy link
Collaborator

rom1v commented May 5, 2023

@veselcraft Please test #3801 (comment). Does it work?

@veselcraft
Copy link

@veselcraft Please test #3801 (comment). Does it work?

Sure it does! It's smooth and the mouse controls works perfectly.

But i still have some glitches here, i think this is a problem on Flyme's side, not on scrcpy. Thanks for the fix anyways!
image
image

@rom1v
Copy link
Collaborator

rom1v commented May 6, 2023

If you record with adb shell screenrecord /sdcard/file.mp4, is the problem present on the resulting file?

@veselcraft
Copy link

If you record with adb shell screenrecord /sdcard/file.mp4, is the problem present on the resulting file?

It's present in any third-party screen recorder

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

3 participants