Repository navigation
Cmcd.Factory causes exception upon track change #888
Description
Version
Media3 1.2.0
More version details
Following the release of androidx.media3 v1.2.0 we tried to enable the CMCD with the default configuration via MediaSource.Factory#setCmcdConfigurationFactory(CmcdConfiguration.Factory.DEFAULT). While it seems to work during regular playback, a crash occurs once a different track (e.g. Audio track) is selected via the UI. Following the stacktrace:
Playback error
androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:685 undefined)
at android.os.Handler.dispatchMessage(Handler.java:102 undefined)
at android.os.Looper.loopOnce(Looper.java:201 undefined)
at android.os.Looper.loop(Looper.java:288 undefined)
at android.os.HandlerThread.run(HandlerThread.java:67 undefined)
Caused by: java.lang.IllegalArgumentException
at androidx.media3.common.util.Assertions.checkArgument(Assertions.java:40 undefined)
at androidx.media3.exoplayer.upstream.CmcdData$Factory.<init>(CmcdData.java:135 undefined)
at androidx.media3.exoplayer.dash.DefaultDashChunkSource.getNextChunk(DefaultDashChunkSource.java:418 undefined)
at androidx.media3.exoplayer.source.chunk.ChunkSampleStream.continueLoading(ChunkSampleStream.java:580 undefined)
at androidx.media3.exoplayer.source.CompositeSequenceableLoader.continueLoading(CompositeSequenceableLoader.java:81 undefined)
at androidx.media3.exoplayer.dash.DashMediaPeriod.continueLoading(DashMediaPeriod.java:324 undefined)
at androidx.media3.exoplayer.source.MaskingMediaPeriod.continueLoading(MaskingMediaPeriod.java:229 undefined)
at androidx.media3.exoplayer.MediaPeriodHolder.continueLoading(MediaPeriodHolder.java:234 undefined)
at androidx.media3.exoplayer.ExoPlayerImplInternal.maybeContinueLoading(ExoPlayerImplInternal.java:2477 undefined)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleContinueLoadingRequested(ExoPlayerImplInternal.java:2438 undefined)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:551 undefined)
at android.os.Handler.dispatchMessage(Handler.java:102 undefined)
at android.os.Looper.loopOnce(Looper.java:201 undefined)
at android.os.Looper.loop(Looper.java:288 undefined)
at android.os.HandlerThread.run(HandlerThread.java:67 undefined)
The reason for this seems to be a negative bufferedDurationUs that is passed to the CmcdData.Factory and I assume the reason for this crash cannot be fixed by the client.
Other than that: The issue can be reproduced with the demo app once CMCD is enabled. Version 1.1.x does have the same issue.
Devices that reproduce the issue
Reproducable on all physical devices and emulators I tested it on
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
Pre-requisite: Set CMCD configuration during setup of MediaSourceFactory, e.g. add the following line
.setCmcdConfigurationFactory(CmcdConfiguration.Factory.DEFAULT)
to the end of the setup within PlayerActivity#createMediaSourceFactory.
- Open demo app
- Open Widevine DASH (MP4, H264) dropdown
- Select HD (cbcs)
- Click on "SELECT TRACKS"
- Select 320 x 142, 0.77 Mbps tracks
- Observe player
Expected result
Playback continues/starts with selected track
Actual result
"Playback failed" is displayed. Clicking on "Play" button starts/resumes playback with selected track
Media
https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.
Activity
Fix sending negative `bufferedDurationUs` to `CmcdData.Factory`
rohitjoins commentedon Dec 15, 2023
Thanks for reporting the issue. A fix was submitted to the
mainbranch.Fix sending negative `bufferedDurationUs` to `CmcdData.Factory`
Fix sending negative `bufferedDurationUs` to `CmcdData.Factory`
akhilesh-dubey commentedon Jan 16, 2024
@rohitjoins Thank you for addressing the issue. When can we expect the availability of this fix in the upcoming release?
rohitjoins commentedon Jan 16, 2024
@akhilesh-dubey, we are doing a bug-fix release this week which will also include the fix for this issue.
rohitjoins commentedon Jan 17, 2024
The fix is in the release branch.