media icon indicating copy to clipboard operation
media copied to clipboard

MediaSession IllegalArgumentException on PlayerInfoChangedHandler.handleMessage

Open tiagoalmeida92 opened this issue 1 year ago • 2 comments

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

  • [x] You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

tiagoalmeida92 avatar Jun 12 '24 08:06 tiagoalmeida92

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?

microkatz avatar Jun 14 '24 13:06 microkatz

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

tiagoalmeida92 avatar Jun 18 '24 14:06 tiagoalmeida92

@tiagoalmeida92

Sorry for the delay. Are you still hitting this issue with your content?

It may help us if you can provide example media, an example dash manifest of your content. If you're unable to share test content publicly, please send them to [email protected] with the subject Issue #1447. Please also update this issue to indicate you've done this.

I looked through the dumpstate that you sent but it does not appear to contain any logs with the presented issue? Would you be able to send a bug report specifically or reproduce the issue with the demo application? Reproducing with the demo applications in the project would be the most helpful.

microkatz avatar Jan 16 '25 16:01 microkatz

@microkatz I'm not able to provide more logs right now as the issue only happens in certain conditions. We could see stack traces on firebase crashlytics, and we decided to disable the media session to avoid the crash. We will try to add more logging on crashlytics, including the manifest. Like you said, it's probably a manifest that contains adaptation sets with duplicate IDs.

tiagoalmeida92 avatar Jan 20 '25 07:01 tiagoalmeida92