Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exoplayer infinite buffer state

I'm trying to use the exoplayer for my React Native app using the React Native video package.

I have an app with both a HLS stream and a mp4 videos, these videos and are stored on my server (https).

When browsing through videos the player gets stuck in an infinite buffer state and stays that way until I restart the app. This is completely random. The only way to reproduce the problem is just watching videos and switch the source multiple times.

When looking in the Android logcat there are no errors. adb bugreport doesn't work either.

05-22 10:51:07.884 22911-22911/eu.domain.app I/EXO PLAYER: isBuffering - true
05-22 10:51:08.180 22911-25217/eu.domain.app I/ACodec:  [] Now uninitialized
05-22 10:51:08.181 22911-25221/eu.domain.app I/ACodec: [] onAllocateComponent
05-22 10:51:08.184 22911-25221/eu.domain.app I/OMXClient: MuxOMX ctor
05-22 10:51:08.210 22911-25221/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Loaded
05-22 10:51:08.214 22911-25220/eu.domain.app I/MediaCodec: [OMX.Exynos.avc.dec] setting surface generation to 23460870
05-22 10:51:08.217 22911-25221/eu.domain.app I/ACodec: can't find wfdsink-exynos-enable
05-22 10:51:08.226 22911-25221/eu.domain.app I/ACodec: codec does not support config priority (err -1010)
05-22 10:51:08.235 22911-25221/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Loaded->Idle
05-22 10:51:08.268 22911-25221/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] configureOutputBuffersFromNativeWindow setBufferCount : 8, minUndequeuedBuffers : 4
05-22 10:51:08.285 22911-25217/eu.domain.app I/ACodec:  [] Now uninitialized
05-22 10:51:08.286 22911-25224/eu.domain.app I/ACodec: [] onAllocateComponent
05-22 10:51:08.299 22911-25221/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Idle->Executing
05-22 10:51:08.303 22911-25224/eu.domain.app I/OMXClient: MuxOMX ctor
05-22 10:51:08.304 22911-25221/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Executing
05-22 10:51:08.323 22911-25224/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Loaded
05-22 10:51:08.329 22911-25221/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now handling output port settings change
05-22 10:51:08.335 22911-25224/eu.domain.app I/ACodec: codec does not support config priority (err -2147483648)
05-22 10:51:08.337 22911-25221/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] configureOutputBuffersFromNativeWindow setBufferCount : 15, minUndequeuedBuffers : 4
05-22 10:51:08.337 22911-25224/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Loaded->Idle
05-22 10:51:08.347 22911-25221/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Executing
05-22 10:51:08.349 22911-25224/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Idle->Executing
05-22 10:51:08.350 22911-25224/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Executing
05-22 10:51:08.361 22911-25224/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now handling output port settings change
05-22 10:51:08.398 22911-25224/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Executing
05-22 10:51:08.454 22911-25217/eu.domain.app I/AudioTrack: This process already got info. FadeIn[0] FadeOut[0] FadeInRing[0]
05-22 10:51:08.485 22911-22911/eu.domain.app I/EXO PLAYER: isBuffering - false
05-22 10:51:11.898 22911-22922/eu.domain.app I/art: Background sticky concurrent mark sweep GC freed 41338(3MB) AllocSpace objects, 16(388KB) LOS objects, 5% free, 63MB/67MB, paused 4.005ms total 110.586ms
05-22 10:51:13.124 22911-22922/eu.domain.app I/art: Background partial concurrent mark sweep GC freed 15341(1151KB) AllocSpace objects, 2(32KB) LOS objects, 19% free, 65MB/81MB, paused 3.007ms total 105.323ms
05-22 10:51:13.670 22911-22915/eu.domain.app I/art: Do partial code cache collection, code=251KB, data=235KB
05-22 10:51:13.673 22911-22915/eu.domain.app I/art: After code cache collection, code=248KB, data=233KB
    Increasing code cache capacity to 1024KB
05-22 10:51:14.023 22911-23396/eu.domain.app W/ReactNativeJS: Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https://github.com/facebook/react-native/issues/12981 for more info.
    (Saw setTimeout with duration 1800000ms)
05-22 10:51:17.806 22911-25220/eu.domain.app I/MediaCodec: [OMX.Exynos.avc.dec] setting surface generation to 23460871
05-22 10:51:17.828 22911-22911/eu.domain.app I/ExoPlayerImpl: Release 2282d90 [ExoPlayerLib/2.8.0] [j5y17lte, SM-J530F, samsung, 24] [goog.exo.core, goog.exo.hls, goog.exo.okhttp]
05-22 10:51:17.829 22911-25221/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Executing->Idle
05-22 10:51:17.852 22911-25221/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Idle->Loaded
    [OMX.Exynos.avc.dec] Now Loaded
     [OMX.Exynos.avc.dec] Now kWhatShutdownCompleted event : 8585
05-22 10:51:17.853 22911-25220/eu.domain.app I/MediaCodec: Codec shutdown complete
05-22 10:51:17.857 22911-25221/eu.domain.app I/ACodec:  [OMX.Exynos.avc.dec] Now uninitialized
     [] Now kWhatShutdownCompleted event : 8585
05-22 10:51:17.858 22911-25220/eu.domain.app I/MediaCodec: Codec shutdown complete
05-22 10:51:17.866 22911-25224/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Executing->Idle
05-22 10:51:17.873 22911-25224/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Idle->Loaded
    [OMX.google.aac.decoder] Now Loaded
     [OMX.google.aac.decoder] Now kWhatShutdownCompleted event : 8585
05-22 10:51:17.873 22911-25224/eu.domain.app I/MediaCodec: Codec shutdown complete
05-22 10:51:17.878 22911-25224/eu.domain.app I/ACodec:  [OMX.google.aac.decoder] Now uninitialized
     [] Now kWhatShutdownCompleted event : 8585
05-22 10:51:17.878 22911-25224/eu.domain.app I/MediaCodec: Codec shutdown complete
05-22 10:51:17.959 22911-22922/eu.domain.app I/art: Background partial concurrent mark sweep GC freed 10383(476KB) AllocSpace objects, 0(0B) LOS objects, 16% free, 82MB/98MB, paused 9.123ms total 301.557ms
05-22 10:51:19.265 22911-22911/eu.domain.app I/ExoPlayerImpl: Init 3448cf0 [ExoPlayerLib/2.8.0] [j5y17lte, SM-J530F, samsung, 24]
05-22 10:51:19.272 22911-22911/eu.domain.app I/EXO PLAYER: isBuffering - true
05-22 10:51:19.288 22911-22911/eu.domain.app I/EXO PLAYER: isBuffering - true
05-22 10:51:19.410 22911-25298/eu.domain.app I/ACodec:  [] Now uninitialized
05-22 10:51:19.420 22911-25301/eu.domain.app I/ACodec: [] onAllocateComponent
05-22 10:51:19.423 22911-25301/eu.domain.app I/OMXClient: MuxOMX ctor
05-22 10:51:19.449 22911-25301/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Loaded
05-22 10:51:19.458 22911-25300/eu.domain.app I/MediaCodec: [OMX.Exynos.avc.dec] setting surface generation to 23460872
05-22 10:51:19.460 22911-25301/eu.domain.app I/ACodec: can't find wfdsink-exynos-enable
05-22 10:51:19.464 22911-25301/eu.domain.app I/ACodec: codec does not support config priority (err -1010)
05-22 10:51:19.471 22911-25301/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Loaded->Idle
05-22 10:51:19.478 22911-25301/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] configureOutputBuffersFromNativeWindow setBufferCount : 9, minUndequeuedBuffers : 5
05-22 10:51:19.496 22911-25298/eu.domain.app I/ACodec:  [] Now uninitialized
05-22 10:51:19.499 22911-25305/eu.domain.app I/ACodec: [] onAllocateComponent
05-22 10:51:19.501 22911-25305/eu.domain.app I/OMXClient: MuxOMX ctor
05-22 10:51:19.508 22911-25301/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Idle->Executing
05-22 10:51:19.510 22911-25305/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Loaded
05-22 10:51:19.510 22911-25301/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Executing
05-22 10:51:19.534 22911-25301/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now handling output port settings change
05-22 10:51:19.540 22911-25301/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] configureOutputBuffersFromNativeWindow setBufferCount : 16, minUndequeuedBuffers : 5
05-22 10:51:19.541 22911-25305/eu.domain.app I/ACodec: codec does not support config priority (err -2147483648)
05-22 10:51:19.543 22911-25305/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Loaded->Idle
05-22 10:51:19.550 22911-25305/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Idle->Executing
05-22 10:51:19.553 22911-25305/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Executing
05-22 10:51:19.554 22911-25301/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Executing
05-22 10:51:19.561 22911-25305/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now handling output port settings change
05-22 10:51:19.572 22911-25305/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Executing
05-22 10:51:19.599 22911-25298/eu.domain.app I/AudioTrack: This process already got info. FadeIn[0] FadeOut[0] FadeInRing[0]
05-22 10:51:19.606 22911-22911/eu.domain.app I/EXO PLAYER: isBuffering - false
05-22 10:51:19.634 22911-25300/eu.domain.app I/MediaCodec: [OMX.Exynos.avc.dec] setting surface generation to 23460873
05-22 10:51:24.107 22911-23396/eu.domain.app W/ReactNativeJS: Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https://github.com/facebook/react-native/issues/12981 for more info.
    (Saw setTimeout with duration 1800000ms)
05-22 10:51:26.949 22911-25300/eu.domain.app I/MediaCodec: [OMX.Exynos.avc.dec] setting surface generation to 23460874
05-22 10:51:26.967 22911-22911/eu.domain.app I/ExoPlayerImpl: Release 3448cf0 [ExoPlayerLib/2.8.0] [j5y17lte, SM-J530F, samsung, 24] [goog.exo.core, goog.exo.hls, goog.exo.okhttp]
05-22 10:51:26.974 22911-25301/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Executing->Idle
05-22 10:51:26.989 22911-25301/eu.domain.app I/ACodec: [OMX.Exynos.avc.dec] Now Idle->Loaded
    [OMX.Exynos.avc.dec] Now Loaded
     [OMX.Exynos.avc.dec] Now kWhatShutdownCompleted event : 8585
05-22 10:51:26.991 22911-25300/eu.domain.app I/MediaCodec: Codec shutdown complete
05-22 10:51:26.993 22911-25301/eu.domain.app I/ACodec:  [OMX.Exynos.avc.dec] Now uninitialized
05-22 10:51:26.994 22911-25301/eu.domain.app I/ACodec:  [] Now kWhatShutdownCompleted event : 8585
05-22 10:51:26.995 22911-25300/eu.domain.app I/MediaCodec: Codec shutdown complete
05-22 10:51:27.000 22911-25305/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Executing->Idle
05-22 10:51:27.010 22911-25305/eu.domain.app I/ACodec: [OMX.google.aac.decoder] Now Idle->Loaded
    [OMX.google.aac.decoder] Now Loaded
     [OMX.google.aac.decoder] Now kWhatShutdownCompleted event : 8585
05-22 10:51:27.010 22911-25305/eu.domain.app I/MediaCodec: Codec shutdown complete
05-22 10:51:27.013 22911-25305/eu.domain.app I/ACodec:  [OMX.google.aac.decoder] Now uninitialized
     [] Now kWhatShutdownCompleted event : 8585
05-22 10:51:27.013 22911-25305/eu.domain.app I/MediaCodec: Codec shutdown complete
05-22 10:51:27.926 22911-22911/eu.domain.app I/ExoPlayerImpl: Init c209446 [ExoPlayerLib/2.8.0] [j5y17lte, SM-J530F, samsung, 24]
05-22 10:51:27.933 22911-22911/eu.domain.app I/EXO PLAYER: isBuffering - true
05-22 10:51:27.953 22911-22911/eu.domain.app I/EXO PLAYER: isBuffering - true

Note: I did an update to exoplayer 2.8.0, the package is using 2.4.0. But it isn't working on both versions.

Is someone familiar with this issue?

like image 415
Nieck Avatar asked May 22 '18 13:05

Nieck


3 Answers

In such a scenario it is advisable to release the player resources and re-prepare the player config. with the last watched duration. The Exo player will give you an error handle(event) that should be used to trigger the player release.

For releasing the resources you have to use the method:

ExoPlayer.release 
like image 124
Glenford Fernandes Avatar answered Sep 20 '22 22:09

Glenford Fernandes


Provide proper buffer size and make sure you are releasing Exo player in a proper way also use on player error(ExoPlaybackException error) method and put logs on there or send data to the firebase analytics. Sometimes it's hard to find the real cause of exoplayer getting stuck. It can be source error too or rendering error. I also got this kind of issue and sometimes it's not recoverable (2 %).In those cases I have informed the user that something went wrong please try again.

like image 37
Richa Shah Avatar answered Sep 22 '22 22:09

Richa Shah


If you are using postroll ads you should update ExoPlayer to 2.11.0 (2019-12-11). As you can read in release note for that version:

HLS:
Fix issue where streams could get stuck in an infinite buffering state after a `postroll` ad (#6314).

There is also useful info in link to that issue.

That's actually another bug in our dev branch that needs fixing unrelated to what's reported here. The bug reported in this issue is HLS-specific and happens because we wait for stream information after the `postroll` which never arrives as the stream already finished loading.
like image 26
jakub-adamczewski Avatar answered Sep 18 '22 22:09

jakub-adamczewski