Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
113.48k stars 10.81k forks source link

Stops working on Samsung Galaxy A52 #2313

Open andrei-mihut opened 3 years ago

andrei-mihut commented 3 years ago

Environment

Describe the bug on windows does not even start, on linux works with youtube but dies with prime video.

i tried most of the tricks to make it work to no avail. i need to mention that the same environment works as advertised wit LG Stylo 5

On errors, please provide the output of the console (and adb logcat if relevant).

`~ $ scrcpy 
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server:...shed. 0.7 MB/s (34930 bytes in 0.045s)
[server] INFO: Device: samsung SM-A526U (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 3.0 Mesa 20.0.8
INFO: Trilinear filtering enabled
INFO: Initial texture: 2400x1080
[server] ERROR: Exception on thread Thread[main,5,main]
WARN: Device disconnected
java.lang.IllegalStateException
    at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
    at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452)
    at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:113)
    at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:94)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
    at com.genymobile.scrcpy.Server.main(Server.java:252)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:409)
WARN: Killing the server...
andrei@andrei-X551MA ~ $ scrcpy -m2160
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server:...shed. 2.0 MB/s (34930 bytes in 0.016s)
[server] INFO: Device: samsung SM-A526U (Android 11)
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalStateException
    at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
    at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452)
    at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:113)
    at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:94)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
    at com.genymobile.scrcpy.Server.main(Server.java:252)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:409)
INFO: Renderer: opengl
INFO: OpenGL version: 3.0 Mesa 20.0.8
INFO: Trilinear filtering enabled
INFO: Initial texture: 2160x976
WARN: Device disconnected
WARN: Killing the server...
andrei@andrei-X551MA ~ $ uname -a
Linux andrei-X551MA 5.4.0-39-generic #43~18.04.1-Ubuntu SMP Mon Jun 22 19:05:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux`

Please do not post screenshots of your terminal, just post the content as text instead.

rom1v commented 3 years ago

Did you try a really lower definition, like -m800?

Maybe the device hardware could not encode the screen at high definition and play a video on the device simultaneously?

andrei-mihut commented 3 years ago

I tried m800 and many more to no avail. On Linux I am able to get it going on normal screen and even play YouTube video, but once I start prime video it gets killed. On windows it gets killed right away.

Both laptops, Linux and windows work perfectly with LG Stylo 5. I just got the A52 yesterday. It's fairly new on the market but the performance is way better than the Stylo. I guess I will wait until the bugs get ironed out. It might be the ADB...?

Thanks for answering so quickly. Andrei

On Fri, May 14, 2021, 1:15 PM Romain Vimont @.***> wrote:

Did you try a really lower definition, like -m800?

Maybe the device hardware could not encode the screen at high definition and play a video on the devixe simultaneously?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/2313#issuecomment-841386555, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUCJSGEXQOSGK6KRGXOTSHLTNVLDNANCNFSM444OG4OA .

rom1v commented 3 years ago

Could you test with another encoder?

andrei-mihut commented 3 years ago

Tested all three that are available.

On Fri, May 14, 2021, 1:30 PM Romain Vimont @.***> wrote:

Could you test with another encoder https://github.com/Genymobile/scrcpy#encoder?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/2313#issuecomment-841394121, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUCJSGEO2KYPASMTUMZ3QWTTNVMZZANCNFSM444OG4OA .

rom1v commented 3 years ago

It might be the ADB...?

Since there is an exception at MediaCodec.native_dequeueOutputBuffer, I don't think so.

And this is a problem on the device side, so the problem should be the same on Windows or Linux.

andrei-mihut commented 3 years ago

It looks to me that more and more is something that the prime video does to the display.

On Fri, May 14, 2021, 1:42 PM Andrei Mihut @.***> wrote:

As I said, it stops working when I try to use prime video. YouTube is a little lagging about half a second, but still shows. The qcom encoder is the quickest, then c2, then google.

On Fri, May 14, 2021, 1:34 PM Romain Vimont @.***> wrote:

It might be the ADB...?

Since there is an exception at MediaCodec.native_dequeueOutputBuffer, I don't think so.

And this is a problem on the device side, so the problem should be the same on Windows or Linux.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/2313#issuecomment-841396326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUCJSGAM6TVFTGYR43K77ZDTNVNKZANCNFSM444OG4OA .

andrei-mihut commented 3 years ago

This is what i get with youtube full screen with the smallest lag:


@.***X551MA ~ $ scrcpy --encode OMX.qcom.video.encoder.avc INFO: scrcpy 1.17 https://github.com/Genymobile/scrcpy /usr/local/share/scrcpy/scrcpy-server:...shed. 3.1 MB/s (34930 bytes in 0.011s) [server] INFO: Device: samsung SM-A526U (Android 11) INFO: Renderer: opengl INFO: OpenGL version: 3.0 Mesa 20.0.8 INFO: Trilinear filtering enabled INFO: Initial texture: 2400x1080

On Fri, May 14, 2021 at 1:44 PM Andrei Mihut @.***> wrote:

It looks to me that more and more is something that the prime video does to the display.

On Fri, May 14, 2021, 1:42 PM Andrei Mihut @.***> wrote:

As I said, it stops working when I try to use prime video. YouTube is a little lagging about half a second, but still shows. The qcom encoder is the quickest, then c2, then google.

On Fri, May 14, 2021, 1:34 PM Romain Vimont @.***> wrote:

It might be the ADB...?

Since there is an exception at MediaCodec.native_dequeueOutputBuffer, I don't think so.

And this is a problem on the device side, so the problem should be the same on Windows or Linux.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/2313#issuecomment-841396326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUCJSGAM6TVFTGYR43K77ZDTNVNKZANCNFSM444OG4OA .

-- 안드레 미훝 ენდრიუ მე ქოხი اندريه ميهوت אנדריי מיהו 安德魯 アンドルー Андрей Михут אַנדרעי מיהוט اندرو میهو

andrei-mihut commented 3 years ago

I found a solution. In the prime video app disable the hardware acceleration. It works.

On Fri, May 14, 2021, 1:51 PM Andrei Mihut @.***> wrote:

once i start prime video: WARN: Device disconnected [server] ERROR: Exception on thread Thread[main,5,main] java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452) at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:113) at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:94) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60) at com.genymobile.scrcpy.Server.scrcpy(Server.java:80) at com.genymobile.scrcpy.Server.main(Server.java:252) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:409) WARN: Killing the server...

On Fri, May 14, 2021 at 1:48 PM Andrei Mihut @.***> wrote:

This is what i get with youtube full screen with the smallest lag:


@.***X551MA ~ $ scrcpy --encode OMX.qcom.video.encoder.avc INFO: scrcpy 1.17 https://github.com/Genymobile/scrcpy /usr/local/share/scrcpy/scrcpy-server:...shed. 3.1 MB/s (34930 bytes in 0.011s) [server] INFO: Device: samsung SM-A526U (Android 11) INFO: Renderer: opengl INFO: OpenGL version: 3.0 Mesa 20.0.8 INFO: Trilinear filtering enabled INFO: Initial texture: 2400x1080

On Fri, May 14, 2021 at 1:44 PM Andrei Mihut @.***> wrote:

It looks to me that more and more is something that the prime video does to the display.

On Fri, May 14, 2021, 1:42 PM Andrei Mihut @.***> wrote:

As I said, it stops working when I try to use prime video. YouTube is a little lagging about half a second, but still shows. The qcom encoder is the quickest, then c2, then google.

On Fri, May 14, 2021, 1:34 PM Romain Vimont @.***> wrote:

It might be the ADB...?

Since there is an exception at MediaCodec.native_dequeueOutputBuffer, I don't think so.

And this is a problem on the device side, so the problem should be the same on Windows or Linux.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/2313#issuecomment-841396326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUCJSGAM6TVFTGYR43K77ZDTNVNKZANCNFSM444OG4OA .

-- 안드레 미훝 ენდრიუ მე ქოხი اندريه ميهوت אנדריי מיהו 安德魯 アンドルー Андрей Михут אַנדרעי מיהוט اندرو میهو

-- 안드레 미훝 ენდრიუ მე ქოხი اندريه ميهوت אנדריי מיהו 安德魯 アンドルー Андрей Михут אַנדרעי מיהוט اندرو میهو

andrei-mihut commented 3 years ago

once i start prime video: WARN: Device disconnected [server] ERROR: Exception on thread Thread[main,5,main] java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452) at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:113) at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:94) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60) at com.genymobile.scrcpy.Server.scrcpy(Server.java:80) at com.genymobile.scrcpy.Server.main(Server.java:252) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:409) WARN: Killing the server...

On Fri, May 14, 2021 at 1:48 PM Andrei Mihut @.***> wrote:

This is what i get with youtube full screen with the smallest lag:


@.***X551MA ~ $ scrcpy --encode OMX.qcom.video.encoder.avc INFO: scrcpy 1.17 https://github.com/Genymobile/scrcpy /usr/local/share/scrcpy/scrcpy-server:...shed. 3.1 MB/s (34930 bytes in 0.011s) [server] INFO: Device: samsung SM-A526U (Android 11) INFO: Renderer: opengl INFO: OpenGL version: 3.0 Mesa 20.0.8 INFO: Trilinear filtering enabled INFO: Initial texture: 2400x1080

On Fri, May 14, 2021 at 1:44 PM Andrei Mihut @.***> wrote:

It looks to me that more and more is something that the prime video does to the display.

On Fri, May 14, 2021, 1:42 PM Andrei Mihut @.***> wrote:

As I said, it stops working when I try to use prime video. YouTube is a little lagging about half a second, but still shows. The qcom encoder is the quickest, then c2, then google.

On Fri, May 14, 2021, 1:34 PM Romain Vimont @.***> wrote:

It might be the ADB...?

Since there is an exception at MediaCodec.native_dequeueOutputBuffer, I don't think so.

And this is a problem on the device side, so the problem should be the same on Windows or Linux.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/2313#issuecomment-841396326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUCJSGAM6TVFTGYR43K77ZDTNVNKZANCNFSM444OG4OA .

-- 안드레 미훝 ენდრიუ მე ქოხი اندريه ميهوت אנדריי מיהו 安德魯 アンドルー Андрей Михут אַנדרעי מיהוט اندرو میهو

-- 안드레 미훝 ენდრიუ მე ქოხი اندريه ميهوت אנדריי מיהו 安德魯 アンドルー Андрей Михут אַנדרעי מיהוט اندرو میهو

andrei-mihut commented 3 years ago

As I said, it stops working when I try to use prime video. YouTube is a little lagging about half a second, but still shows. The qcom encoder is the quickest, then c2, then google.

On Fri, May 14, 2021, 1:34 PM Romain Vimont @.***> wrote:

It might be the ADB...?

Since there is an exception at MediaCodec.native_dequeueOutputBuffer, I don't think so.

And this is a problem on the device side, so the problem should be the same on Windows or Linux.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/2313#issuecomment-841396326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUCJSGAM6TVFTGYR43K77ZDTNVNKZANCNFSM444OG4OA .

manz00 commented 3 years ago

`~ $ scrcpy INFO: scrcpy 1.17 https://github.com/Genymobile/scrcpy /usr/local/share/scrcpy/scrcpy-server:...shed. 0.7 MB/s (34930 bytes in 0.045s) [server] INFO: Device: samsung SM-A526U (Android 11) INFO: Renderer: opengl INFO: OpenGL version: 3.0 Mesa 20.0.8 INFO: Trilinear filtering enabled INFO: Initial texture: 2400x1080 [server] ERROR: Exception on thread Thread[main,5,main] WARN: Device disconnected java.lang.IllegalStateException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452) at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:113) at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:94) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60) at com.genymobile.scrcpy.Server.scrcpy(Server.java:80) at com.genymobile.scrcpy.Server.main(Server.java:252) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:409) WARN: Killing the server...

I am also an user of Samsung A52 and encountered the same problem with my academy app after an update that was given today. So i tried it in other samsung mobile, the problem there is the video part is shown blank/dark, and everything else is working fine.

AndroidDeveloperLB commented 3 years ago

@rom1v I've tried today to use ScrCpy on Samsung Galaxy A32 with Android 11. I think I see the same issue. I run this batch file on Windows 10:

CreateObject("Wscript.Shell").Run "cmd /c scrcpy.exe -S --always-on-top", 0, false

Then it turns off the display of the device for a very short time, then it turns on again, and nothing happens. ScrCpy just closes itself. Issue occurs whether I use USB or adb-over-Wi-fi.

Want me to create a new bug report, or stay here? I can provide more information if needed