Skip to content

IndexOutOfBoundsException during playback #6776

@kkovach

Description

@kkovach

[REQUIRED] Issue description

I get the following exception and crash while playing audio.

Fatal Exception: java.lang.IndexOutOfBoundsException
       at com.google.android.exoplayer2.util.Assertions.checkIndex(Assertions.java:68)
       at com.google.android.exoplayer2.source.SinglePeriodTimeline.getWindow(SinglePeriodTimeline.java:175)
       at com.google.android.exoplayer2.source.MaskingMediaSource$MaskingTimeline.getWindow(MaskingMediaSource.java:266)
       at com.google.android.exoplayer2.source.AbstractConcatenatedTimeline.getWindow(AbstractConcatenatedTimeline.java:199)
       at com.google.android.exoplayer2.Timeline.getWindow(Timeline.java:668)
       at com.google.android.exoplayer2.analytics.AnalyticsCollector.generateEventTime(AnalyticsCollector.java:612)
       at com.google.android.exoplayer2.analytics.AnalyticsCollector.generateEventTime(AnalyticsCollector.java:636)
       at com.google.android.exoplayer2.analytics.AnalyticsCollector.generateMediaPeriodEventTime(AnalyticsCollector.java:662)
       at com.google.android.exoplayer2.analytics.AnalyticsCollector.onMediaPeriodCreated(AnalyticsCollector.java:318)
       at com.google.android.exoplayer2.source.MediaSourceEventListener$EventDispatcher.lambda$mediaPeriodCreated$0$MediaSourceEventListener$EventDispatcher(MediaSourceEventListener.java:371)
       at com.google.android.exoplayer2.source.-$$Lambda$MediaSourceEventListener$EventDispatcher$N-EOPAK5UK0--YMNjezq7UM3UNI.run(:6)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:214)
       at android.os.HandlerThread.run(HandlerThread.java:67)

[REQUIRED] Reproduction steps

I cannot reliably reproduce this issue, but I suspect that it might be caused by multiple calls to ConcatenatingMediaSource.addMediaSouce() Rough application flow is as follows...

  • Add single MediaSource to a ConcatenatingMediaSource
  • Prepare player with that ConcatenatingMediaSource
  • Once the timeline has changed set speed and playWhenReady to true
  • Add multiple (variable number of) additional MediaSources to the ConcatenatingMediaSource

[REQUIRED] Link to test content

Do not have any of this right now.

[REQUIRED] A full bug report captured from the device

Will do if necessary.

[REQUIRED] Version of ExoPlayer being used

2.11.0

[REQUIRED] Device(s) and version(s) of Android being used

Pixel 3 - Android 10

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions