-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Before filing an issue:
- [✔] Search existing issues, including issues that are closed.
- [✔] Consult our FAQs, supported devices and supported formats pages. These can be
found at https://google.github.io/ExoPlayer/. - [✔] Rule out issues in your own code. A good way to do this is to try and
reproduce the issue in the ExoPlayer demo app. - [✔] This issue tracker is intended for bugs, feature requests and ExoPlayer
specific questions. If you're asking a general Android development question,
please do so on Stack Overflow.
When reporting a bug:
Issue description
We are manipulating a playlist of local MP4 files through ConcatenatingMediaSource. When we perform a particular sequence of actions on the list, we incur systematically into an IndexOutOfBoundsException when SinglePeriodTimeline.getPeriod checks index.
We've a sample project showing the issue. To the purpose of explanation, consider tracks named as C, D, E, F, G. Every action waits for enough time to let the previous one completed.
The sequence of actions is:
- Add initial track (C).
- Once completed, Tracklist is: [ C ]
- C starts playing.
- Tracklist is: [ _C_ ]
- When C is playing, add second batch of tracks (D, E, F).
- Once completed, Tracklist is: [ _C_ | D | E | F ]
- While C is still playing, move F to become the next coming track (instead of D).
- Once completed, Tracklist is: [ _C_ | F | D | E ]
- F starts playing.
- Tracklist is: [ C | _F_ | D | E ]
- When F starts playing, remove the other tracks. First C, then D, then E. Each one waiting for completion of previous one
- Once completed, Tracklist is: [ _F_ ]
- Add third batch of tracks (only G).
- Here exception is thrown, when traying to add media sources to playlist
There are other cases when another assertion fails, when we create a loop source after some playlist manipulation, but those are out of the current scope and we're not able yet to reproduce it systematically.
Reproduction steps
Build and run (on emulator or device) the project that will be sent by email. A few seconds after video F starts playing, app will crash with following:
09-26 13:09:36.235 9716-9716/com.braincrumbz.fatalgetperiod D/MainActivity: adding third batch...
Tracklist is: [ _F_ ]
09-26 13:09:36.238 9716-9716/com.braincrumbz.fatalgetperiod D/AndroidRuntime: Shutting down VM
--------- beginning of crash
09-26 13:09:36.238 9716-9716/com.braincrumbz.fatalgetperiod E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.braincrumbz.fatalgetperiod, PID: 9716
java.lang.IndexOutOfBoundsException
at com.google.android.exoplayer2.util.Assertions.checkIndex(Assertions.java:68)
at com.google.android.exoplayer2.source.SinglePeriodTimeline.getPeriod(SinglePeriodTimeline.java:186)
at com.google.android.exoplayer2.source.ConcatenatingMediaSource$DeferredTimeline.getPeriod(ConcatenatingMediaSource.java:841)
at com.google.android.exoplayer2.source.AbstractConcatenatedTimeline.getPeriod(AbstractConcatenatedTimeline.java:176)
at com.google.android.exoplayer2.analytics.AnalyticsCollector$MediaPeriodQueueTracker.updateMediaPeriodToNewTimeline(AnalyticsCollector.java:778)
at com.google.android.exoplayer2.analytics.AnalyticsCollector$MediaPeriodQueueTracker.onTimelineChanged(AnalyticsCollector.java:724)
at com.google.android.exoplayer2.analytics.AnalyticsCollector.onTimelineChanged(AnalyticsCollector.java:424)
at com.google.android.exoplayer2.ExoPlayerImpl$PlaybackInfoUpdate.notifyListeners(ExoPlayerImpl.java:746)
at com.google.android.exoplayer2.ExoPlayerImpl.updatePlaybackInfo(ExoPlayerImpl.java:681)
at com.google.android.exoplayer2.ExoPlayerImpl.handlePlaybackInfo(ExoPlayerImpl.java:622)
at com.google.android.exoplayer2.ExoPlayerImpl.handleEvent(ExoPlayerImpl.java:567)
at com.google.android.exoplayer2.ExoPlayerImpl$1.handleMessage(ExoPlayerImpl.java:109)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
09-26 13:09:38.752 9716-9806/com.braincrumbz.fatalgetperiod W/SoftwareRenderer: Surface::dequeueBuffer returned error -19
We tried several constructors signatures for ConcatenatingMediaSource (atomic or not, different ShuffleOrder) with no luck.
Link to test content
Please wait for link by email.
Version of ExoPlayer being used
'com.google.android.exoplayer:exoplayer-core:2.8.2'
'com.google.android.exoplayer:exoplayer-dash:2.8.2'
'com.google.android.exoplayer:exoplayer-ui:2.8.2'
Device(s) and version(s) of Android being used
Emulator, both Nexus 5 API 25 and Nexus 5X API 28.
A full bug report captured from the device
See bugreport-NYC-2018-09-26-13-19-45.zip here attached. There's also a logcat, just in case.
bugreport-NYC-2018-09-26-13-19-45.zip
logcat-2018-09-26-13-19-45.txt
Question is: are we doing something wrong? How to avoid this? Thanks!