question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Decoder init failed` error when transitioning from DRM protected content to clear content in a playlist

See original GitHub issue

Description:

The following exception occurs when transitioning from a DRM protected media item to a clear media item in a playlist:

2021-06-22 07:55:07.634 28518-28518/com.google.android.exoplayer2.demo E/EventLogger: playerFailed [eventTime=8.62, mediaPos=0.00, window=1, period=1
      com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(4, null, null, video/avc, avc1.64002A, 18316946, null, [1920, 856, 24.0], [-1, -1]), format_supported=YES
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:555)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:245)
        at android.os.HandlerThread.run(HandlerThread.java:67)
     Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.qcom.video.decoder.avc, Format(4, null, null, video/avc, avc1.64002A, 18316946, null, [1920, 856, 24.0], [-1, -1])
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1051)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:606)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.reinitializeCodec(MediaCodecRenderer.java:2158)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainAndReinitializeCodec(MediaCodecRenderer.java:1818)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1480)
        at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:713)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:998)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:830)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:945)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:478)
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:245) 
        at android.os.HandlerThread.run(HandlerThread.java:67) 
     Caused by: java.lang.IllegalArgumentException
        at android.media.MediaCodec.native_configure(Native Method)
        at android.media.MediaCodec.configure(MediaCodec.java:2128)
        at android.media.MediaCodec.configure(MediaCodec.java:2044)
        at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter$Factory.createAdapter(SynchronousMediaCodecAdapter.java:50)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:1137)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1044)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:606) 
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.reinitializeCodec(MediaCodecRenderer.java:2158) 
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainAndReinitializeCodec(MediaCodecRenderer.java:1818) 
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1480) 
        at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:713) 
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:998) 
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:830) 
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:945) 
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:478) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:245) 
        at android.os.HandlerThread.run(HandlerThread.java:67) 
    ]

This can only be observed on specific devices. I reliably reproduced it on a OnePlus AC2003 with Android 11 but customers of us reported it also on Samsung S10 with Android 11.

Please find the adb bugreport attached.

Steps to reproduce:

In the demo app define one DRM protected source and one clear source in a play list, e.g. as follows:

 List<MediaItem> mediaItems = new ArrayList<>();
      MediaItem.Builder builderProtectedItem =
              new MediaItem.Builder()
                      .setUri("https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd")
                      .setMimeType(MimeTypes.APPLICATION_MPD)
                      .setMediaMetadata(new MediaMetadata.Builder().setTitle("DRM protected").build())
              .setDrmUuid(C.WIDEVINE_UUID)
              .setDrmLicenseUri("https://proxy.uat.widevine.com/proxy?provider=widevine_test");

      mediaItems.add(builderProtectedItem.build());

      MediaItem.Builder builderClearItem =
              new MediaItem.Builder()
                      .setUri("https://storage.googleapis.com/wvmedia/clear/h264/tears/tears.mpd")
                      .setMimeType(MimeTypes.APPLICATION_MPD)
                      .setMediaMetadata(new MediaMetadata.Builder().setTitle("Clear Sample").build());

      mediaItems.add(builderClearItem.build());

After starting playback of the first source, transitioning to the next source causes the described issue.

Versions

  • ExoPlayer version number: 2.12.0, b2333c86c1
  • Android version: Android 11
  • Android device: OnePlus AC2003

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
icbakercommented, Jun 22, 2021

Edit: It does work when I configure both sources as DRM protected. Maybe that was the missing piece.

Ah yeah, that’s also a slightly sharp edge of the API: https://github.com/google/ExoPlayer/issues/8957

0reactions
strangesourcecommented, Jun 22, 2021

I did see that release note but I don’t think this helps here as the MediaItem is clear and there is no reason to actually use a DrmSessionManager at all. 🤔 But maybe I am missing something. (It did not work when quickly testing it in release-v2)

Edit: It does work when I configure both sources as DRM protected. Maybe that was the missing piece.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DecoderInitializationExceptions · Issue #10390 - GitHub
First case: We have streams that consist of content and ads, where the actual content is DRM-protected and the ads are not. The...
Read more >
华为移动服务/hms-wiseplay-demo-exoplayer - Gitee.com
DRM : Fix issue switching from protected content that uses a 16-byte initialization vector to one that uses an 8-byte initialization vector (#6982)....
Read more >
HOW TO FIX ALL DSTV NOW ERROR CODES - YouTube
DSTV is the largest satellite TV company in Africa with over 20 million paid subscribers across the continent. You can literally watch ...
Read more >
Tutorial: Frequently Asked Questions - Shaka Player Demo
A: This error is given to us when the browser can't play the content. This is out of our control and is usually...
Read more >
RELEASENOTES.md - google/ExoPlayer - Sourcegraph
Fix `setMediaDrmSession failed: session not opened` error when switching. between DRM schemes in a ... Widevine or Clearkey protected content in a playlist....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found