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.

AndroidTV - DASH/Widevine - Unable to use 2 video decoders simultaneously on some recent devices - "MediaCodec$CryptoException: Operation not supported in this configuration"

See original GitHub issue

Hi,

There is a new issue spreading on some devices since this summer:

  • Sony Bravia KD-75X85J AndroidTV 10 Build.DEVICE = BRAVIA_VH2
  • Sony Bravia XBR-65X900H AndroidTV 10 Build.DEVICE = BRAVIA_VH1
  • Hisense 65U8G AndroidTV 10 (detected this week)

I am using the latest exoplayer version: 2.16.0 While looking for regressions in my project, I went all the way back to exoplayer 2.9.6 and still had the bug.

I also found a workaround that I will explain.


Search existing issues, including issues that are closed:

(Issues with the same error but different problem)

Clear reproduction steps including observed and expected behavior

  1. The main player is playing a DASH H264 Widevine stream in 720p or 1080p on a SurfaceView. This player uses the first secure hardware decoder of the device.
  2. On top of the main player We start a PIP, DASH H264 Widevine 360p on a TextureView, audio disabled. This player uses the first non-secure decoder available.
  3. Actual result: The PIP starts and plays, but the main player stops playing and throws a MediaCodecVideoRenderer errorcaused by: android.media.MediaCodec$CryptoException: Operation not supported in this configuration (more details in logcat files) Expected result: Same as all other devices: Show the PIP and keep playing the main player.
// Error in the main player (which was playing correctly before starting the PIP)

11-11 21:02:18.205 10043 10959 D PlayerCodecSelector: video/avc -> [OMX.MTK.VIDEO.DECODER.AVC.secure]
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal: Playback error
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:   com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(2, null, null, video/avc, avc1.4D4020, 2499968, null, [960, 540, 59.94006], [-1, -1]), format_supported=YES
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:558)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at android.os.Handler.dispatchMessage(Handler.java:103)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at android.os.Looper.loop(Looper.java:214)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at android.os.HandlerThread.run(HandlerThread.java:67)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:   Caused by: android.media.MediaCodec$CryptoException: Operation not supported in this configuration
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2706)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.queueSecureInputBuffer(SynchronousMediaCodecAdapter.java:148)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1367)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:825)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:978)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:482)
11-11 21:02:18.209 10043 10959 E ExoPlayerImplInternal:       ... 3 more

I am sending adb logcats with a lot more information at dev.exoplayer@gmail.com

  • It is surprising to see the main player failing instead of the PIP which is the one trying to initialize. Having the error in the PIP would have been better for handling.
  • During my troubleshooting on BRAVIA_VH1 I also tried to force the second non-secure decoder c2.android.avc.decoder instead of the default OMX.MTK.VIDEO.DECODER.AVC. But still got the same outcome.
  • So far, since August we received complains only on the 3 devices I mentionned, the Hisense was reported this week, before that I thought it was Bravia specific (not all Bravias). Those devices all have great specs. They all run Android 10, but I doubt it is the reason.
  • I can confirm the issue does not happen on all the other devices I tested: Broadcom AOSP STB, Google ADT-3 (Android 11), Google TV chromecast, Many Nvidia Shields, FireTV 4K, FireTV Gen 2, many Bravia (not VH1 and VH2).
  • It seems related to the Widevine CDM or Android revision. FireTV 4K uses same decoders than BRAVIA_VH1 and does not have the bug. Decoder: OMX.MTK.VIDEO.DECODER.AVC.secure
  • I noticed on most other Bravias the second software decoder is OMX.google.h264.decoder but VH1 and VH2 have c2.android.avc.decoder instead. (I could not verify on the customer’s HiSense if it is the same)

Workaround

The workaround was to force Widevine L3 on the PIP. I would prefer to avoid it, it creates bugs on other devices. I am explaining it here only because I think it can help troubleshooting.
Operation not supported in this configuration seems related to the Device unable to play widevine L1, but I know for sure L1 works in the main player and we are not expecting to use L1 in the PIP. So I though maybe the system has a bug where it is not able to select L3 for the PreviewPlayer (as expected)…

Initially, the MainPlayer and PreviewPlayer (PIP) were each using a simple DrmSessionManager (1 instance each): DefaultDrmSessionManager.Builder().build(delegatedDrmCallback)

  • I kept it for the MainPlayer
  • And for the PreviewPlayer, inside the DefaultDrmSessionManger.Builder I forced Widevine L3 with in the securityLevel property.
  • Now we get the expected behavior: both players can play simultaneously. I got confirmation on BRAVIA_VH1 and BRAVIA_VH2. But unfortunately on most of all the other devices it creates a ~1 second video/audio freeze in the MainPlayer while initializing the PIP… So the workaround has to be conditionnal to a specific list of devices. Not ideal… it will not handle unknown and new devices.

There is a probability that more devices will be affected with upcoming OS updates.


If I missed something, if you have a fix or better workaround please let me know. Even if it is a manufacturer/exoplayer/widevine issue I have to come up with a solution/workaround for my product. Any help would be appreciated. Thanks

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
icbakercommented, Nov 22, 2021

FYI OMX.google.h264.decoder is an alias for c2.android.avc.decoder, so it’s not surprising they’re showing the same behaviour. From adb shell dumpsys media.player on a Pixel 5:

  Encoder "c2.android.avc.encoder" supports
    aliases: [
      "OMX.google.h264.encoder" ]
1reaction
marcbaechingercommented, Nov 19, 2021

Thanks for the detailed report. @rrfrias may I ask to look into this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Some android tv box devices can not decode ... - GitHub
Console output. DECODER_ERROR_NOT_SUPPORTED: video decoder initialization failed same with issue #2315 .
Read more >
Intermittent Secure Decoder Init Failure - Galaxy A7 lite and ...
VIDEO.DECODER.AVC.secure android.media.MediaCodec$CryptoException: Operation not supported in this configuration. I reproduced on the device ...
Read more >
MediaCodec - Android Developers
Finally, since some codecs can operate in multiple modes, ... package the entire new codec-specific configuration data together with the key frame into...
Read more >
Zoom video to fiil screen not working on HW/HW+ mode ...
Hi everyone! I'm having a problem when I try to zoom in any video to fill the screen and eliminate the black bars...
Read more >
Android MediaCodec: How many simultaneous (video ...
java. I tried 3 simultaneous video(h264) decoders using MediaCodec APIs on 3 SurfaceViews. On adding 4th decoder to 4th SurfaceView to Nexus 7 ......
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