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

Issue 11428095: Pass in media message loop to VideoRendererBase and enforce calling on the right thread. (Closed)

Created:
8 years ago by scherkus (not reviewing)
Modified:
8 years ago
CC:
chromium-reviews, feature-media-reviews_chromium.org, darin-cc_chromium.org
Visibility:
Public.

Description

Pass in media message loop to VideoRendererBase and enforce calling on the right thread. As a result VideoDecoder implementations have been updated to expect they get called on the correct thread instead of trampolining. The newly added media::WrapCB() facilitates running callbacks on separate execution stacks to avoid reentrancy in calling code. BUG=162917 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=171854

Patch Set 1 #

Total comments: 5

Patch Set 2 : yay #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Total comments: 2

Patch Set 6 : dvd #

Patch Set 7 : #

Total comments: 5

Patch Set 8 : GVD #

Unified diffs Side-by-side diffs Delta from patch set Stats (+186 lines, -321 lines) Patch
M media/base/bind_to_loop.h View 1 2 3 4 5 1 chunk +7 lines, -0 lines 0 comments Download
M media/filters/decrypting_video_decoder.h View 1 2 3 4 5 2 chunks +2 lines, -15 lines 0 comments Download
M media/filters/decrypting_video_decoder.cc View 1 2 3 4 5 6 7 12 chunks +62 lines, -115 lines 0 comments Download
M media/filters/ffmpeg_video_decoder.h View 1 2 2 chunks +4 lines, -13 lines 0 comments Download
M media/filters/ffmpeg_video_decoder.cc View 1 2 3 4 5 8 chunks +30 lines, -64 lines 0 comments Download
M media/filters/ffmpeg_video_decoder_unittest.cc View 1 2 8 chunks +10 lines, -36 lines 0 comments Download
M media/filters/gpu_video_decoder.cc View 1 2 3 4 5 6 7 6 chunks +22 lines, -44 lines 0 comments Download
M media/filters/pipeline_integration_test_base.cc View 1 1 chunk +1 line, -0 lines 0 comments Download
M media/filters/video_renderer_base.h View 1 2 5 chunks +12 lines, -4 lines 0 comments Download
M media/filters/video_renderer_base.cc View 1 2 13 chunks +31 lines, -14 lines 0 comments Download
M media/filters/video_renderer_base_unittest.cc View 1 2 3 chunks +3 lines, -16 lines 0 comments Download
M media/tools/player_x11/player_x11.cc View 1 1 chunk +1 line, -0 lines 0 comments Download
M webkit/media/webmediaplayer_impl.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Ami GONE FROM CHROMIUM
Unsurprisingly, I like this approach. I especially like that you can have rules like "in ...
8 years ago (2012-11-29 23:34:23 UTC) #1
scherkus (not reviewing)
yeah it didn't turn out as bad as I feared (it's yet to hit one ...
8 years ago (2012-11-29 23:45:56 UTC) #2
scherkus (not reviewing)
acolwell: time to review! I know I said yesterday I was going to add WrapCB() ...
8 years ago (2012-12-06 21:22:14 UTC) #3
scherkus (not reviewing)
https://codereview.chromium.org/11428095/diff/13001/media/base/callback_wrapper.h File media/base/callback_wrapper.h (right): https://codereview.chromium.org/11428095/diff/13001/media/base/callback_wrapper.h#newcode26 media/base/callback_wrapper.h:26: void RunWrappedCB( I just realized I was completely mistaken ...
8 years ago (2012-12-06 21:57:57 UTC) #4
acolwell GONE FROM CHROMIUM
LGTM
8 years ago (2012-12-06 23:02:37 UTC) #5
scherkus (not reviewing)
xhwang: can you take a look at DVD?
8 years ago (2012-12-07 00:55:59 UTC) #6
xhwang
reviewed DVD only https://codereview.chromium.org/11428095/diff/10020/media/filters/decrypting_video_decoder.cc File media/filters/decrypting_video_decoder.cc (right): https://codereview.chromium.org/11428095/diff/10020/media/filters/decrypting_video_decoder.cc#newcode144 media/filters/decrypting_video_decoder.cc:144: BindToCurrentLoop(closure).Run(); Is this used to force ...
8 years ago (2012-12-07 01:21:07 UTC) #7
scherkus (not reviewing)
https://codereview.chromium.org/11428095/diff/10020/media/filters/decrypting_video_decoder.cc File media/filters/decrypting_video_decoder.cc (right): https://codereview.chromium.org/11428095/diff/10020/media/filters/decrypting_video_decoder.cc#newcode144 media/filters/decrypting_video_decoder.cc:144: BindToCurrentLoop(closure).Run(); On 2012/12/07 01:21:07, xhwang wrote: > Is this ...
8 years ago (2012-12-07 01:43:16 UTC) #8
xhwang
8 years ago (2012-12-07 02:22:19 UTC) #9
lgtm on DVD % more discussion

https://codereview.chromium.org/11428095/diff/10020/media/filters/decrypting_...
File media/filters/decrypting_video_decoder.cc (right):

https://codereview.chromium.org/11428095/diff/10020/media/filters/decrypting_...
media/filters/decrypting_video_decoder.cc:144: BindToCurrentLoop(closure).Run();
On 2012/12/07 01:43:16, scherkus wrote:
> On 2012/12/07 01:21:07, xhwang wrote:
> > Is this used to force posting the task to prevent reentrance? (Note that we
> are
> > already on the right thread). In that case, I feel BindToCurrentLoop a
little
> > confusing. How about renaming BindToLoop/BindToCurrentLoop to
> > PostToLoop/PostToCurrentLoop?
> 
> I agree the naming could be better but I'd like to save that for a different
CL.

SGTM
> 
> > Also, can the closure itself be a BindToCurrentLoop(...) in the VRB so that
> the
> > decoder can call it at any time without worrying about force posting it? If
so
> > we can make it part of the API contract.
> 
> Yeah I've been thinking about that... strictly speaking the API contract is
that
> these are async methods and thus should be executed async-ly (i.e., the onus
is
> on the implementer). Having the caller (e.g., VRB) wrap the closure means they
> knows that the implementations of these methods are in fact executed
> synchronously.
> 
> That being said, we have N VideoDecoder implementations and 1 VRB! I also
wonder
> whether some of these methods should be async at all!
> 
> I just fixed up GpuVideoDecoder as well and it's making me think that perhaps
> these APIs shouldn't make guarantees and that the onus is on the caller to
> BindToCurrentLoop() if they aren't safe against reentrancy...
hmmmmmm..........

I feel it's cleaner to have the VRB do that so that all decoders don't need to
worry about that. It's easy to miss this in VideoDecoder implementation. If we
do that, we probably can also remove the BindToCurrentLoop on lines 42, 73, 96.
But really I don't have strong opinions on this. As long as we make the API
contract clear I am fine.

Powered by Google App Engine
This is Rietveld 408576698