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

ConcurrentModificationException in SlidingPercentile #612

Closed
1 task
ojoNetgem opened this issue Aug 25, 2023 · 2 comments
Closed
1 task

ConcurrentModificationException in SlidingPercentile #612

ojoNetgem opened this issue Aug 25, 2023 · 2 comments
Assignees
Labels

Comments

@ojoNetgem
Copy link

Version

Media3 1.1.1

More version details

No response

Devices that reproduce the issue

AndroidTV box

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

Looking for the different methods to compute bandwidth, I'm using in this case the ExperimentalBandwidthMeter without any changes in Builder.

val bandwidthMeter = ExperimentalBandwidthMeter.Builder(context)
    .build()
val player = Exoplayer.Builder(context)
    .setBandwidthMeter(bandwidthMeter)
    .build()

Expected result

No crash

Actual result

Sometimes the app crashes with this call stack:

androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
	at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:668)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.util.ConcurrentModificationException
	at java.util.ArrayList.sort(ArrayList.java:1472)
	at java.util.Collections.sort(Collections.java:206)
	at androidx.media3.exoplayer.upstream.SlidingPercentile.ensureSortedByValue(SlidingPercentile.java:147)
	at androidx.media3.exoplayer.upstream.SlidingPercentile.getPercentile(SlidingPercentile.java:122)
	at androidx.media3.exoplayer.upstream.experimental.PercentileTimeToFirstByteEstimator.getTimeToFirstByteEstimateUs(PercentileTimeToFirstByteEstimator.java:92)
	at androidx.media3.exoplayer.upstream.experimental.ExperimentalBandwidthMeter.getTimeToFirstByteEstimateUs(ExperimentalBandwidthMeter.java:322)
	at androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection.getTotalAllocatableBandwidth(AdaptiveTrackSelection.java:693)
	at androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection.getAllocatedBandwidth(AdaptiveTrackSelection.java:671)
	at androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection.determineIdealSelectedIndex(AdaptiveTrackSelection.java:600)
	at androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection.evaluateQueueSize(AdaptiveTrackSelection.java:524)
	at androidx.media3.exoplayer.source.MergingMediaPeriod$ForwardingTrackSelection.evaluateQueueSize(MergingMediaPeriod.java:589)
	at androidx.media3.exoplayer.dash.DefaultDashChunkSource.getPreferredQueueSize(DefaultDashChunkSource.java:304)
	at androidx.media3.exoplayer.source.chunk.ChunkSampleStream.reevaluateBuffer(ChunkSampleStream.java:666)
	at androidx.media3.exoplayer.source.CompositeSequenceableLoader.reevaluateBuffer(CompositeSequenceableLoader.java:60)
	at androidx.media3.exoplayer.dash.DashMediaPeriod.reevaluateBuffer(DashMediaPeriod.java:315)
	at androidx.media3.exoplayer.source.CompositeSequenceableLoader.reevaluateBuffer(CompositeSequenceableLoader.java:60)
	at androidx.media3.exoplayer.source.MergingMediaPeriod.reevaluateBuffer(MergingMediaPeriod.java:192)
	at androidx.media3.exoplayer.source.MaskingMediaPeriod.reevaluateBuffer(MaskingMediaPeriod.java:223)
	at androidx.media3.exoplayer.MediaPeriodHolder.reevaluateBuffer(MediaPeriodHolder.java:211)
	at androidx.media3.exoplayer.MediaPeriodQueue.reevaluateBuffer(MediaPeriodQueue.java:140)
	at androidx.media3.exoplayer.ExoPlayerImplInternal.handleContinueLoadingRequested(ExoPlayerImplInternal.java:2354)
	at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:544)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.os.HandlerThread.run(HandlerThread.java:67)

Media

Any dash stream should retroduce the issue

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 Sep 4, 2023

Thanks for reporting! It looks like we are missing a synchronization block in this code - we'll update the class to fix this.

@ojoNetgem
Copy link
Author

Good news, thanks

copybara-service bot pushed a commit that referenced this issue Sep 8, 2023
copybara-service bot pushed a commit to google/ExoPlayer that referenced this issue Sep 8, 2023
microkatz pushed a commit to v-novaltd/androidx-media that referenced this issue Sep 21, 2023
microkatz pushed a commit to hugohlln/media that referenced this issue Sep 29, 2023
@tonihei tonihei closed this as completed Feb 5, 2024
@androidx androidx locked and limited conversation to collaborators Apr 6, 2024
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