Descriptionmedia: Support better decoder switching
Today on reinitialization error, or decode error of the first buffer,
DecoderStream will fall back to decoders left in the DecoderSelector.
Since we will have less and less decoders in the DecoderSelector, the
ability to switch decoders is limited.
This CL updates DecoderSelector so that it takes a callback to create
a list of decoders, instead of taking the list of decoders directly.
This allows the DecoderSelector to select a decoder that has been
tried or selected before, such that upon decoder reinitialization error
(e.g. switching from clear to encrypted config), or upon decode error of
the first buffer, we always have the full list of decoders to select
from.
Two mechanisms are added to avoid trying the same failing decoder again:
1. Blacklist
When SelectDecoder() is called due to reinitialization failure, or
decoding failure of the first buffer, the existing decoder is listed as
the "blacklisted decoder" such that DecoderSelector will not even try
it.
There is one exception though. When DecryptingDemuxerStream is selected,
since the input steam is changed (encrypted -> clear), the blacklisted
decoder is ignored. For example, FFmpegVideoDecoder is slected first for
a clear stream. Then on a config change, the stream becomes encrypted so
FFmpegVideoDecoder fails to reinitialize and we need to select a new
decoder. After DecryptingDemuxerStream is selected, we should still be
able to use FFmpegVideoDecoder to decode the decrypted stream.
2. Fall back at most once
If fallback has already happened and decode of the first buffer failed
again, we don't try to fallback again. This is to avoid the infinite
loop of "select decoder 1 -> decode error -> select decoder 2 -> decode
error -> select decoder 1".
BUG=695595
TEST=Updated/Added unittests.
Review-Url: https://codereview.chromium.org/2837613004
Cr-Commit-Position: refs/heads/master@{#469579}
Committed: https://chromium.googlesource.com/chromium/src/+/1492be9e0d583b0110f22d7e5f2ded139611f8bd
Patch Set 1 #
Total comments: 9
Patch Set 2 : rebase+test #Patch Set 3 : test updates #Patch Set 4 : more test updates #
Total comments: 5
Patch Set 5 : update GetDisplayName() comments #
Total comments: 24
Patch Set 6 : comments #
Total comments: 1
Patch Set 7 : rebase only #Patch Set 8 : do not always keep decoder selector #
Total comments: 2
Patch Set 9 : Mock*Decoder name #
Total comments: 2
Messages
Total messages: 57 (37 generated)
|