google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.7k stars 6.02k forks source link

IllegalStateException when releasing DefaultDrmSession #10449

Closed jeronimomunoz closed 2 years ago

jeronimomunoz commented 2 years ago

ExoPlayer Version

2.14.2

Devices that reproduce the issue

The incidence is low and no device specific, affecting Android tablets and phones from Android 7 to Android 12

Exoplayer version is 2.14.2

Same issue as reported here: https://github.com/google/ExoPlayer/issues/9392

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

The issue was detected on Firebase Crashlitics. We haven't been able to reproduce it locally.

Here the code snippet about how we are initializing the DrmSessionManager:

`val drmSessionManager = DefaultDrmSessionManager.Builder() .setUuidAndExoMediaDrmProvider(uuid, FrameworkMediaDrm.DEFAULT_PROVIDER) .setMultiSession(true) .build(drmCallback)

val mediaItem = MediaItem.Builder().setUri(uri) .setDrmUuid(getDrmUuid(playerAsset.drm)) .setDrmLicenseUri(playerAsset.licenseServerUrl) .setDrmLicenseRequestHeaders(playerAsset.licenseHeaders) .setDrmMultiSession(true) .setMediaMetadata(MediaMetadata.EMPTY) .build()

val mediaSource = DashMediaSource.Factory(DefaultDashChunkSource.Factory(mediaDataSourceFactory), manifestDataSourceFactory) .setDrmSessionManagerProvider { drmSessionManager!! } .createMediaSource(mediaItem)`

Expected result

The media plays successfully

Actual result

Playback crashes with the following exception:

Fatal Exception: java.lang.IllegalStateException at com.google.android.exoplayer2.util.Assertions.checkState(Assertions.java:84) at com.google.android.exoplayer2.drm.DefaultDrmSession.release(DefaultDrmSession.java:308) at com.google.android.exoplayer2.drm.DefaultDrmSessionManager$PreacquiredSessionReference.lambda$release$1(DefaultDrmSessionManager.java:1015) at com.google.android.exoplayer2.drm.DefaultDrmSessionManager$PreacquiredSessionReference.$r8$lambda$nYc-XCZkgUmlTVMJKF9VQKrj-NU(DefaultDrmSessionManager.java) at com.google.android.exoplayer2.drm.DefaultDrmSessionManager$PreacquiredSessionReference$$InternalSyntheticLambda$0$3ae6579bab0ebd2a7fb1a32274d2a1aee68b5a4633b436a29b1cd20fa8de20d0$0.run(DefaultDrmSessionManager.java:2) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.os.HandlerThread.run(HandlerThread.java:65)

Media

We use Dash with Widevine encryption.

Bug Report

icbaker commented 2 years ago

As you've noted, this is a duplicate of https://github.com/google/ExoPlayer/issues/9392. If you upgrade to 2.16.0 or cherrypick https://github.com/google/ExoPlayer/commit/bcaadf434f9824433135e6ba693670a482a2d098 into a local checkout of the library then these exceptions will be dowgraded to a warning log.

I'm closing this as a duplicate because we don't have plans to investigate this further.

jeronimomunoz commented 2 years ago

Thanks for the information @icbaker