Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trackselection Playback error on onResume #9718

Closed
ponthamaya opened this issue Nov 23, 2021 · 1 comment
Closed

Trackselection Playback error on onResume #9718

ponthamaya opened this issue Nov 23, 2021 · 1 comment
Assignees
Labels

Comments

@ponthamaya
Copy link

ponthamaya commented Nov 23, 2021

  • ExoPlayer 2.16.1 Demo project
  • Android 10
  • Android OnePlus 6T

I got the error when I minimized the app and resumed back.

Reproduce:
Change the audio track from StyledPlayerView control settings below the Playspeed. you will get the playback error when you minimize the app and resume back.

> 2021-11-23 11:43:40.411 5723-6639/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:612)
>         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.ArrayIndexOutOfBoundsException: length=2; index=-1
>         at com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource.<init>(DefaultSsChunkSource.java:107)
>         at com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource$Factory.createChunkSource(DefaultSsChunkSource.java:72)
>         at com.google.android.exoplayer2.source.smoothstreaming.SsMediaPeriod.buildSampleStream(SsMediaPeriod.java:239)
>         at com.google.android.exoplayer2.source.smoothstreaming.SsMediaPeriod.selectTracks(SsMediaPeriod.java:145)
>         at com.google.android.exoplayer2.source.MaskingMediaPeriod.selectTracks(MaskingMediaPeriod.java:186)
>         at com.google.android.exoplayer2.MediaPeriodHolder.applyTrackSelection(MediaPeriodHolder.java:296)
>         at com.google.android.exoplayer2.MediaPeriodHolder.applyTrackSelection(MediaPeriodHolder.java:259)
>         at com.google.android.exoplayer2.MediaPeriodHolder.handlePrepared(MediaPeriodHolder.java:193)
>         at com.google.android.exoplayer2.ExoPlayerImplInternal.handlePeriodPrepared(ExoPlayerImplInternal.java:2209)
>         at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:505)
>         at android.os.Handler.dispatchMessage(Handler.java:103) 
>         at android.os.Looper.loop(Looper.java:214) 
>         at android.os.HandlerThread.run(HandlerThread.java:67) 
> 2021-11-23 11:43:40.431 5723-5723/com.google.android.exoplayer2.demo E/EventLogger: playerFailed [eventTime=0.41, mediaPos=5.27, window=0, period=0, errorCode=ERROR_CODE_UNSPECIFIED
>       com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
>         at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:612)
>         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.ArrayIndexOutOfBoundsException: length=2; index=-1
>         at com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource.<init>(DefaultSsChunkSource.java:107)
>         at com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource$Factory.createChunkSource(DefaultSsChunkSource.java:72)
>         at com.google.android.exoplayer2.source.smoothstreaming.SsMediaPeriod.buildSampleStream(SsMediaPeriod.java:239)
>         at com.google.android.exoplayer2.source.smoothstreaming.SsMediaPeriod.selectTracks(SsMediaPeriod.java:145)
>         at com.google.android.exoplayer2.source.MaskingMediaPeriod.selectTracks(MaskingMediaPeriod.java:186)
>         at com.google.android.exoplayer2.MediaPeriodHolder.applyTrackSelection(MediaPeriodHolder.java:296)
>         at com.google.android.exoplayer2.MediaPeriodHolder.applyTrackSelection(MediaPeriodHolder.java:259)
>         at com.google.android.exoplayer2.MediaPeriodHolder.handlePrepared(MediaPeriodHolder.java:193)
>         at com.google.android.exoplayer2.ExoPlayerImplInternal.handlePeriodPrepared(ExoPlayerImplInternal.java:2209)
>         at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:505)
>         at android.os.Handler.dispatchMessage(Handler.java:103) 
>         at android.os.Looper.loop(Looper.java:214) 
>         at android.os.HandlerThread.run(HandlerThread.java:67) 
>     ]
>   
@tonihei
Copy link
Collaborator

tonihei commented Nov 23, 2021

Thanks for reporting, I can reproduce this problem.

@tonihei tonihei self-assigned this Nov 23, 2021
@ponthamaya ponthamaya changed the title Playback error on onResume Trackselection Playback error on onResume Dec 1, 2021
tonihei added a commit to androidx/media that referenced this issue Dec 2, 2021
This allows to give TrackGroups an identifier. The underlying goal is
to provide a way to make otherwise identical TrackGroups
distinguishable.

Also set this id in all internal sources that may produce identical
TrackGroups in certain edge cases.

Issue: google/ExoPlayer#9718
PiperOrigin-RevId: 413430719
tonihei added a commit to androidx/media that referenced this issue Dec 2, 2021
Allowing duplicate groups caused some other code working with the
array to use reference equality comparison. This is error-prone,
easily forgotten (e.g. when using the TrackGroups in a map) and
causes bugs when TrackGroups are serialized to disk or to another
process.

All TrackGroups created by ExoPlayer are already unique and custom
code creating TrackGroupArrays with identical groups can easily
distringuish them by adding an id to each group.

Issue: google/ExoPlayer#9718
PiperOrigin-RevId: 413617005
tonihei added a commit that referenced this issue Dec 2, 2021
This allows to give TrackGroups an identifier. The underlying goal is
to provide a way to make otherwise identical TrackGroups
distinguishable.

Also set this id in all internal sources that may produce identical
TrackGroups in certain edge cases.

Issue: #9718
PiperOrigin-RevId: 413430719
tonihei added a commit that referenced this issue Dec 2, 2021
Allowing duplicate groups caused some other code working with the
array to use reference equality comparison. This is error-prone,
easily forgotten (e.g. when using the TrackGroups in a map) and
causes bugs when TrackGroups are serialized to disk or to another
process.

All TrackGroups created by ExoPlayer are already unique and custom
code creating TrackGroupArrays with identical groups can easily
distringuish them by adding an id to each group.

Issue: #9718
PiperOrigin-RevId: 413617005
@tonihei tonihei closed this as completed Dec 9, 2021
@google google locked and limited conversation to collaborators Feb 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants