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

ERROR: Exception on thread Thread[video,5,main] #4922

Closed
2 tasks done
Kimi1860 opened this issue May 14, 2024 · 17 comments
Closed
2 tasks done

ERROR: Exception on thread Thread[video,5,main] #4922

Kimi1860 opened this issue May 14, 2024 · 17 comments

Comments

@Kimi1860
Copy link

Kimi1860 commented May 14, 2024

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: macOS Ventura 13.6
  • scrcpy version: 2.4
  • installation method: brew

Describe the bug
image

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

Please paste terminal output in a code block.

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

@rom1v
Copy link
Collaborator

rom1v commented May 14, 2024

The vendor rom calls an internal "Sky-something", which fails.

Could you please post your framework.jar?

adb pull /system/framework/framework.jar

@Kimi1860
Copy link
Author

framework.jar.zip
Here's the framework.jar

Thanks

@Kimi1860
Copy link
Author

Hi, I've post the framework.jar. Just wonder if there's any chance that my devices could be available to connect with this.

@rom1v
Copy link
Collaborator

rom1v commented May 17, 2024

It's weird, your framework.jar is almost empty, it doesn't contains the expected classes.

@Kimi1860
Copy link
Author

The OS provider is called Coocaa, maybe they did some tricks reconstructed the framework

@xtbbbbdx
Copy link

Same issue. Also happen at Skyworth TV, Looks like it's common issue on Skyworth TV

@HinsCoder
Copy link

My Skyworth Coocaa TV is the same issue.I tried to downgrade to scrcpy v1.19 and resolved the issue.But its maximum resolution can only be set to 1920 x 1080, and its HDMI channel is black screen (appears to have DRM protection?)

@rom1v
Copy link
Collaborator

rom1v commented Jul 3, 2024

I tried to downgrade to scrcpy v1.19 and resolved the issue.

With the latest version, does it work if you disable audio (scrcpy --no-audio)? What is the exact error you get (the full console output)?

@HinsCoder
Copy link

I tried to downgrade to scrcpy v1.19 and resolved the issue.

With the latest version, does it work if you disable audio (scrcpy --no-audio)? What is the exact error you get (the full console output)?

I just tried, but this error still persists.

C:\Users\Hins\Downloads\scrcpy-win64-v2.5>scrcpy --no-audio
scrcpy 2.5 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     --> (tcpip)  192.168.31.22:5555              device  7T872_P60P
C:\Users\Hins\Downloads\scrcpy-win64-v2.5\scrcpy...ed, 0 skipped. 86.8 MB/s (69624 bytes in 0.001s)
[server] INFO: Device: [skyworth] Coocaa 7T872_P60P (Android 10)
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
        at android.media.MediaCodec.getCurProcessName(MediaCodec.java:1913)
        at android.media.MediaCodec.setSkyMediaStatus(MediaCodec.java:1927)
        at android.media.MediaCodec.release(MediaCodec.java:1949)
        at com.genymobile.scrcpy.SurfaceEncoder.streamCapture(SurfaceEncoder.java:95)
        at com.genymobile.scrcpy.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-SurfaceEncoder(SurfaceEncoder.java:257)
        at com.genymobile.scrcpy.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
        at java.lang.Thread.run(Thread.java:919)
INFO: Renderer: direct3d
ERROR: Controller error

@DancingDolphins
Copy link

DancingDolphins commented Jul 8, 2024

same here and my
framework.jar.zip

for 1.19 is OK

D:\scrcpy\scrcpy-win64-v1.19>scrcpy.exe
INFO: scrcpy 1.19 <https://github.com/Genymobile/scrcpy>
D:\scrcpy\scrcpy-win64-v1.19\scrcpy-server: 1 file pushed, 0 skipped. 28.1 MB/s (37330 bytes in 0.001s)
[server] INFO: Device: Skyworth 1AA03_BC20 (Android 9)
INFO: Renderer: direct3d
INFO: Initial texture: 1920x1080


for 1.20 is error

D:\scrcpy\scrcpy-win64-v1.20>scrcpy.exe
INFO: scrcpy 1.20 <https://github.com/Genymobile/scrcpy>
D:\scrcpy\scrcpy-win64-v1.20\scrcpy-server: 1 file pushed, 0 skipped. 33.9 MB/s (37139 bytes in 0.001s)
[server] INFO: Device: Skyworth 1AA03_BC20 (Android 9)
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
        at android.media.MediaCodec.getCurProcessName(MediaCodec.java:3885)
        at android.media.MediaCodec.setSkyMediaStatus(MediaCodec.java:3898)
        at android.media.MediaCodec.<init>(MediaCodec.java:1810)
        at android.media.MediaCodec.createEncoderByType(MediaCodec.java:1787)
        at com.genymobile.scrcpy.ScreenEncoder.createCodec(ScreenEncoder.java:176)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:74)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:65)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
        at com.genymobile.scrcpy.Server.main(Server.java:255)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:351)
ERROR: "adb reverse --remove" returned with value 1
ERROR: Could not retrieve device information

D:\scrcpy\scrcpy-win64-v1.20>

for 2.5

D:\scrcpy\scrcpy-win64-v2.5>scrcpy.exe --tcpip=192.168.89.145
scrcpy 2.5 <https://github.com/Genymobile/scrcpy>
INFO: Connecting to 192.168.89.145:5555...
INFO: Connected to 192.168.89.145:5555
D:\scrcpy\scrcpy-win64-v2.5\scrcpy-server: 1 file pushed, 0 skipped. 92.5 MB/s (69624 bytes in 0.001s)
[server] INFO: Device: [Skyworth] Skyworth 1AA03_BC20 (Android 9)
[server] WARN: Audio disabled: it is not supported before Android 11
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
        at android.media.MediaCodec.getCurProcessName(MediaCodec.java:3885)
        at android.media.MediaCodec.setSkyMediaStatus(MediaCodec.java:3898)
        at android.media.MediaCodec.<init>(MediaCodec.java:1810)
        at android.media.MediaCodec.createEncoderByType(MediaCodec.java:1787)
        at com.genymobile.scrcpy.SurfaceEncoder.createMediaCodec(SurfaceEncoder.java:208)
        at com.genymobile.scrcpy.SurfaceEncoder.streamCapture(SurfaceEncoder.java:53)
        at com.genymobile.scrcpy.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-SurfaceEncoder(SurfaceEncoder.java:257)
        at com.genymobile.scrcpy.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
        at java.lang.Thread.run(Thread.java:764)
ERROR: "adb reverse --remove" returned with value 1
ERROR: Could not retrieve device information
ERROR: Server connection failed

@rom1v
Copy link
Collaborator

rom1v commented Jul 8, 2024

Between 1.19 and 1.20, this is probably due to this commit 8df42ce.

Let's try with this quick&dirty change:

diff --git a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
index 448e7099f..db0d72789 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
@@ -74,6 +74,9 @@ public final class Workarounds {
             mustFillAppContext = true;
         }
 
+        mustFillAppInfo = true;
+        mustFillAppContext = true;
+
         if (audio && Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
             // Before Android 11, audio is not supported.
             // Since Android 12, we can properly set a context on the AudioRecord.

Replace this file in your v2.5 release:

  • scrcpy-server SHA-256: 55926d71d45aef83d989bf0fcd25801f8886307efe933eb8d4200807890080a

@HinsCoder
Copy link

Replace this file in your v2.5 release:

  • scrcpy-server SHA-256: 55926d71d45aef83d989bf0fcd25801f8886307efe933eb8d4200807890080a

This is an effective modification, thank you very much!

image

@rom1v
Copy link
Collaborator

rom1v commented Jul 8, 2024

Oh great!

Could you then test this new one and confirm that it works:

  • scrcpy-server SHA-256: 7cb3bc939c91e23788ed3f2801f71b9cc8f258e85bed7b60fc98ece9721bbe1

Here is the diff:

diff --git a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
index 448e7099f..3f86f892b 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
@@ -63,7 +63,7 @@ public final class Workarounds {
             //  - <https://github.com/Genymobile/scrcpy/issues/940>
             //  - <https://github.com/Genymobile/scrcpy/issues/994>
             mustFillAppInfo = true;
-        } else if (Build.BRAND.equalsIgnoreCase("honor")) {
+        } else if (Build.BRAND.equalsIgnoreCase("honor") || Build.BRAND.equalsIgnoreCase("skyworth")) {
             // More workarounds must be applied for Honor devices:
             //  - <https://github.com/Genymobile/scrcpy/issues/4015>
             //

@HinsCoder
Copy link

Could you then test this new one and confirm that it works:

  • scrcpy-server SHA-256: 7cb3bc939c91e23788ed3f2801f71b9cc8f258e85bed7b60fc98ece9721bbe1

Oh no, the NullPointerException error has occurred again.

C:\Users\Hins\Downloads\scrcpy-win64-v2.5>scrcpy
scrcpy 2.5 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     --> (tcpip)  192.168.31.22:5555              device  7T872_P60P
C:\Users\Hins\Downloads\scrcpy-win64-v2.5\scrcpy-server: 1...ile pushed, 0 skipped. 111.2 MB/s (164344 bytes in 0.001s)
[server] INFO: Device: [skyworth] Coocaa 7T872_P60P (Android 10)
[server] WARN: Audio disabled: it is not supported before Android 11
INFO: Renderer: direct3d
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Texture: 1920x1080
ERROR: Controller error
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
        at android.media.MediaCodec.getCurProcessName(MediaCodec.java:1913)
        at android.media.MediaCodec.setSkyMediaStatus(MediaCodec.java:1927)
        at android.media.MediaCodec.release(MediaCodec.java:1949)
        at com.genymobile.scrcpy.SurfaceEncoder.streamCapture(SurfaceEncoder.java:95)
        at com.genymobile.scrcpy.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-SurfaceEncoder(SurfaceEncoder.java:257)
        at com.genymobile.scrcpy.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
        at java.lang.Thread.run(Thread.java:919)

@rom1v
Copy link
Collaborator

rom1v commented Jul 8, 2024

Device: [skyworth] Coocaa 7T872_P60P (Android 10)

Oh in your case, the manufacturer is still skyworth, but the brand is Coocaa. Let's test the manufacturer instead:

diff --git a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
index 999f6a714..c9a26d787 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
@@ -63,7 +63,7 @@ public final class Workarounds {
             //  - <https://github.com/Genymobile/scrcpy/issues/940>
             //  - <https://github.com/Genymobile/scrcpy/issues/994>
             mustFillAppInfo = true;
-        } else if (Build.BRAND.equalsIgnoreCase("honor") || Build.BRAND.equalsIgnoreCase("skyworth")) {
+        } else if (Build.BRAND.equalsIgnoreCase("honor") || Build.MANUFACTURER.equalsIgnoreCase("skyworth")) {
             // More workarounds must be applied for Honor devices:
             //  - <https://github.com/Genymobile/scrcpy/issues/4015>
             // and Skyworth devices:
  • scrcpy-server SHA-256: 7753a5d077bb8b4c808adedaee4c129ba37f52cfa8bb6d7ea707330d4a7d068

@HinsCoder
Copy link

Oh in your case, the manufacturer is still skyworth, but the brand is Coocaa. Let's test the manufacturer instead:

Congratulate, it works successful again.

@rom1v
Copy link
Collaborator

rom1v commented Jul 8, 2024

👍

Merged into dev: b50f9eb 🚀

@rom1v rom1v closed this as completed in b50f9eb Aug 1, 2024
FreedomBen pushed a commit to FreedomBen/scrcpy that referenced this issue Aug 2, 2024
The vendor-modified ROM of Skyworth devices needs a valid app
info/context.

Fixes Genymobile#4922 <Genymobile#4922>
Gottox pushed a commit to Gottox/scrcpy that referenced this issue Sep 29, 2024
The vendor-modified ROM of Skyworth devices needs a valid app
info/context.

Fixes Genymobile#4922 <Genymobile#4922>
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

5 participants