ExoPlayer
ExoPlayer copied to clipboard
Video playback freezes and then fails with Unexpected runtime error ERROR_CODE_FAILED_RUNTIME_CHECK
ExoPlayer Version
2.18.1
Devices that reproduce the issue
Android TV SDMC 905x2 Android 10
Reproducible in the demo app?
Yes
Reproduction steps
To reproduce the issue i needed to make sure the the playback started with the highest quality track. To do it in the demo app i changed to change the TrackSelectionFactory bandwidthFraction value to 1f by adding this lines on the PlaybackActivity:279:
AdaptiveTrackSelection.Factory adaptiveTrackSelectionFactory =
new AdaptiveTrackSelection.Factory
(DEFAULT_MIN_DURATION_FOR_QUALITY_INCREASE_MS,
DEFAULT_MAX_DURATION_FOR_QUALITY_DECREASE_MS,
DEFAULT_MIN_DURATION_TO_RETAIN_AFTER_DISCARD_MS,
1f);
ExoPlayer.Builder playerBuilder =
new ExoPlayer.Builder(/* context= */ this)
.setTrackSelector(new DefaultTrackSelector(this, adaptiveTrackSelectionFactory))
.setMediaSourceFactory(createMediaSourceFactory());
The steps are:
- Start the playback, and check that the selected track is the one with the highest quality.
- Limit the network bandwidth (i used proxyman to do this) so the exoplayer selects a lower quality track.
Expected result
The player changes to a lower quality track, but the playback continues normally.
Actual result
The player selects an lower quality track, the audio continues to play, but the video freezes, and after some time (normally 6/8 minutes) the playback stops with this errors:
2022-09-08 11:12:14.718 12817-12913/com.google.android.exoplayer2.demo W/DefaultLoadControl: Target buffer size reached with less than 500ms of buffered media data.
2022-09-08 11:12:15.147 12817-12913/com.google.android.exoplayer2.demo I/chatty: uid=10095(com.google.android.exoplayer2.demo) ExoPlayer:Playb identical 42 lines
2022-09-08 11:12:15.158 12817-12913/com.google.android.exoplayer2.demo W/DefaultLoadControl: Target buffer size reached with less than 500ms of buffered media data.
2022-09-08 11:12:15.165 12817-12913/com.google.android.exoplayer2.demo E/ExoPlayerImplInternal: Playback error
com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:616)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.IllegalStateException: Playback stuck buffering and not loading
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1070)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:490)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:67)
2022-09-08 11:12:15.207 12817-12817/com.google.android.exoplayer2.demo D/EventLogger: videoDisabled [eventTime=527.49, mediaPos=10769.76, window=0, period=0]
2022-09-08 11:12:15.209 12817-12929/com.google.android.exoplayer2.demo W/Codec2Client: query -- param skipped: index = 1342179345.
2022-09-08 11:12:15.209 12817-12929/com.google.android.exoplayer2.demo W/Codec2Client: query -- param skipped: index = 2415921170.
2022-09-08 11:12:15.209 12817-12929/com.google.android.exoplayer2.demo W/Codec2Client: query -- param skipped: index = 1610614798.
2022-09-08 11:12:15.212 12817-12817/com.google.android.exoplayer2.demo D/EventLogger: audioDisabled [eventTime=527.50, mediaPos=10769.76, window=0, period=0]
2022-09-08 11:12:15.234 12817-12923/com.google.android.exoplayer2.demo D/SurfaceUtils: disconnecting from surface 0xbcae3008, reason disconnectFromSurface
2022-09-08 11:12:15.243 12817-12817/com.google.android.exoplayer2.demo D/EventLogger: videoDecoderReleased [eventTime=527.53, mediaPos=10769.76, window=0, period=0, OMX.amlogic.hevc.decoder.awesome2]
2022-09-08 11:12:15.247 12817-12913/com.google.android.exoplayer2.demo D/BufferPoolAccessor: bufferpool2 0xd805da10 : 0(0 size) total buffers - 0(0 size) used buffers - 1/7 (recycle/alloc) - 6/12236 (fetch/transfer)
2022-09-08 11:12:15.248 12817-12817/com.google.android.exoplayer2.demo D/EventLogger: audioDecoderReleased [eventTime=527.53, mediaPos=10769.76, window=0, period=0, c2.android.aac.decoder]
2022-09-08 11:12:15.258 12817-12817/com.google.android.exoplayer2.demo E/EventLogger: playerFailed [eventTime=527.54, mediaPos=10769.76, window=0, period=0, errorCode=ERROR_CODE_FAILED_RUNTIME_CHECK
com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:616)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.IllegalStateException: Playback stuck buffering and not loading
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1070)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:490)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:67)
]
If the playback starts with an lower quality video track (any of the other two), and then switchs to 1080p track, and back to an lower quality track, the problem doesn't happen.
Media
I'll send you a test stream by email.
Bug Report
- [X] You will email the zip file produced by
adb bugreport
to [email protected] after filing this issue.
The media link provided over email returns a 403 for me when I try and fetch it with curl.
The media link provided over email returns a 403 for me when I try and fetch it with curl.
@icbaker it's because of the $ in the url, if you replace it with %24, or use single quotes instead of double quotes it will work Sorry for not warned you about it.
Hey @jrocharodrigues. We need more information to resolve this issue but there hasn't been an update in 14 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
The media link provided over email returns a 403 for me when I try and fetch it with curl. @icbaker it's because of the $ in the url, if you replace it with %24, or use single quotes instead of double quotes it will work Sorry for not warned you about it.
If you need more help please ask.
The provided URL still returns 403 when I manually switch the $
with %24
. Please provide a working repro URL (ideally one I don't need to manually adjust before using it :)).
Hi, Sorry the old one expired. I've sent a new one by email.
The new media link resolves.
I introduced the described track selections using RandomTrackSelection.Factory
by adding the setTrackSelector
line below in PlayerActivity.initializePlayer
:
ExoPlayer.Builder playerBuilder =
new ExoPlayer.Builder(/* context= */ this)
.setMediaSourceFactory(createMediaSourceFactory())
.setTrackSelector(new DefaultTrackSelector(this, new RandomTrackSelection.Factory()));
I started the sample a few times until it started on the 1920x1080 track, then I waited for it to switch resolution. I didn't see any video hang or playback errors. I was doing this on a Pixel 5 running Android 13. Are you able to reproduce this issue on other devices beyond the one reported above (e.g. a Pixel or other phone)?
@icbaker so far i could only reproduce the issue on that device. If i'm able to reproduce it in another device i'll let you now. Thank you