Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Issue 2837613004: media: Support better decoder switching (Closed)

Created:
3 years, 8 months ago by xhwang
Modified:
3 years, 7 months ago
CC:
chromium-reviews, feature-media-reviews_chromium.org, posciak+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

media: 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
Unified diffs Side-by-side diffs Delta from patch set Stats (+482 lines, -339 lines) Patch
M media/base/audio_decoder.h View 1 2 3 4 1 chunk +5 lines, -1 line 0 comments Download
M media/base/audio_decoder_config.h View 1 chunk +1 line, -3 lines 0 comments Download
M media/base/mock_filters.h View 1 2 3 4 5 6 7 8 3 chunks +6 lines, -2 lines 0 comments Download
M media/base/mock_filters.cc View 1 2 3 4 5 6 7 8 1 chunk +12 lines, -10 lines 0 comments Download
M media/base/video_decoder.h View 1 2 3 4 1 chunk +4 lines, -1 line 0 comments Download
M media/base/video_decoder_config.h View 1 chunk +1 line, -3 lines 0 comments Download
M media/filters/audio_decoder_selector_unittest.cc View 1 2 3 4 5 11 chunks +77 lines, -91 lines 0 comments Download
M media/filters/decoder_selector.h View 1 2 3 4 5 5 chunks +26 lines, -12 lines 0 comments Download
M media/filters/decoder_selector.cc View 1 2 3 4 5 6 10 chunks +40 lines, -21 lines 0 comments Download
M media/filters/decoder_stream.h View 1 2 3 4 5 6 7 3 chunks +17 lines, -4 lines 0 comments Download
M media/filters/decoder_stream.cc View 1 2 3 4 5 6 7 6 chunks +18 lines, -7 lines 2 comments Download
M media/filters/fake_video_decoder.cc View 1 2 3 4 5 3 chunks +5 lines, -3 lines 0 comments Download
M media/filters/video_decoder_selector_unittest.cc View 1 2 3 10 chunks +77 lines, -91 lines 0 comments Download
M media/filters/video_frame_stream_unittest.cc View 1 2 20 chunks +187 lines, -83 lines 0 comments Download
M media/renderers/audio_renderer_impl.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M media/renderers/video_renderer_impl.cc View 1 1 chunk +2 lines, -3 lines 0 comments Download
M media/renderers/video_renderer_impl_unittest.cc View 1 2 1 chunk +3 lines, -3 lines 0 comments Download

Messages

Total messages: 57 (37 generated)
xhwang
dalecurtis / sandersd: I still need to update the tests. But before that, please do ...
3 years, 8 months ago (2017-04-24 19:25:41 UTC) #2
DaleCurtis
High level sgtm. I need to think about the blacklist a little more, but I ...
3 years, 8 months ago (2017-04-24 19:39:40 UTC) #3
DaleCurtis
https://codereview.chromium.org/2837613004/diff/1/media/filters/decoder_selector.cc File media/filters/decoder_selector.cc (right): https://codereview.chromium.org/2837613004/diff/1/media/filters/decoder_selector.cc#newcode204 media/filters/decoder_selector.cc:204: // When |decrypted_stream_| is selected, the |config_| has changed ...
3 years, 8 months ago (2017-04-24 19:41:05 UTC) #4
sandersd (OOO until July 31)
Basic structure seems sound, but I am hoping for a more explicit handling of the ...
3 years, 8 months ago (2017-04-24 20:55:15 UTC) #5
xhwang
comments-only https://codereview.chromium.org/2837613004/diff/1/media/filters/decoder_selector.cc File media/filters/decoder_selector.cc (right): https://codereview.chromium.org/2837613004/diff/1/media/filters/decoder_selector.cc#newcode71 media/filters/decoder_selector.cc:71: const std::string& blacklisted_decoder, On 2017/04/24 20:55:14, sandersd wrote: ...
3 years, 8 months ago (2017-04-25 00:43:30 UTC) #6
sandersd (OOO until July 31)
Summary of our offline conversation is that xhwang@ will update the documentation for GetDisplayName(), and ...
3 years, 7 months ago (2017-04-27 18:45:31 UTC) #7
xhwang
I updated the existing tests and added new test cases. This feature is also covered ...
3 years, 7 months ago (2017-05-03 23:16:55 UTC) #24
DaleCurtis
Overall idea lg2m, but won't have time to dig in thoroughly before OOO so defer ...
3 years, 7 months ago (2017-05-04 02:37:24 UTC) #27
xhwang
watk: Please also take a look given Dale is going to be OOO soon, and ...
3 years, 7 months ago (2017-05-04 05:20:35 UTC) #29
sandersd (OOO until July 31)
Please update the documentation for GetDisplayName(), and add a TODO for renaming it.
3 years, 7 months ago (2017-05-04 20:27:59 UTC) #30
xhwang
On 2017/05/04 20:27:59, sandersd wrote: > Please update the documentation for GetDisplayName(), and add a ...
3 years, 7 months ago (2017-05-04 20:57:23 UTC) #34
watk
Looks correct to me! I mostly had nits. Could you please update the commit summary ...
3 years, 7 months ago (2017-05-04 21:35:33 UTC) #38
xhwang
rebase only
3 years, 7 months ago (2017-05-04 23:49:31 UTC) #40
xhwang
watk: I addressed all the comments, rebased, and did some small change in decoder_stream.*. PTAL ...
3 years, 7 months ago (2017-05-04 23:53:14 UTC) #43
watk
thanks lgtm https://codereview.chromium.org/2837613004/diff/120001/media/filters/decoder_stream.h File media/filters/decoder_stream.h (right): https://codereview.chromium.org/2837613004/diff/120001/media/filters/decoder_stream.h#newcode225 media/filters/decoder_stream.h:225: bool has_fallen_back_once_on_decode_error_; +1 https://codereview.chromium.org/2837613004/diff/160001/media/base/mock_filters.h File media/base/mock_filters.h (right): ...
3 years, 7 months ago (2017-05-04 23:58:36 UTC) #44
xhwang
sandersd: PTAL again! https://codereview.chromium.org/2837613004/diff/160001/media/base/mock_filters.h File media/base/mock_filters.h (right): https://codereview.chromium.org/2837613004/diff/160001/media/base/mock_filters.h#newcode182 media/base/mock_filters.h:182: explicit MockVideoDecoder(const std::string& decoder_name = ""); ...
3 years, 7 months ago (2017-05-05 00:07:47 UTC) #45
sandersd (OOO until July 31)
lgtm. https://codereview.chromium.org/2837613004/diff/180001/media/filters/decoder_stream.cc File media/filters/decoder_stream.cc (right): https://codereview.chromium.org/2837613004/diff/180001/media/filters/decoder_stream.cc#newcode444 media/filters/decoder_stream.cc:444: has_fallen_back_once_on_decode_error_ = true; It seems this should be ...
3 years, 7 months ago (2017-05-05 00:36:47 UTC) #48
xhwang
https://codereview.chromium.org/2837613004/diff/180001/media/filters/decoder_stream.cc File media/filters/decoder_stream.cc (right): https://codereview.chromium.org/2837613004/diff/180001/media/filters/decoder_stream.cc#newcode444 media/filters/decoder_stream.cc:444: has_fallen_back_once_on_decode_error_ = true; On 2017/05/05 00:36:46, sandersd wrote: > ...
3 years, 7 months ago (2017-05-05 02:42:59 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2837613004/180001
3 years, 7 months ago (2017-05-05 02:43:43 UTC) #54
commit-bot: I haz the power
3 years, 7 months ago (2017-05-05 03:04:35 UTC) #57
Message was sent while issue was closed.
Committed patchset #9 (id:180001) as
https://chromium.googlesource.com/chromium/src/+/1492be9e0d583b0110f22d7e5f2d...

Powered by Google App Engine
This is Rietveld 408576698