google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

BehindLiveWindowException in HlsChunkSource.getChunkOperation #1607

Closed fujunwei closed 8 years ago

fujunwei commented 8 years ago

You can reproduce this issue with loading below url. http://dlhls.cdn.zhanqi.tv/zqlive/36596_HD3eX_700/index.m3u8?Dnion_vsnae=36596_HD3eX

The detail error messages are:

06-20 16:02:23.401 23825-24659/org.example.xwalkembedded E/ExoPlayerImplInternal: Internal track renderer error. com.google.android.exoplayer.ExoPlaybackException: com.google.android.exoplayer.BehindLiveWindowException at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:263) at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:145) at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:441) at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:213) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:136) at android.os.HandlerThread.run(HandlerThread.java:61) at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40) Caused by: com.google.android.exoplayer.BehindLiveWindowException at com.google.android.exoplayer.hls.HlsChunkSource.getChunkOperation(HlsChunkSource.java:461) at com.google.android.exoplayer.hls.HlsSampleSource.maybeStartLoading(HlsSampleSource.java:712) at com.google.android.exoplayer.hls.HlsSampleSource.continueBuffering(HlsSampleSource.java:264) at com.google.android.exoplayer.SampleSourceTrackRenderer.doSomeWork(SampleSourceTrackRenderer.java:127) at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:434) at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:213)  at android.os.Handler.dispatchMessage(Handler.java:98)  at android.os.Looper.loop(Looper.java:136)  at android.os.HandlerThread.run(HandlerThread.java:61)  at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40) 

fujunwei commented 8 years ago

Do you reproduce it? It's a key issue for us to publish application, could you please help me to investigate ?

AquilesCanta commented 8 years ago

Will look into it now, sorry for the delay.

AquilesCanta commented 8 years ago

Unfortunately, I will not be able to help you, there are a few issues. The first and most important, is that the live window is too small (less than 10 seconds most of the time) with only 3 segments[1] forming the playlist. At the slightest buffering, you will always end up falling behind. The second issue that I found is that the playlist refreshing is taking up to 4 seconds, sometimes. This means that if you were playing the "most recent" segment of the playlist (optimistic assumption) and you refresh to get the next segment, due to [1], you will end up playing the oldest segment of the new playlist, after that, you are one delay away from falling behind, if you didn't during the playlist refresh. The first approach and likely the only solution would be to increase the live window to a 30 seconds period, if it is within your reach. Good luck!