mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Add missing call to adjustUuid
in FrameworkMediaDrm
Before API 27, the platform DRM components incorrectly expected
`C.COMMON_PSSH_UUID` instead of `C.CLEARKEY_UUID` in order to perform
ClearKey decryption. `FrameworkMediaDrm` is responsible for doing this
adjustment on these API levels, but this call was missed when
refactoring some DRM code in
c872af4bc0
.
This led to `MediaCodec$CryptoException: Operation not supported in this
configuration` errors when doing ClearKey playback on devices with
API < 27. This was because the earlier, clearer error from the
`MediaCrypto` constructor was being swallowed and transformed to
`requiresSecureDecoder = true` by the `catch` logic in
`FrameworkMediaDrm.requiresSecureDecoder`.
This change also makes the error handling in
`FrameworkMediaDrm.requiresSecureDecoder` more robust by assuming
`requiresSecure = false` for ClearKey (and true for all other DRM
schemes), since we know that ClearKey never supports secure decoding.
This will help avoid more ClearKey playback failures if we see other,
unrelated, errors at this point.
Issue: androidx/media#1732
#cherrypick
PiperOrigin-RevId: 730882278
This commit is contained in:
parent
d58740367b
commit
ecb83f3b73
@ -25,6 +25,9 @@
|
||||
* Image:
|
||||
* DataSource:
|
||||
* DRM:
|
||||
* Fix `MediaCodec$CryptoException: Operation not supported in this
|
||||
configuration` error when playing ClearKey content on API < 27 devices
|
||||
([#1732](https://github.com/androidx/media/issues/1732)).
|
||||
* Effect:
|
||||
* Muxers:
|
||||
* `writeSampleData()` API now uses muxer specific `BufferInfo` class
|
||||
|
@ -298,11 +298,14 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||
} else {
|
||||
MediaCrypto mediaCrypto = null;
|
||||
try {
|
||||
mediaCrypto = new MediaCrypto(uuid, sessionId);
|
||||
mediaCrypto = new MediaCrypto(adjustUuid(uuid), sessionId);
|
||||
result = mediaCrypto.requiresSecureDecoderComponent(mimeType);
|
||||
} catch (MediaCryptoException e) {
|
||||
// This shouldn't happen, but if it does then assume that a secure decoder may be required.
|
||||
result = true;
|
||||
// This shouldn't happen, but if it does then assume that most DRM schemes need a secure
|
||||
// decoder but ClearKey doesn't (because ClearKey never uses secure decryption). Requesting
|
||||
// a secure decoder when it's not supported leads to playback failures:
|
||||
// https://github.com/androidx/media/issues/1732
|
||||
result = !uuid.equals(C.CLEARKEY_UUID);
|
||||
} finally {
|
||||
if (mediaCrypto != null) {
|
||||
mediaCrypto.release();
|
||||
|
Loading…
x
Reference in New Issue
Block a user