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

Issue 2529263004: Move passing of WebRTC rendering frames to IO thread (Closed)

Created:
4 years ago by emircan
Modified:
4 years ago
CC:
avayvod+watch_chromium.org, chromium-reviews, darin-cc_chromium.org, feature-media-reviews_chromium.org, imcheng+watch_chromium.org, isheriff+watch_chromium.org, jam, jasonroberts+watch_google.com, mcasas+watch+vc_chromium.org, miu+watch_chromium.org, mlamouri+watch-content_chromium.org, posciak+watch_chromium.org, xjz+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Move passing of WebRTC rendering frames to IO thread This is follow-up for CL[0] that moved passing of WebRTC rendering frames off of main thread. That CL caused a regression in test[1] where the number of unique frames encoded is less, suggesting that we are dropping frames. Traces showed that compositor thread may be blocked by long texture upload calls and frames get accumulated in the meantime. We might be dropping frames due to the limit of having only 3 frames in flight. This CL addresses this issue by moving these calls to IO thread directly. In order to do it: - FrameDeliverer classes in MediaStreamVideoRendererSink and WebMediaPlayerMS are moved to IO thread. - WebMediaPlayerMSCompositor::EnqueueFrame gets called on IO thread. - Since WebMediaPlayerMSCompositor operates on three threads, I made it a ref counted object. This way, we do not need to create multiple WeakPtr factories or synchronize/block destruction on multiple threads. [0] https://codereview.chromium.org/2472273002/ [1] crbug.com/667262 BUG=667262, 652923 TEST=Tested running JS alert() in console during an AppRTC loopback. Committed: https://crrev.com/8f71ad428b65fc259b48c2a0917158a762a5e5f6 Cr-Commit-Position: refs/heads/master@{#437594}

Patch Set 1 : #

Total comments: 9

Patch Set 2 : Move to IO thread. #

Total comments: 2

Patch Set 3 : qiangchen@ comment #

Total comments: 2

Patch Set 4 : Fix unittests. #

Total comments: 2

Patch Set 5 : ncarter@ comment. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+173 lines, -205 lines) Patch
M content/public/renderer/media_stream_renderer_factory.h View 1 1 chunk +3 lines, -3 lines 0 comments Download
M content/renderer/media/media_stream_renderer_factory_impl.h View 1 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/media/media_stream_renderer_factory_impl.cc View 1 2 chunks +4 lines, -4 lines 0 comments Download
M content/renderer/media/media_stream_video_renderer_sink.h View 1 2 chunks +2 lines, -6 lines 0 comments Download
M content/renderer/media/media_stream_video_renderer_sink.cc View 1 2 3 4 16 chunks +28 lines, -74 lines 0 comments Download
M content/renderer/media/media_stream_video_renderer_sink_unittest.cc View 1 2 3 4 6 chunks +16 lines, -13 lines 0 comments Download
M content/renderer/media/webmediaplayer_ms.h View 1 3 3 chunks +7 lines, -8 lines 0 comments Download
M content/renderer/media/webmediaplayer_ms.cc View 1 2 3 13 chunks +32 lines, -37 lines 0 comments Download
M content/renderer/media/webmediaplayer_ms_compositor.h View 1 2 5 chunks +14 lines, -9 lines 0 comments Download
M content/renderer/media/webmediaplayer_ms_compositor.cc View 1 6 chunks +51 lines, -37 lines 0 comments Download
M content/renderer/media/webmediaplayer_ms_unittest.cc View 1 3 chunks +3 lines, -2 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M content/shell/renderer/layout_test/test_media_stream_renderer_factory.h View 1 1 chunk +1 line, -1 line 0 comments Download
M content/shell/renderer/layout_test/test_media_stream_renderer_factory.cc View 1 2 3 2 chunks +3 lines, -4 lines 0 comments Download
M content/shell/renderer/layout_test/test_media_stream_video_renderer.h View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
M content/shell/renderer/layout_test/test_media_stream_video_renderer.cc View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 92 (64 generated)
emircan
PTAL.
4 years ago (2016-12-02 23:39:52 UTC) #20
DaleCurtis
https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms.h File content/renderer/media/webmediaplayer_ms.h (right): https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms.h#newcode223 content/renderer/media/webmediaplayer_ms.h:223: scoped_refptr<WebMediaPlayerMSCompositor> compositor_; Can we avoid this?
4 years ago (2016-12-03 01:17:54 UTC) #23
emircan
https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms.h File content/renderer/media/webmediaplayer_ms.h (right): https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms.h#newcode223 content/renderer/media/webmediaplayer_ms.h:223: scoped_refptr<WebMediaPlayerMSCompositor> compositor_; On 2016/12/03 01:17:54, DaleCurtis wrote: > Can ...
4 years ago (2016-12-03 01:42:13 UTC) #26
qiangchen
I think we've talked about using IO thread injecting frames. What's the reason you still ...
4 years ago (2016-12-05 16:51:58 UTC) #27
emircan
On 2016/12/05 16:51:58, qiangchen wrote: > I think we've talked about using IO thread injecting ...
4 years ago (2016-12-05 18:24:18 UTC) #28
qiangchen
Some minor suggestions. https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms_compositor.cc File content/renderer/media/webmediaplayer_ms_compositor.cc (right): https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms_compositor.cc#newcode415 content/renderer/media/webmediaplayer_ms_compositor.cc:415: void WebMediaPlayerMSCompositor::StartRenderingInternal() { I think it ...
4 years ago (2016-12-05 18:54:57 UTC) #29
DaleCurtis
Is it really that expensive to run this on the IO thread? The compositor thread ...
4 years ago (2016-12-05 19:05:35 UTC) #30
emircan
On 2016/12/05 19:05:35, DaleCurtis wrote: > Is it really that expensive to run this on ...
4 years ago (2016-12-05 20:45:57 UTC) #31
DaleCurtis
Media thread is fine, but I wonder if just keeping everything on the IO thread ...
4 years ago (2016-12-05 21:00:29 UTC) #32
emircan
On 2016/12/05 21:00:29, DaleCurtis wrote: > Media thread is fine, but I wonder if just ...
4 years ago (2016-12-05 21:42:41 UTC) #33
DaleCurtis
On 2016/12/05 at 21:42:41, emircan wrote: > On 2016/12/05 21:00:29, DaleCurtis wrote: > > Media ...
4 years ago (2016-12-05 22:15:50 UTC) #34
emircan
After offline discussion, I ran a trace to see how long these tasks take on ...
4 years ago (2016-12-06 00:36:44 UTC) #37
DaleCurtis
https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms.h File content/renderer/media/webmediaplayer_ms.h (right): https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms.h#newcode223 content/renderer/media/webmediaplayer_ms.h:223: scoped_refptr<WebMediaPlayerMSCompositor> compositor_; On 2016/12/03 at 01:42:13, emircan wrote: > ...
4 years ago (2016-12-06 01:00:42 UTC) #40
qiangchen
https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms_compositor.cc File content/renderer/media/webmediaplayer_ms_compositor.cc (right): https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms_compositor.cc#newcode415 content/renderer/media/webmediaplayer_ms_compositor.cc:415: void WebMediaPlayerMSCompositor::StartRenderingInternal() { On 2016/12/05 18:54:57, qiangchen wrote: > ...
4 years ago (2016-12-06 17:48:17 UTC) #43
emircan
https://codereview.chromium.org/2529263004/diff/140001/content/renderer/media/webmediaplayer_ms_compositor.h File content/renderer/media/webmediaplayer_ms_compositor.h (right): https://codereview.chromium.org/2529263004/diff/140001/content/renderer/media/webmediaplayer_ms_compositor.h#newcode159 content/renderer/media/webmediaplayer_ms_compositor.h:159: bool provider_in_use_; On 2016/12/06 17:48:17, qiangchen wrote: > Remove ...
4 years ago (2016-12-06 19:38:27 UTC) #46
emircan
On 2016/12/06 01:00:42, DaleCurtis wrote: > https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms.h > File content/renderer/media/webmediaplayer_ms.h (right): > > https://codereview.chromium.org/2529263004/diff/120001/content/renderer/media/webmediaplayer_ms.h#newcode223 > ...
4 years ago (2016-12-06 19:38:59 UTC) #47
DaleCurtis
lgtm, though I'm always sad to see more scoped_refptr
4 years ago (2016-12-06 21:43:26 UTC) #50
qiangchen
A question about the newly added override function. https://codereview.chromium.org/2529263004/diff/160001/content/renderer/media/webmediaplayer_ms.h File content/renderer/media/webmediaplayer_ms.h (right): https://codereview.chromium.org/2529263004/diff/160001/content/renderer/media/webmediaplayer_ms.h#newcode160 content/renderer/media/webmediaplayer_ms.h:160: bool ...
4 years ago (2016-12-07 17:44:13 UTC) #51
emircan
https://codereview.chromium.org/2529263004/diff/160001/content/renderer/media/webmediaplayer_ms.h File content/renderer/media/webmediaplayer_ms.h (right): https://codereview.chromium.org/2529263004/diff/160001/content/renderer/media/webmediaplayer_ms.h#newcode160 content/renderer/media/webmediaplayer_ms.h:160: bool texImageImpl(TexImageFunctionID functionID, On 2016/12/07 17:44:13, qiangchen wrote: > ...
4 years ago (2016-12-07 18:10:05 UTC) #52
qiangchen
lgtm
4 years ago (2016-12-07 18:21:23 UTC) #53
emircan
mcasas@chromium.org: Please review changes in content/renderer/media/* avi@chromium.org: Please review changes in content/public/renderer/*, content/renderer/* and content/shell/renderer/*
4 years ago (2016-12-07 18:26:58 UTC) #57
mcasas
On 2016/12/07 18:26:58, emircan wrote: > mailto:mcasas@chromium.org: Please review changes in content/renderer/media/* > > mailto:avi@chromium.org: ...
4 years ago (2016-12-08 19:00:47 UTC) #70
emircan
It looks like avi@ is OOO. nick@chromium.org: Can you please review changes in content/public/renderer/*, content/renderer/* ...
4 years ago (2016-12-08 21:50:18 UTC) #73
ncarter (slow)
lgtm https://codereview.chromium.org/2529263004/diff/220001/content/renderer/media/media_stream_video_renderer_sink.cc File content/renderer/media/media_stream_video_renderer_sink.cc (right): https://codereview.chromium.org/2529263004/diff/220001/content/renderer/media/media_stream_video_renderer_sink.cc#newcode259 content/renderer/media/media_stream_video_renderer_sink.cc:259: io_task_runner_->PostTaskAndReply(FROM_HERE, base::Bind([] {}), This doesn't belong in the ...
4 years ago (2016-12-08 22:43:44 UTC) #74
emircan
Thanks. https://codereview.chromium.org/2529263004/diff/220001/content/renderer/media/media_stream_video_renderer_sink.cc File content/renderer/media/media_stream_video_renderer_sink.cc (right): https://codereview.chromium.org/2529263004/diff/220001/content/renderer/media/media_stream_video_renderer_sink.cc#newcode259 content/renderer/media/media_stream_video_renderer_sink.cc:259: io_task_runner_->PostTaskAndReply(FROM_HERE, base::Bind([] {}), On 2016/12/08 22:43:44, ncarter wrote: ...
4 years ago (2016-12-08 23:26:50 UTC) #77
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/2529263004/240001
4 years ago (2016-12-09 18:13:47 UTC) #87
commit-bot: I haz the power
Committed patchset #5 (id:240001)
4 years ago (2016-12-09 18:45:02 UTC) #90
commit-bot: I haz the power
4 years ago (2016-12-12 14:36:29 UTC) #92
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/8f71ad428b65fc259b48c2a0917158a762a5e5f6
Cr-Commit-Position: refs/heads/master@{#437594}

Powered by Google App Engine
This is Rietveld 408576698