mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Wait for DRM keys before codec configuration on FireOS devices
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=201695876
This commit is contained in:
parent
156e2317cc
commit
a407c028d4
@ -369,6 +369,15 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
wrappedMediaCrypto = mediaCrypto.getWrappedMediaCrypto();
|
wrappedMediaCrypto = mediaCrypto.getWrappedMediaCrypto();
|
||||||
drmSessionRequiresSecureDecoder = mediaCrypto.requiresSecureDecoderComponent(mimeType);
|
drmSessionRequiresSecureDecoder = mediaCrypto.requiresSecureDecoderComponent(mimeType);
|
||||||
}
|
}
|
||||||
|
if (deviceNeedsDrmKeysToConfigureCodecWorkaround()) {
|
||||||
|
@DrmSession.State int drmSessionState = drmSession.getState();
|
||||||
|
if (drmSessionState == DrmSession.STATE_ERROR) {
|
||||||
|
throw ExoPlaybackException.createForRenderer(drmSession.getError(), getIndex());
|
||||||
|
} else if (drmSessionState != DrmSession.STATE_OPENED_WITH_KEYS) {
|
||||||
|
// Wait for keys.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codecInfo == null) {
|
if (codecInfo == null) {
|
||||||
@ -1209,6 +1218,16 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the device needs keys to have been loaded into the {@link DrmSession} before
|
||||||
|
* codec configuration.
|
||||||
|
*/
|
||||||
|
private boolean deviceNeedsDrmKeysToConfigureCodecWorkaround() {
|
||||||
|
return "Amazon".equals(Util.MANUFACTURER)
|
||||||
|
&& ("AFTM".equals(Util.MODEL) // Fire TV Stick Gen 1
|
||||||
|
|| "AFTB".equals(Util.MODEL)); // Fire TV Gen 1
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the decoder is known to fail when flushed.
|
* Returns whether the decoder is known to fail when flushed.
|
||||||
* <p>
|
* <p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user