androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.59k stars 377 forks source link

Playback of the Widevine-DASH video (on-the-fly) fails with the error: android.media.MediaCodec$CryptoException - Error decrypting data: insufficient output protection. #1211

Closed myvideotom closed 4 months ago

myvideotom commented 6 months ago

Version

Media3 1.2.1

More version details

No response

Devices that reproduce the issue

Smausng Galaxy Tab A8 Android 13 Smausng Galaxy Note9 Android 9 Smausng Galaxy Tab A7 Lite Android 13

Devices that do not reproduce the issue

Analyzing the Firebase data, it seems that other brands of Android devices should not encounter this issue.

Reproducible in the demo app?

Not tested

Reproduction steps

The issue regarding "MediaCodec.native_queueSecureInputBuffer" in Firebase Crashlytics is observed predominantly on Samsung devices (Android OS 9~14) when playing Widevine-DASH (on-the-fly) videos using media3 (1.2.1). Is this a hardware issue with Samsung devices, an issue with ExoPlayer handling MediaCodec, or a problem with the video itself? PS: My media player app uses the media3 (1.2.1) player

Expected result

The video playback is successful.

Actual result

It appears that playback fails on these devices.

Non-fatal Exception: androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:685) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.os.HandlerThread.run(HandlerThread.java:67)

Caused by android.media.MediaCodec$CryptoException: Operation not supported in this configuration: ERROR_DRM_CANNOT_HANDLE ============================== Beginning of DRM Plugin Log ============================== 03-19 07:20:47.640 I found instance=clearkey version=android.hardware.drm@1.3::IDrmFactory 03-19 07:20:47.640 I found instance=widevine version=android.hardware.drm@1.3::IDrmFactory 03-19 07:20:47.644 E uuid=[edef8ba979d64ace a3c827dcd51d21ed] No supported hal instance found 03-19 07:20:48.379 W Cannot cast android.hardware.drm@1.0::IDrmPlugin obj to android.hardware.drm@1.4::IDrmPlugin plugin 03-19 10:04:46.348 E uuid=[edef8ba979d64ace a3c827dcd51d21ed] No supported hal instance found 03-19 10:04:47.464 W Cannot cast android.hardware.drm@1.0::IDrmPlugin obj to android.hardware.drm@1.4::IDrmPlugin plugin 03-19 10:41:34.809 W Cannot cast android.hardware.drm@1.0::ICryptoPlugin obj to android.hardware.drm@1.4::ICryptoPlugin plugin ============================== End of DRM Plugin Log ============================== at android.media.MediaCodec.native_queueSecureInputBuffer(MediaCodec.java) at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2942) at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doQueueSecureInputBuffer(AsynchronousMediaCodecBufferEnqueuer.java:240) at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doHandleMessage(AsynchronousMediaCodecBufferEnqueuer.java:205) at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.access$000(AsynchronousMediaCodecBufferEnqueuer.java)

01 02 03_1 03_2 03_3 log_Galaxy_Tab_A7_Lite.txt log_Galaxy_Note9.txt log_Galaxy_Tab_A8.txt

Media

I can provide relevant Widevine Dash video information, but the video URL and Widevine token cannot be disclosed on the GitHub platform. If you need detailed information about the video, please let me(my e-mail: myvideotom@gmail.com or tomchlin@taiwanmobile.com) know, and I will email it to you.

The information about the video played on the Galaxy Tab A8: videoUrl:https://dache.myvideo.net.tw/Media/20210712/Smooth/EME0100000033... widevineLicenseUrl:https://widevine-... widevineToken:CIvx2lPc5hG/Js7AyTLOARf5EHRRtZAaFG5tyMTWw656y+gTIqJjczGaVXolnKIxrX+sb7evNL6ixzTWBFBV4E6HbAfzScqawdravCbav8AWkfy5gEtOsBsTzyl+lQH8G2V6CPIiyh6.....

The information about the video played on the Galaxy Note9: videoUrl:https://dache.myvideo.net.tw/Media/20210708/Smooth/LON01000.... widevineLicenseUrl:https://widevine... widevineToken:CIvx2lPc5hG/Js7AyTLOAV1AWgEdPpwPsHKf2C7VttbFwD0KqJs5Mfi3DQU7DpDxeRh5G1YUD7dWI69Md1Oj7cGg65rJIOJRqaTisAJ+UE/6NL0Ielppxx0UNKOrm4dwUOlJTq67....

The information about the video played on the Galaxy Tab A7 Lite: videoUrl:https://dache.myvideo.net.tw/Media/20200703/Smooth/ALL0300... widevineLicenseUrl:https://widevin... widevineToken:CIvx2lPc5hG/Js7AyTLOAUf4X2gE80f7dGX7fKCUQoShBA/aO+Pw1wWBJR+hxSkknFKA4NbQsUWiRnoBF3r16lYoZ2n56Q12RpkAQ8YONDaLlRIaq53J1J7RC+....

Bug Report

icbaker commented 6 months ago

[x] You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

We didn't receive this email, please re-send it with the subject Issue #1211.

I can provide relevant Widevine Dash video information, but the video URL and Widevine token cannot be disclosed on the GitHub platform. If you need detailed information about the video, please let me(my e-mail: myvideotom@gmail.com or tomchlin@taiwanmobile.com) know, and I will email it to you.

Please also include the media and license URL info in the same email.

myvideotom commented 6 months ago

@icbaker The complete information of the video (videoUrl, widevineLicenseUrl, and widevineToken) has been emailed to android-media-github@google.com.

rrfrias commented 6 months ago

We are trying to reproduce this. Internal tracker 331193739.

myvideotom commented 6 months ago

android-media-github@google.com

We are trying to reproduce this. Internal tracke

@rrfrias If a long-term valid widevineToken is needed, please let me know, and I will provide it as soon as possible.

fcolley commented 6 months ago

The content tokens provided have expired. We need tokens that are long term. Thank you.

myvideotom commented 6 months ago

The content tokens provided have expired. We need tokens that are long term. Thank you.

@fcolley I will report to my supervisor and provide the video with a long-term valid widevineToken. Once ready, I will send it to you via email and notify you.

fcolley commented 6 months ago

In the meantime, does the policy settings have special output protections requirements? The Note9 is based on the Tablet, so according to your report this is only happening on Tablet-type devices. That's interesting.

Were you able to repro on regular Samsung phones?

myvideotom commented 6 months ago

In the meantime, does the policy settings have special output protections requirements? The Note9 is based on the Tablet, so according to your report this is only happening on Tablet-type devices. That's interesting.

Were you able to repro on regular Samsung phones?

@icbaker 1.According to the information on the Firebase platform, the issue seems to not only occur on tablet devices; it affects both Samsung phones and tablets (Android OS 9, 12, 13, 14). 2.From the devices listed on Firebase, I tested 2 to 4 models of phones/tablets, but couldn't replicate the issue. Based on these logs, can we infer whether the problem lies with the device's decoder, the video itself, or the device hardware?

fcolley commented 6 months ago

I think we need more info before we can make definitive inferences. Before the links expired, we tested on Samsung Galaxy A50 using Android 11 and were not able to reproduce. We would like to do more testing with updated tokens.

(Android OS 9, 12, 13, 14).

It's interesting that it would happen on Android 9 and 12, but not 11. To understand the "insufficient output protection" it would help to understand output protections set in the policy. Please include info to android-media-github@google.com

myvideotom commented 5 months ago

I think we need more info before we can make definitive inferences. Before the links expired, we tested on Samsung Galaxy A50 using Android 11 and were not able to reproduce. We would like to do more testing with updated tokens.

(Android OS 9, 12, 13, 14).

It's interesting that it would happen on Android 9 and 12, but not 11. To understand the "insufficient output protection" it would help to understand output protections set in the policy. Please include info to android-media-github@google.com

@fcolley Using Samsung Note9 (Android 10): 1.Playing Widevine Dash videos works fine. I'm currently quite puzzled about how these errors occurred. 2.When playing a video and then using the device's screen mirroring feature (Smart View) to output to the TV, the TV does not display the video content (which is expected). ExoPlayer didn't show any error messages. 3.I'm still working on trying to replicate the issue.

myvideotom commented 5 months ago

The content tokens provided have expired. We need tokens that are long term. Thank you.

@icbaker @rrfrias The complete information(videoDetalInfo_0402.txt) of the video (videoUrl, widevineLicenseUrl, and widevineToken [long-lasting token, valid until 5/2]) has been emailed to android-media-github@google.com.

fcolley commented 5 months ago

Thanks for providing tokens to retest this.

FYI, only one out of three "ALL03000007745H" attains a license.

The other two fail with requested key has not been loaded: ERROR_DRM_NO_LICENSE

EME01000000338H LON01000007378H

We will continue testing with ALL03000007745H. Could you confirm the info for the two mentioned?

rrfrias commented 5 months ago

@myvideotom if you have the devices that are able to reproduce the issue, can you capture a bugreport for each. We did receive the stack trace for each of these devices but some more information would be helpful.

myvideotom commented 5 months ago

Thanks for providing tokens to retest this.

FYI, only one out of three "ALL03000007745H" attains a license.

The other two fail with requested key has not been loaded: ERROR_DRM_NO_LICENSE

EME01000000338H LON01000007378H

We will continue testing with ALL03000007745H. Could you confirm the info for the two mentioned?

@fcolley I re-provided the information for these two videos(EME01000000338H and LON01000007379H). (videoUrl, widevineLicenseUrl, and widevineToken [long-lasting token, valid until 5/2]) has been emailed to android-media-github@google.com

myvideotom commented 5 months ago

@myvideotom if you have the devices that are able to reproduce the issue, can you capture a bugreport for each. We did receive the stack trace for each of these devices but some more information would be helpful.

@rrfrias

Playing widevine-dash (EME01000000338H) content using media3 (version: 1.2.1) sample app on Xiaomi Pad 5 (Android 11) is successful. Playing the same widevine-dash (EME01000000338H) content using media3 (version: 1.2.1) sample app on Pixel 7 Pro (Android 14) fails.errorLog_EME01000000338H_pixel7pro.txt pixel7pro_1

pixel7pro_2

fcolley commented 5 months ago

Thank you for updating the details.

I see that you changed LON01000007378HPC to LON01000007379HPC and the new code plays correctly!

However, we copied the code for EME01000000338H (the name is the same as before) but it fails with error 29.

google-oss-bot commented 5 months ago

Hey @myvideotom. We need more information to resolve this issue but there hasn't been an update in 14 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 4 months ago

Since there haven't been any recent updates here, I am going to close this issue.

@myvideotom if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

myvideotom commented 4 months ago

@google-oss-bot Recently, I've been observing. Can I observe this issue until May 31st to see if there's any new information I can provide?

rahulnainwalttn commented 4 months ago

I am also facing a similar issue -

{"error": {"errorCode": "21000", "errorException": "androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error", "errorStackTrace": "androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:668) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: android.media.MediaCodec$CryptoException: Crypto key not available: ERROR_DRM_NO_LICENSE cdm err: 0, oem err: 0, ctx: 0 ============================== Beginning of DRM Plugin Log ============================== 05-14 22:19:39.788 I found instance=clearkey version=android.hardware.drm@1.3::IDrmFactory 05-14 22:19:39.788 I found instance=widevine version=android.hardware.drm@1.3::IDrmFactory 05-14 22:19:41.361 W Cannot cast android.hardware.drm@1.0::IDrmPlugin obj to android.hardware.drm@1.4::IDrmPlugin plugin 05-14 22:19:42.717 W Cannot cast android.hardware.drm@1.0::ICryptoPlugin obj to android.hardware.drm@1.4::ICryptoPlugin plugin 05-14 22:19:42.719 W Cannot cast android.hardware.drm@1.0::ICryptoPlugin obj to android.hardware.drm@1.4::ICryptoPlugin plugin 05-14 22:19:42.720 W Cannot cast android.hardware.drm@1.0::ICryptoPlugin obj to android.hardware.drm@1.4::ICryptoPlugin plugin 05-14 22:19:42.724 W Cannot cast android.hardware.drm@1.0::ICryptoPlugin obj to android.hardware.drm@1.4::ICryptoPlugin plugin 05-14 22:29:32.000 W Cannot cast android.hardware.drm@1.0::IDrmPlugin obj to android.hardware.drm@1.4::IDrmPlugin plugin 05-14 22:30:35.087 W Cannot cast android.hardware.drm@1.0::IDrmPlugin obj to android.hardware.drm@1.4::IDrmPlugin plugin 05-14 22:31:30.962 W Cannot cast android.hardware.drm@1.0::IDrmPlugin obj to android.hardware.drm@1.4::IDrmPlugin plugin 05-14 22:31:31.663 W Cannot cast android.hardware.drm@1.0::ICryptoPlugin obj to android.hardware.drm@1.4::ICryptoPlugin plugin ============================== End of DRM Plugin Log ============================== at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method) at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:3105) at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doQueueSecureInputBuffer(AsynchronousMediaCodecBufferEnqueuer.java:240) at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doHandleMessage(AsynchronousMediaCodecBufferEnqueuer.java:205) at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.access$000(AsynchronousMediaCodecBufferEnqueuer.java:47) at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer$1.handleMessage(AsynchronousMediaCodecBufferEnqueuer.java:96) at android.os.Handler.dispatchMessage(Handler.java:106) ... 3 more ", "errorString": "ExoPlaybackException: ERROR_CODE_UNSPECIFIED"}}