Skip to content

Cmcd.Factory causes exception upon track change #888

Closed

Description

@mikef-dk

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.

  1. Open demo app
  2. Open Widevine DASH (MP4, H264) dropdown
  3. Select HD (cbcs)
  4. Click on "SELECT TRACKS"
  5. Select 320 x 142, 0.77 Mbps tracks
  6. 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

Activity

  1. rohitjoins commented on Dec 15, 2023

    @rohitjoins
    Contributor

    Thanks for reporting the issue. A fix was submitted to the main branch.

  2. akhilesh-dubey commented on Jan 16, 2024

    @akhilesh-dubey

    @rohitjoins Thank you for addressing the issue. When can we expect the availability of this fix in the upcoming release?

  3. rohitjoins commented on Jan 16, 2024

    @rohitjoins
    Contributor

    @akhilesh-dubey, we are doing a bug-fix release this week which will also include the fix for this issue.

  4. rohitjoins commented on Jan 17, 2024

    @rohitjoins
    Contributor

    The fix is in the release branch.

  5. locked and limited conversation to collaborators on Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions