google / google/ExoPlayer

Video playback freezes and then fails with Unexpected runtime error ERROR_CODE_FAILED_RUNTIME_CHECK

Open
#10,598 9 comments 0 reactions 1 assignee Claimed by @icbaker View on GitHub
bug: device specific
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

### 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:

1. Start the playback, and check that the selected track is the one with the highest quality.
2. 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 dev.exoplayer@gmail.com after filing this issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.