Guard DrmSession.requiresSecureDecoder
calls with state checks
This method is documented that it may only be called in `STATE_OPENED`
or `STATE_OPENED_WITH_KEYS`. It's possible for it to be called in other
states (like `STATE_ERROR`) without this guard.
Previously this didn't cause issues, but since 9d62845c45
we assume that the `sessionId` is non-null in this method, which results
in an `IllegalStateException` when the documented state restriction is
ignored.
PiperOrigin-RevId: 675969256
This commit is contained in:
parent
caf70e54db
commit
0b86f89498
@ -51,6 +51,9 @@
|
||||
* Image:
|
||||
* DataSource:
|
||||
* DRM:
|
||||
* Fix `IllegalStateException` from
|
||||
`DefaultDrmSession.requiresSecureDecoder` after opening a DRM session
|
||||
failed. This issue was introduced in `1.5.0-alpha01`.
|
||||
* Effect:
|
||||
* Muxers:
|
||||
* IMA extension:
|
||||
|
@ -578,6 +578,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||
try {
|
||||
boolean mediaCryptoRequiresSecureDecoder =
|
||||
codecDrmSession != null
|
||||
&& (codecDrmSession.getState() == DrmSession.STATE_OPENED
|
||||
|| codecDrmSession.getState() == DrmSession.STATE_OPENED_WITH_KEYS)
|
||||
&& codecDrmSession.requiresSecureDecoder(
|
||||
checkStateNotNull(inputFormat.sampleMimeType));
|
||||
maybeInitCodecWithFallback(mediaCrypto, mediaCryptoRequiresSecureDecoder);
|
||||
@ -2292,9 +2294,12 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||
}
|
||||
|
||||
// Re-initialization is required if newSession might require switching to the secure output
|
||||
// path.
|
||||
// path. We assume newSession might require a secure decoder if it's not fully open yet.
|
||||
return !codecInfo.secure
|
||||
&& newSession.requiresSecureDecoder(checkNotNull(newFormat.sampleMimeType));
|
||||
&& (newSession.getState() == DrmSession.STATE_OPENING
|
||||
|| ((newSession.getState() == DrmSession.STATE_OPENED
|
||||
|| newSession.getState() == DrmSession.STATE_OPENED_WITH_KEYS)
|
||||
&& newSession.requiresSecureDecoder(checkNotNull(newFormat.sampleMimeType))));
|
||||
}
|
||||
|
||||
private void reinitializeCodec() throws ExoPlaybackException {
|
||||
|
Loading…
x
Reference in New Issue
Block a user