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

Illegal Argumennt Exception? #2993

Closed
TheRealJimboBob opened this issue Feb 1, 2022 · 15 comments
Closed

Illegal Argumennt Exception? #2993

TheRealJimboBob opened this issue Feb 1, 2022 · 15 comments

Comments

@TheRealJimboBob
Copy link

scrcpy 1.22 https://github.com/Genymobile/scrcpy
C:\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 84.4 MB/s (40955 bytes in 0.000s)
[server] INFO: Device: OnePlus DE2118 (Android 11)
INFO: Renderer: direct3d
INFO: Initial texture: 1080x2400
WARN: Device disconnected
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalArgumentException
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:2128)
at android.media.MediaCodec.configure(MediaCodec.java:2044)
at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:274)
at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:94)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:73)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:100)
at com.genymobile.scrcpy.Server.main(Server.java:326)dn
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:438)
WARN: Killing the server...

Windows 11
Android Version 11
Phone: 1+

@rom1v
Copy link
Collaborator

rom1v commented Feb 1, 2022

Please try #2990.

@scresante
Copy link

scresante commented Feb 18, 2022

Hello.
I have tried building the server from source from the dev branch (and ran into an interesting error with "Unsupported class file major version 61" but fixed that by using jdk11-openjdk on archlinux and compiled the server successfully).
I also tried using the pre-built server mentioned in #2990 .
I still get a similar error to the one above. It is slightly different, here is my error output:

scrcpy 1.22 https://github.com/Genymobile/scrcpy
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 151.1 MB/s (96899 bytes in 0.001s)
[server] INFO: Device: motorola moto g stylus 5G (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 21.3.6
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2400
WARN: Device disconnected
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalArgumentException
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:2127)
at android.media.MediaCodec.configure(MediaCodec.java:2043)
at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:278)
at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:96)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:73)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:100)
at com.genymobile.scrcpy.Server.main(Server.java:326)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)

@scresante
Copy link

The workaround mentioned in #3033
scrcpy -m1920
Works for me.

@rom1v
Copy link
Collaborator

rom1v commented Feb 19, 2022

Then #2990 should work.

/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 151.1 MB/s (96899 bytes in 0.001s)

It didn't use the one you built. How did you build and run?

@scresante
Copy link

scresante commented Feb 20, 2022

It didn't uqe the one you built. How did you build and run?

Are you asking me?

sudo archlinux-java set java-11-openjdk
yay -G scrcpy-git
cd scrcpy-git
makepkg --nobuild
cd src/scrcpy
git checkout dev
meson x --buildtype=release --strip -Db_lto=true
ninja -Cx
cp x/server/scrcpy-server ../../scrcpy-server-v1.22
cd ../../
makepkg --noextract --install

And then run scrcpy -m1920

@rom1v
Copy link
Collaborator

rom1v commented Feb 20, 2022

git checkout dev

On which commit SHA1 are you after that?

I don't really know how arch packages work, but the fact that it does not retry with a lower definition suggests that you don't have the change from #2990.

@rom1v
Copy link
Collaborator

rom1v commented Feb 20, 2022

Could you please test the following commands:

git clone https://github.com/Genymobile/scrcpy
cd scrcpy
git checkout dev
meson d -Db_sanitize=address
ninja -Cd
./run d

@scresante
Copy link

On which commit SHA1 are you after that?

That was from c4ab65e

Could you please test the following commands:

Done. Still the same error with latest dev 36c75e1

* daemon not running; starting now at tcp:5037
* daemon started successfully
DEBUG: ADB device found:
DEBUG:     -->   (usb)  ***                      device  moto_g_stylus_5G
DEBUG: Device serial: ***
DEBUG: Using SCRCPY_SERVER_PATH: d/server/scrcpy-server
d/server/scrcpy-server: 1 file pushed, 0 skipped. 437.5 MB/s (60911 bytes in 0.000s)
[server] INFO: Device: motorola moto g stylus 5G (Android 11)
DEBUG: Server connected
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 21.3.6
INFO: Trilinear filtering enabled
DEBUG: Using SCRCPY_ICON_PATH: data/icon.png
ERROR: Could not open image codec: data/icon.png
WARN: Could not load icon
INFO: Initial texture: 1080x2400
DEBUG: Starting demuxer thread
[server] DEBUG: Using encoder: 'c2.qti.avc.encoder'
DEBUG: Receiver stopped
[server] DEBUG: Device message sender stopped
[server] DEBUG: Controller stopped
DEBUG: End of frames
WARN: Device disconnected
DEBUG: quit...
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalArgumentException
        at android.media.MediaCodec.native_configure(Native Method)
        at android.media.MediaCodec.configure(MediaCodec.java:2127)
        at android.media.MediaCodec.configure(MediaCodec.java:2043)
        at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:282)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:97)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:74)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:102)
        at com.genymobile.scrcpy.Server.main(Server.java:332)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
DEBUG: Server disconnected
DEBUG: Server terminated

./run d -m1920 works fine

@rom1v
Copy link
Collaborator

rom1v commented Feb 20, 2022

What was your meson command (exactly what I provided)?

(or post the result of meson configure d)

@scresante
Copy link

scresante commented Feb 20, 2022

meson.configure.txt

Yes I ran the meson command as you had it.

@rom1v
Copy link
Collaborator

rom1v commented Feb 20, 2022

Thanks!

java.lang.IllegalArgumentException

Oh ok, it's not IllegalStateException. I will catch this one for retry too, thank you.

rom1v added a commit that referenced this issue Feb 20, 2022
MediaCodec.configure() may throw an IllegalArgumentException if it does
not support the requested size. Also retry on this exception.

Fixes #2993 <#2993>
Refs #2947 <#2947>
Refs #2990 <#2990>
rom1v added a commit that referenced this issue Feb 20, 2022
MediaCodec.configure() may throw an IllegalArgumentException if it does
not support the requested size. Also retry on this exception.

Fixes #2993 <#2993>
Refs #2947 <#2947>
Refs #2990 <#2990>
PR #3043 <#3043>
@rom1v
Copy link
Collaborator

rom1v commented Feb 20, 2022

Please test #3043.

@scresante
Copy link

Please test #3043.

Yes, I can confirm that the new change in the illegalargumentexception branch fixes this error by automatically retrying at a smaller video size.

rom1v added a commit that referenced this issue Feb 22, 2022
MediaCodec.configure() may throw an IllegalArgumentException if it does
not support the requested size. Also retry on this exception.

Fixes #2993 <#2993>
Refs #2947 <#2947>
Refs #2990 <#2990>
PR #3043 <#3043>
@rom1v
Copy link
Collaborator

rom1v commented Feb 22, 2022

Thank you, merged 👍

@rom1v rom1v closed this as completed Feb 22, 2022
@rom1v
Copy link
Collaborator

rom1v commented Jan 27, 2023

Please test this version to make sure that it does not break this bugfix: #3693 (comment)

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