[Issue]: Decoder setup fails with "surface has been released" for all non-16:9 stream resolutions (Pixel 8 Pro / GrapheneOS)
Describe the bug
On my Pixel 8 Pro, the video decoder fails to initialize for any stream resolution that isn't 16:9. All five decoder configuration attempts throw IllegalArgumentException at MediaCodec.configure(). Moonlight then aborts before sending the video ping, and the host logs "Initial Ping Timeout".
16:9 resolutions always work (720p, 1080p, 1440p). Everything else fails, including 1920x1008 which has fewer pixels than the working 1440p. So it doesn't look like a pixel count or decoder level limit.
Same behaviour with the Artemis fork, so it's probably not specific to this build.
Steps to reproduce
- Set the host to a non-16:9 resolution (I used a virtual display on Linux via xorg.conf ConnectedMonitor, but the host resolution doesn't seem to matter since Moonlight requests the stream size).
- In Moonlight, pick a non-16:9 resolution. On the Pixel 8 Pro the built-in options "Native (2131x1008)", "Native Full-Screen (2244x1008)" and "Native Full-Screen (2992x1344)" all reproduce it.
- Start any app.
- Moonlight shows "Connection terminated". Host reports Initial Ping Timeout.
Results I got:
| Resolution | Aspect | Result |
|-------------|--------|--------|
| 1280x720 | 16:9 | works |
| 1920x1080 | 16:9 | works |
| 2560x1440 | 16:9 | works |
| 1920x1008 | 1.90:1 | fails |
| 2130x1008 | 2.11:1 | fails |
| 2244x1008 | 2.23:1 | fails |
| 2992x1344 | 2.23:1 | fails |Fails with both HEVC and AVC.
Affected games
All. Tested with Desktop and Steam Big Picture, same result.
Other Moonlight clients
PC
Moonlight adjusted settings
Yes
Moonlight adjusted settings (please complete the following information)
Resolution respectively
Moonlight default settings
No
Gamepad-related connection issue
No
Gamepad-related input issue
No
Gamepad-related streaming issue
No
Android version
Android 17 (GrapheneOS)
Device model
Google Pixel 8 Pro
Server PC OS version
Linux Mint 22.3 (X11, Cinnamon), kernel 6.14.0-37
Server PC GeForce Experience version
N/A, host is Sunshine 2026.516.143833
Server PC Nvidia GPU driver version
595.84 (RTX 3080 Ti)
Server PC antivirus and firewall software
None, ufw inactive
Screenshots
No response
Relevant log output
I/com.limelight.LimeLog: Decoder configuration try: 0
I/com.limelight.LimeLog: Configuring with format: {max-height=1008, color-transfer=3, max-width=2244, low-latency=1, mime=video/hevc, width=2244, color-range=2, frame-rate=60, color-standard=1, height=1008}
W/System.err: java.lang.IllegalArgumentException: The surface has been released
W/System.err: at android.media.MediaCodec.native_configure(Native Method)
W/System.err: at android.media.MediaCodec.configure(MediaCodec.java:2555)
W/System.err: at android.media.MediaCodec.configure(MediaCodec.java:2415)
W/System.err: at com.limelight.binding.video.MediaCodecDecoderRenderer.configureAndStartDecoder(SourceFile:165)
W/System.err: at com.limelight.binding.video.MediaCodecDecoderRenderer.tryConfigureDecoder(SourceFile:11)
W/System.err: at com.limelight.binding.video.MediaCodecDecoderRenderer.initializeDecoder(SourceFile:292)
W/System.err: at com.limelight.binding.video.MediaCodecDecoderRenderer.setup(SourceFile:9)
W/System.err: at com.limelight.nvstream.jni.MoonBridge.bridgeDrSetup(SourceFile:4)
W/System.err: at com.limelight.nvstream.jni.MoonBridge.startConnection(Native Method)
I/moonlight-common-c: Video stream start failed: -5
Same exception for configuration tries 1 through 4.Additional context
Things I ruled out:
- Screen rotation (locked to landscape) and "Don't keep activities" (off)
- Full-screen vs notch-safe resolution variants, both fail
- Memory tagging (GrapheneOS shows it as default disabled for this app)
- Codec, both AVC and HEVC fail
- Network. A tcpdump on the host shows control (47999) and audio (48000) UDP flowing in both directions. Only the video ping on 47998 never arrives, which fits the client aborting before it sends one.
- Decoder capability limits. /vendor/etc/media_codecs_aosp_c2.xml declares c2.exynos.hevc.decoder with size max 7680x4320, alignment 2x2, block-size 16x16, and no block-aspect-ratio limit.
Worth noting: a Galaxy Tab S7 FE on the same host streams fine at its native 2560x1600, which is also not 16:9. So this looks specific to the Pixel 8 Pro rather than a general problem with odd aspect ratios.
The exception message mentions the surface, but MediaCodec.configure() also throws IllegalArgumentException for unacceptable formats, so the message may be misleading. One guess is the setFixedSize() call before decoder setup: if the target size doesn't match the current surface buffer geometry, the surface gets recreated asynchronously while the decoder thread still holds the old reference. That would explain why 16:9 sizes are fine on a device whose panel is 2992x1344.
Host is Sunshine on Linux with a virtual display (xorg.conf ConnectedMonitor plus CustomEDID), mentioning it in case it matters, though the failure is clearly on the client side.
Source: moonlight-stream/moonlight-android