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

Issue 2418613002: Proxy RtcVideoDecoder calls to a media::VideoDecoder.

Created:
4 years, 2 months ago by slan
Modified:
3 years, 4 months ago
Reviewers:
emircan, Pawel Osciak
CC:
chromium-reviews, mlamouri+watch-content_chromium.org, posciak+watch_chromium.org, jam, feature-media-reviews_chromium.org, darin-cc_chromium.org, mcasas+watch+vc_chromium.org, piman+watch_chromium.org, miu+watch_chromium.org, wuchengli
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Proxy RtcVideoDecoder calls to a media::VideoDecoder. RtcVideoDecoder currently talks directly to a VideoDecodeAccelerator, managing all of the state necessary to do hardware decoding with a remote VDA. Instead, it should proxy calls to a media::GpuVideoDecoder, which manages this state properly, simplifying RtcVideoDecoder to be a much- simpler shim class. This allows us to remove a significant amount of brittle, dupliucated code, and prepares for the deprecation of VDA in favor of media::MojoVideoDecoder. BUG=

Patch Set 1 #

Patch Set 2 : Clean-ups #

Total comments: 14

Patch Set 3 : Comments addressed and unittests updated. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+780 lines, -1035 lines) Patch
M content/renderer/media/gpu/rtc_video_decoder.h View 1 2 4 chunks +105 lines, -201 lines 0 comments Download
M content/renderer/media/gpu/rtc_video_decoder.cc View 1 2 8 chunks +364 lines, -659 lines 0 comments Download
M content/renderer/media/gpu/rtc_video_decoder_factory.h View 2 chunks +24 lines, -8 lines 0 comments Download
M content/renderer/media/gpu/rtc_video_decoder_factory.cc View 2 chunks +9 lines, -7 lines 0 comments Download
M content/renderer/media/gpu/rtc_video_decoder_unittest.cc View 1 2 5 chunks +248 lines, -153 lines 0 comments Download
M content/renderer/media/webrtc/peer_connection_dependency_factory.h View 2 chunks +7 lines, -0 lines 0 comments Download
M content/renderer/media/webrtc/peer_connection_dependency_factory.cc View 1 2 5 chunks +21 lines, -4 lines 0 comments Download
M media/BUILD.gn View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M media/filters/fake_video_decoder.cc View 1 2 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 16 (10 generated)
slan
This is ready for the first round of review. This change is the first building ...
4 years, 2 months ago (2016-10-12 20:21:43 UTC) #2
emircan
> Emircan, please add more reviewers as needed. What platforms should I test this > ...
4 years, 2 months ago (2016-10-12 20:32:58 UTC) #6
slan
Friendly ping for review! This patch works well with H264 on Mac. One note for ...
4 years, 2 months ago (2016-10-18 18:58:02 UTC) #7
slan
On 2016/10/18 18:58:02, slan wrote: > Friendly ping for review! This patch works well with ...
4 years, 2 months ago (2016-10-19 22:02:19 UTC) #9
emircan
First pass. Can you run the trybots please? https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/gpu/rtc_video_decoder.cc File content/renderer/media/gpu/rtc_video_decoder.cc (right): https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/gpu/rtc_video_decoder.cc#newcode137 content/renderer/media/gpu/rtc_video_decoder.cc:137: DCHECK(!decoder_task_runner->BelongsToCurrentThread()); ...
4 years, 2 months ago (2016-10-20 17:52:25 UTC) #10
slan
4 years, 1 month ago (2016-10-25 21:25:32 UTC) #11
https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/...
File content/renderer/media/gpu/rtc_video_decoder.cc (right):

https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/...
content/renderer/media/gpu/rtc_video_decoder.cc:137:
DCHECK(!decoder_task_runner->BelongsToCurrentThread());
On 2016/10/20 17:52:25, emircan wrote:
> Additionally, can you add a check to make sure that these methods, that are
not
> on |decoder_task_runner_|, are called in sequence via base::SequenceChecker? 

SequenceChecker can only check one of two things: if calls are made from the
same SequencedTaskRunner, or if calls unassociated to a TaskRunner are run on
the same thread. IFAICT, a SequencedTaskRunner is not used in webrtc to call
this interface, so we are stuck checking if all calls are made on the same
thread.

Create() and Destroy() may be called on any thread, so we don't want to check
them. InitDecode(), Decode(), and RegisterDecodeCompleteCallback() are called on
webrtc's DecodingThread, and Release() is called on
Chrome_libJingle_WorkerThread. 

I added a ThreadChecker on the DecodingThread methods for good measure. Let me
know if this satisfies your concerns.

https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/...
content/renderer/media/gpu/rtc_video_decoder.cc:152: new RTCVideoDecoder(type,
create_video_decoder_cb, decoder_task_runner));
On 2016/10/20 17:52:25, emircan wrote:
> This simplifies things, but does not take into account that we expect to
return
> nullptr here if the codec is not supported. WebRTC falls back to SW
immediately
> for that case.
> 
>
https://cs.chromium.org/chromium/src/third_party/webrtc/media/engine/webrtcvi...

Talked about this offline. We'll do *two* Initialize calls. One now (to query
whether the codec is supported) and one in InitDecode (to initialize the decoder
with the right params). Both of these will block the calling thread.

When media::VideoDecoder adds the ability to do synchronous querying, we will
update the unnecessary call in Create().

https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/...
content/renderer/media/gpu/rtc_video_decoder.cc:184: media::VideoDecoderConfig
config =
On 2016/10/20 17:52:25, emircan wrote:
> const

Done here, and in Create() above.

https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/...
content/renderer/media/gpu/rtc_video_decoder.cc:285: int32_t decoder_buffer_id =
next_decoder_buffer_id_;
On 2016/10/20 17:52:25, emircan wrote:
> const

Done.

https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/...
content/renderer/media/gpu/rtc_video_decoder.cc:489:
base::Bind(&RTCVideoDecoder::OnFrameReady, weak_factory_.GetWeakPtr()));
On 2016/10/20 17:52:25, emircan wrote:
> Use media::BindToCurrentLoop to make sure they are posted on this thread.

OnFrameReady has a DCHECK to ensure that the task is posted to this thread. I
would rather CHECK and break than unnecessarily trampoline the call (all
media::VideoDecoders that I know of callback on the calling thread).

https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/...
File content/renderer/media/gpu/rtc_video_decoder_factory.h (right):

https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/...
content/renderer/media/gpu/rtc_video_decoder_factory.h:42: const
CreateVideoDecoderCB& create_video_decoder_cb,
On 2016/10/20 17:52:25, emircan wrote:
> Can we name this as create_mojo_video_decoder_cb or
> create_video_decoder_client_cb? Currently it sounds like the callback to
create
> the actual decoder implementation in gpu process here:
>
https://cs.chromium.org/chromium/src/media/gpu/gpu_video_decode_accelerator_f...

Using "mojo" in the name would be inaccurate right now, and using "client" would
be misleading (I think "Client" tends to have different implications in Chrome).
What about create_media_video_decoder_cb? I could also beef up the comments
above the type alias.

https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/...
File content/renderer/media/webrtc/peer_connection_dependency_factory.cc
(right):

https://codereview.chromium.org/2418613002/diff/20001/content/renderer/media/...
content/renderer/media/webrtc/peer_connection_dependency_factory.cc:217:
media::GpuVideoAcceleratorFactories* gpu_factories =
On 2016/10/20 17:52:25, emircan wrote:
> media::GpuVideoAcceleratorFactories* const
> Also, const auto below.

Done.

Powered by Google App Engine
This is Rietveld 408576698