mirror of
https://github.com/samsonjs/media.git
synced 2026-03-27 09:45:47 +00:00
Clear CodecInfos on InputFormat if codec is null
In maybeInitCodecWithFallback, it caches availableCodecInfos with mediaCryptoRequiresSecureDecoder and inputFormat as inputs, and won't clear it if shouldInitCodec is false, resulting in a case where availableCodecInfos is not null and codec is null. When we have a new format, it's reasonable to clear availableCodecInfos if codec is null. Otherwise we might not be able to properly initialize a new codec. PiperOrigin-RevId: 329971796
This commit is contained in:
parent
d1631cf86f
commit
45dc66ef2f
1 changed files with 11 additions and 0 deletions
|
|
@ -1442,6 +1442,9 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||
}
|
||||
|
||||
if (codec == null) {
|
||||
if (!legacyKeepAvailableCodecInfosWithoutCodec()) {
|
||||
availableCodecInfos = null;
|
||||
}
|
||||
maybeInitCodecOrBypass();
|
||||
return;
|
||||
}
|
||||
|
|
@ -1506,6 +1509,14 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether to keep available codec infos when the codec hasn't been initialized, which is
|
||||
* the behavior before a bug fix. See also [Internal: b/162837741].
|
||||
*/
|
||||
protected boolean legacyKeepAvailableCodecInfosWithoutCodec() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when one of the output formats changes.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue