androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
Apache License 2.0
1.37k stars 322 forks source link

Live TV playback stuck with Widevine decrypt failure on Chromecast 4K #316

Closed psharma676 closed 7 months ago

psharma676 commented 1 year ago

Media3 Version

ExoPlayer 2.18.5

Devices that reproduce the issue

Chromecast 4k, Amlogic SOC, Android 12(google/sabrina_prod_stable/sabrina:12/STTE.220920.016.H1/9408258:user/release-keys)

Issue seems specific to ATV 12, Chromecast is the only ATV 12 device we have tried so far.

Devices that do not reproduce the issue

Amlogic SOC devices running ATV 10 or 11.

Reproducible in the demo app?

Yes

Reproduction steps

Branch dev-v2 @ commit 2e84360a44 (its what we had, but not important perhaps), build demo-NoDecoderExtension-debug.apk and load on Chromecast 4K. Amlogic SOC. Play stream, details provided in separate email.

Expected result

Media plays successfully

Actual result

The following failure is seen:

04-10 11:57:27.034 6533 6533 D EventLogger: drmKeysLoaded [eventTime=7.44, mediaPos=3573.57, window=0, period=0] 04-10 11:57:27.040 3630 3660 I oemcrypto_tz: [OEMCrypto_TEEInvokeData:520] cmd 1105 return 28 04-10 11:57:27.040 3630 3660 E oemcrypto_tz: [OEMCrypto_TEEInvokeData:522] error return 28 04-10 11:57:27.040 3630 3660 E oemcrypto_tz: [_oecc105:1399] error return 1c 04-10 11:57:27.040 3630 3660 E WVCdm : [crypto_session.cpp(1610):Decrypt] OEMCrypto_DecryptCENC failed: status = 28 04-10 11:57:27.040 3630 3660 E WVCdm : Decrypt error in session sid7 during a sample with protected data: 178 04-10 11:57:27.040 6533 6933 W MediaCodec: Log queueSecureInputBuffer error: -2006

Media

Will be sent to dev.exoplayer@gmail.com

Bug Report

icbaker commented 1 year ago

I can reproduce the problem with Chromecast 4k (Sabrina) running Android 12. I don't see a problem on a Pixel 4a running Android 12, so it's not a completely general Android 12 error.

@rrfrias could you take a look please?

[cdm_engine.cpp(306):AddKey] session_id = sid9, key_set_id = <empty>
[cdm_engine.cpp(334):AddKey] key_data = (886) CAIS4A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EAAADLAAAAEAAAAN0AAAAQAAAA7wAAABAAAAE9AAAAEAAAARsAAAAg7YqpTswEi2YKtBNW0xFvdbo2ie_4U9uRRdgRpUCnDw9YAA==
[OEMCrypto_TEEInvokeData:520] cmd 1105 return 28
[OEMCrypto_TEEInvokeData:522] error return 28
[_oecc105:1399] error return 1c
[crypto_session.cpp(1610):Decrypt] OEMCrypto_DecryptCENC failed: status = 28
Decrypt error in session sid9 during a sample with protected data: 178
Log queueSecureInputBuffer error: -2006
framework logs size 6; plugin logs size 9
[OEMCrypto_TEEInvokeData:520] cmd 1105 return 28
[OEMCrypto_TEEInvokeData:522] error return 28
[_oecc105:1399] error return 1c
Decrypt error in session sid9 during a sample with protected data: 178
Log queueSecureInputBuffer error: -2006
Playback error
  androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, avc1.4D401E, 1368640, null, [720, 480, 29.97], [-1, -1]), format_supported=YES
      at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:586)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loopOnce(Looper.java:201)
      at android.os.Looper.loop(Looper.java:288)
      at android.os.HandlerThread.run(HandlerThread.java:67)
  Caused by: android.media.MediaCodec$CryptoException: Operation not supported in this configuration: 6 (Unknown error -6)
  ============================== Beginning of DRM Plugin Log ==============================
    04-12 11:40:11.797 I found instance=castkey version=android.hardware.drm@1.0::IDrmFactory
    04-12 11:40:11.797 I found instance=clearkey version=android.hardware.drm@1.4::IDrmFactory
    04-12 11:40:11.797 I found instance=default version=android.hardware.drm@1.0::IDrmFactory
    04-12 11:40:11.797 I found instance=netflix version=android.hardware.drm@1.4::IDrmFactory
    04-12 11:40:11.797 I found instance=playready version=android.hardware.drm@1.4::IDrmFactory
    04-12 11:40:11.797 I found instance=widevine version=android.hardware.drm@1.4::IDrmFactory
    04-12 11:40:15.034 I [cdm_engine.cpp(918):GetProvisioningRequest] cert_type = Widevine
    04-12 11:40:15.320 I [cdm_engine.cpp(957):HandleProvisioningResponse] response_size = 3940, security_level = Default
    04-12 11:40:15.332 I [cdm_engine.cpp(140):OpenSession] New session: session_id = sid9
    04-12 11:40:15.332 I [cdm_engine.cpp(882):QueryOemCryptoSessionId] session_id = sid9
    04-12 11:40:15.334 I [cdm_engine.cpp(1901):SetPlaybackId] session_id = sid9, playback_id = qPYz3mei316n-U4r
    04-12 11:40:15.351 I [cdm_engine.cpp(227):GenerateKeyRequest] session_id = sid9, key_set_id = <empty>, license_type = Streaming
    04-12 11:40:15.399 I [cdm_engine.cpp(787):QuerySessionStatus] session_id = sid9
    04-12 11:40:15.962 I [cdm_engine.cpp(306):AddKey] session_id = sid9, key_set_id = <empty>
    04-12 11:40:15.989 E [crypto_session.cpp(1610):Decrypt] OEMCrypto_DecryptCENC failed: status = 28
  ============================== End of DRM Plugin Log ==============================
      at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
      at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2904)
      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
psharma676 commented 1 year ago

Hello @rrfrias and @icbaker - would you be able to update this issue and let us know if you need anything from us?

rrfrias commented 1 year ago

@psharma676 Do we have your permission to share the stream information you sent us in the email with Amlogic?

Opened internal tracker: 281927907

psharma676 commented 1 year ago

@rrfrias I checked and there are no issues with sharing. Please let us know if/when there is anything else that you need from us to help move this issue along.

rrfrias commented 1 year ago

We have been unable to repro with an ADT-3 (also amlogic). Will work with Amlogic to repro on a Sabrina next.

psharma676 commented 1 year ago

Hello @rrfrias - is there an update for this issue that you can share with us?

rrfrias commented 11 months ago

Working with AMlogic. No update at this point.

rrfrias commented 11 months ago

Amlogic was able to reproduce. They think this is an HLS livestream. The problem, they think, is that the resolution changed and the corresponding key id was not in the license and needed to be fetched.

You can use the MediaDrm.OnKeyStatusChangeListener to register for notifications about key status/validity. Let us know if you need any more information.

amlbj136 commented 11 months ago

The stream has multiple resolution video streams. each stream has its own EXT-X-KEY tag. in this case, APP should create Mediadrm and fetch key for every streams. Please also set Mediadrm running in shared mode

sneelavara commented 11 months ago

Thank you @rrfrias and @amlbj136 . Yes, the stream is HLS livesteam. We will investigate further on that. But we have other AmLogic devices they are not exhibiting this issue. It happens only on ChomeCast.

rrfrias commented 11 months ago

@sneelavara Can you mention which Amlogic devices do not exhibit the problem?

sneelavara commented 11 months ago

hi @rrfrias , AmLogic S905X2-J and 905X4. They are our managed devices.

rrfrias commented 11 months ago

Amlogic was able to reproduce with S905X2 after 15 minutes of playback. Can you share the Android OS, image version and date?

sneelavara commented 10 months ago

Hi @rrfrias , we verified on Android 11. Here is the build details -

[ro.system.build.id]: [RTT0.211009.001]
[ro.system.build.tags]: [release-keys]
[ro.system.build.type]: [user]
[ro.system.build.version.incremental]: [780]
[ro.system.build.version.release]: [11]
[ro.system.build.version.release_or_codename]: [11]
[ro.system.build.version.sdk]: [30]

Let us know if you are looking for something else. Thanks and regards, Sadashiva N.

psharma676 commented 10 months ago

Hello @rrfrias and @sneelavara

I would like to bring your attention to the very first comment made by @icbaker on April 12

"I can reproduce the problem with Chromecast 4k (Sabrina) running Android 12. I don't see a problem on a Pixel 4a running Android 12, so it's not a completely general Android 12 error."

I am hoping, this should help to narrow down our suspects.

rrfrias commented 10 months ago

@sneelavara is the build information https://github.com/androidx/media/issues/316#issuecomment-1680023383 for a device that does not reproduce the problem? Is this for either AmLogic S905X2-J or 905X4? Amlogic is looking for image version and for an device that did not exhibit the problem.

@psharma676 We can look into this. It might be easier for Amlogic if they can investigate their own devices one of which does and does not reproduce the problem.

sneelavara commented 10 months ago

Hi @rrfrias, correct. https://github.com/androidx/media/issues/316#issuecomment-1680023383 is from working S905X4 device.

google-oss-bot commented 9 months ago

Hey @psharma676. 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!

psharma676 commented 9 months ago

Hello @rrfrias I believe you are able to move forward with the information we have given so far, let us know otherwise.

rrfrias commented 9 months ago

I have shared that information with AmLogic. Waiting on them to investigate.

psharma676 commented 8 months ago

Hello @rrfrias - any luck or progress with this bug, would you be able to give us an update? Thanks!

rrfrias commented 7 months ago

Amlogic has been able to reproduce on S905X4 running RTT0.211222.001 . This is a device with a similar enough build where you were unable to see errors.

We also were able to see a failure to playback on Chromecast 4k TTT1.221215.001 . Looking at the logs however, failure to playback occurs after about 15 minutes and it appears to be a missing content key. The failure you mentioned in the first comment is a decryption error. It appears we are unable to reproduce your precise problem. We used the stream information that you sent us.

Is it possible to send us an apk (exoplayer demo is fine) so that we can reproduce the exact problem? A bugreport might be helpful to make sure it is the same error as in the original message.

psharma676 commented 7 months ago

Hello @rrfrias - we retested with Media3 v1.1.1 and we can no longer see the issue. This issue has been around for a while and we suspect some change may have fixed it. Closing issue, thanks for your help!