androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.73k stars 414 forks source link

MediaSession IllegalArgumentException on PlayerInfoChangedHandler.handleMessage #1447

Open tiagoalmeida92 opened 5 months ago

tiagoalmeida92 commented 5 months ago

Version

Media3 1.1.1 / ExoPlayer 2.19.1

More version details

No response

Devices that reproduce the issue

Across all devices 65% Samsung all models 26% Amazon all models

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

Happening on Live streams only, VOD is fine The crash happens after 15-30mins, possibly when there's Server side ad replacement

Expected result

No Crash should happen

Actual result

Fatal Exception: java.lang.IllegalArgumentException: Multiple entries with same key: a5.r0@49ed724c=g-3:emsg and a5.r0@49ed724c=f-3:emsg at com.google.common.collect.ImmutableMap$Builder$DuplicateKey.exception(ImmutableMap.java:661) at com.google.common.collect.RegularImmutableMap.createHashTableOrThrow(RegularImmutableMap.java:290) at com.google.common.collect.RegularImmutableBiMap.(RegularImmutableBiMap.java:58) at com.google.common.collect.ImmutableBiMap$Builder.buildOrThrow(ImmutableBiMap.java:458) at androidx.media3.session.MediaSessionStub.generateAndCacheUniqueTrackGroupIds(MediaSessionStub.java:1804) at androidx.media3.session.MediaSessionImpl.dispatchOnPlayerInfoChanged(MediaSessionImpl.java:363) at androidx.media3.session.MediaSessionImpl.access$600(MediaSessionImpl.java:87) at androidx.media3.session.MediaSessionImpl$PlayerInfoChangedHandler.handleMessage(MediaSessionImpl.java:1376) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7785) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)

Media

Can provide further details if needed

Bug Report

microkatz commented 5 months ago

Hello @tiagoalmeida92,

In digging into this issue, the duplicate key exception is a result of that the DASH mpd file for your content containing Adaptation Sets with duplicate ids within the same period. Are you in control of the content you are streaming? Any way that you can address this issue?

tiagoalmeida92 commented 5 months ago

Hi @microkatz thanks for your response!

It could be that we're getting some rogue data from the stream. We should be able to address it. It's a bit odd that exoplayer can handle the duplicated ids, but MediaSession isn't though