Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRM & ClearKey 1.4.X Unexpected runtime error #1732

Open
1 task done
KingLucius opened this issue Sep 16, 2024 · 7 comments
Open
1 task done

DRM & ClearKey 1.4.X Unexpected runtime error #1732

KingLucius opened this issue Sep 16, 2024 · 7 comments
Assignees

Comments

@KingLucius
Copy link

KingLucius commented Sep 16, 2024

Version

Media3 1.4.0

More version details

From 1.4.0 and up has this issue, downgrading to 1.3.1 fixes it

Devices that reproduce the issue

Amazon FireTV Stick 4K (Mantis)

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

I can provide sample ClearKey link in private to test

Expected result

Media working like in 1.3.1

Actual result

09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal: Playback error
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:   androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:720)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at android.os.Handler.dispatchMessage(Handler.java:98)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at android.os.Looper.loop(Looper.java:154)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at android.os.HandlerThread.run(HandlerThread.java:61)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:   Caused by: android.media.MediaCodec$CryptoException: Operation not supported in this configuration
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2584)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.mediacodec.SynchronousMediaCodecAdapter.dequeueOutputBufferIndex(SynchronousMediaCodecAdapter.java:108)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1994)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:873)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:1018)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1136)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:561)
09-13 07:39:36.096 18108 18297 E ExoPlayerImplInternal:       ... 3 more
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal: Disable failed.
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:   android.media.MediaCodec$CryptoException: Operation not supported in this configuration
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at android.media.MediaCodec.native_flush(Native Method)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at android.media.MediaCodec.flush(MediaCodec.java:2068)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.mediacodec.SynchronousMediaCodecAdapter.flush(SynchronousMediaCodecAdapter.java:168)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.flushCodec(MediaCodecRenderer.java:960)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:953)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:780)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.onDisabled(MediaCodecVideoRenderer.java:794)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.BaseRenderer.disable(BaseRenderer.java:220)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:1846)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:1566)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:1523)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:722)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at android.os.Handler.dispatchMessage(Handler.java:98)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at android.os.Looper.loop(Looper.java:154)
09-13 07:39:36.097 18108 18297 E ExoPlayerImplInternal:       at android.os.HandlerThread.run(HandlerThread.java:61)

Media

Will send to [email protected]

Bug Report

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
@icbaker
Copy link
Collaborator

icbaker commented Sep 17, 2024

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

We didn't receive this. Please re-send it with subject Issue #1732. Thanks!

@KingLucius
Copy link
Author

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

We didn't receive this. Please re-send it with subject Issue #1732. Thanks!

Done

@icbaker
Copy link
Collaborator

icbaker commented Sep 20, 2024

The email contains a logcat snippet, not the zip file produced by adb bugreport. The full bugreport often contains additional info which can help to understand issues. Please run adb bugreport after reproducing the issue, and email us the resulting zip file, then update this issue.

@KingLucius
Copy link
Author

The email contains a logcat snippet, not the zip file produced by adb bugreport. The full bugreport often contains additional info which can help to understand issues. Please run adb bugreport after reproducing the issue, and email us the resulting zip file, then update this issue.

Updated the email with adb bugreport zip file result

@icbaker
Copy link
Collaborator

icbaker commented Sep 20, 2024

Thanks - please can you add an EventLogger (https://developer.android.com/media/media3/exoplayer/debug-logging) and reproduce and take a new BR.

Please can you also provide a BR of a successful playback using 1.3.1, so we can understand what might be behaving differently.

@KingLucius
Copy link
Author

Thanks - please can you add an EventLogger (https://developer.android.com/media/media3/exoplayer/debug-logging) and reproduce and take a new BR.

Please can you also provide a BR of a successful playback using 1.3.1, so we can understand what might be behaving differently.

Updated, please check

@icbaker
Copy link
Collaborator

icbaker commented Sep 23, 2024

Thanks - I can't see any EventLogger output in the BR, so I'm not sure if you added it correctly (you need to add a line like player.addAnalyticsListener(new EventLogger())).

However I can see a difference between the two BRs without this, that I suspect is responsible for the error you're seeing.

At 1.3.1 we are instantiating an "insecure" (i.e. not HW-secure) video decoder:

OMXMaster: makeComponentInstance(OMX.MTK.VIDEO.DECODER.AVC) in mediacodec process

At 1.4.0 we are instantiating a HW-secure one (note the .secure suffix):

OMXMaster: makeComponentInstance(OMX.MTK.VIDEO.DECODER.AVC.secure) in mediacodec process

ClearKey doesn't support HW-secure playback.

At a guess, I suspect the change in behaviour might have been introduced by c872af4 where we switched from using MediaCrypto.requiresSecureDecoderComponent(String) to MediaDrm.requiresSecureDecoder(String).

We made a related follow-up fix/workaround that was included in 1.4.1 where MediaDrm.requiresSecureDecoder(String) was returning false when it should have been returning true (and MediaCrypto.requiresSecureDecoderComponent(String) was returning true): b184677 (and then a follow-up fix to this for an edge-case that will be in 1.5.0-beta01: 0b86f89).

In your case, my hypothesis would suggest that MediaDrm.requiresSecureDecoder(String) is incorrectly returning true while MediaCrypto.requiresSecureDecoderComponent(String) is returning false. Would you be able to test this hypothesis?

If you have a local dependency on ExoPlayer this is quite easy, because you can just add some logging here in MediaCodecRenderer:

boolean mediaCryptoRequiresSecureDecoder =
codecDrmSession != null
&& (codecDrmSession.getState() == DrmSession.STATE_OPENED
|| codecDrmSession.getState() == DrmSession.STATE_OPENED_WITH_KEYS)
&& codecDrmSession.requiresSecureDecoder(
checkStateNotNull(inputFormat.sampleMimeType));

Something like:

if (codecDrmSession != null 
    && (codecDrmSession.getState() == DrmSession.STATE_OPENED
        || codecDrmSession.getState() == DrmSession.STATE_OPENED_WITH_KEYS)) {
  Log.w(
    "issue-1732",
    "drmSession.requiresSecureDecoder()="
        + codecDrmSession.requiresSecureDecoder(checkStateNotNull(inputFormat.sampleMimeType));
}
if (mediaCrypto != null) {
  Log.w(
    "issue-1732",
    "mediaCrypto.requiresSecureDecoderComponent()="
        + mediaCrypto.requiresSecureDecoderComponent(checkStateNotNull(mimeType));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants