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

IllegalArgumentException in QueueTimeline#create() (trying to use duplicated keys in ImmutableMap) #290

Closed
1 task
h6ah4i opened this issue Apr 1, 2023 · 1 comment
Assignees

Comments

@h6ah4i
Copy link
Contributor

h6ah4i commented Apr 1, 2023

Media3 Version

Media3 1.0.0

Devices that reproduce the issue

  • Galaxy S22 running Android 13
  • Galaxy A20 running Android 11
  • Realme C21-Y running Android 11
  • Nokia 7 Plus running Android 10
  • Galaxy Note8 running Android 9

Devices that do not reproduce the issue

I think this issue is not device/OS version specific.

Reproducible in the demo app?

Not tested

Reproduction steps

Sorry, I haven't reproduced this issue myself.

  • My app (Music Visualizer) controls another music app(s) via MediaContoller of media3.
  • All affected users are using the "Snoop" mode of the app (in order to control and visualize the sound of other music apps).
  • At least, I did not see the same issue with the previous version of the app that is using media3 v1.0.0-beta03. All crash reports are only for media3 v1.0.0.

Expected result

No app crashing occurs inside the QueueTimeline#create() method.

Actual result

These are example stack traces reported on Crashlytics:

NOTE-1: I am using a slightly modified version of media3 v1.0.0 which is added some debug logging code. Line numbers are not identical to the original v1.0.0.

NOTE-2: I am using a newer version of the guava library (v31.1-android)

Galaxy S21 FE 5G + Android 13 + com.google.android.apps.youtube.music

Fatal Exception: java.lang.IllegalArgumentException
Multiple entries with same key: l4.g0@dc9ec702=47 and l4.g0@dc9ec702=45

com.google.common.collect.ImmutableMap$Builder$DuplicateKey.exception (ImmutableMap.java:661)
com.google.common.collect.ImmutableMap$Builder.build (ImmutableMap.java:549)
com.google.common.collect.ImmutableMap$Builder.buildOrThrow (ImmutableMap.java:579)
androidx.media3.session.QueueTimeline.create (QueueTimeline.java:83)
androidx.media3.session.MediaControllerImplLegacy.buildNewControllerInfo (MediaControllerImplLegacy.java:1808)
androidx.media3.session.MediaControllerImplLegacy.handleNewLegacyParameters (MediaControllerImplLegacy.java:1414)
androidx.media3.session.MediaControllerImplLegacy.access$500 (MediaControllerImplLegacy.java:88)
androidx.media3.session.MediaControllerImplLegacy$ControllerCompatCallback.lambda$new$0 (MediaControllerImplLegacy.java:1656)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loopOnce (Looper.java:226)
android.os.Looper.loop (Looper.java:313)
android.app.ActivityThread.main (ActivityThread.java:8757)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)

Model:Galaxy A20 + Android 11 + com.spotify.music

Fatal Exception: java.lang.IllegalArgumentException
Multiple entries with same key: l4.g0@d45098c7=19 and l4.g0@d45098c7=18

com.google.common.collect.ImmutableMap$Builder$DuplicateKey.exception (ImmutableMap.java:661)
com.google.common.collect.ImmutableMap$Builder.build (ImmutableMap.java:549)
com.google.common.collect.ImmutableMap$Builder.buildOrThrow (ImmutableMap.java:579)
androidx.media3.session.QueueTimeline.create (QueueTimeline.java:83)
androidx.media3.session.MediaControllerImplLegacy.buildNewControllerInfo (MediaControllerImplLegacy.java:1808)
androidx.media3.session.MediaControllerImplLegacy.handleNewLegacyParameters (MediaControllerImplLegacy.java:1414)
androidx.media3.session.MediaControllerImplLegacy.access$500 (MediaControllerImplLegacy.java:88)
androidx.media3.session.MediaControllerImplLegacy$ControllerCompatCallback.lambda$new$0 (MediaControllerImplLegacy.java:1656)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:246)
android.app.ActivityThread.main (ActivityThread.java:8645)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)

Media

Not applicable

Bug Report

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
@tonihei
Copy link
Collaborator

tonihei commented Apr 4, 2023

Thanks for reporting! This was an oversight in 5528baa#diff-ba094129e4f511377f6aacdb942221d210c4d784ed4d1673b769a76d39404b25 I believe and caused by having multiple MediaItem instances in the playlist that are equal to each other. We'll look into how to fix this!

@tonihei tonihei self-assigned this Apr 4, 2023
marcbaechinger pushed a commit that referenced this issue Apr 5, 2023
MediaItems are not meant to be unique in a playlist. If a legacy
session publishes multiple items that get converted to equal MediaItems,
the current code fails because we look up queue ids in a Map (that
doesn't allow duplicate entries).

Fix this by storing a simple list of items with additional data.

#minor-release

Issue: #290
PiperOrigin-RevId: 521993802
@tonihei tonihei closed this as completed Apr 11, 2023
rohitjoins pushed a commit that referenced this issue Apr 18, 2023
MediaItems are not meant to be unique in a playlist. If a legacy
session publishes multiple items that get converted to equal MediaItems,
the current code fails because we look up queue ids in a Map (that
doesn't allow duplicate entries).

Fix this by storing a simple list of items with additional data.

Issue: #290
PiperOrigin-RevId: 521993802
(cherry picked from commit 219967c)
@androidx androidx locked and limited conversation to collaborators Jun 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants