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

Issue 2710133003: Replace FFmpegDemuxer thread per element with base::TaskScheduler. (Closed)

Created:
3 years, 10 months ago by DaleCurtis
Modified:
3 years, 9 months ago
Reviewers:
halliwell, gab, xhwang
CC:
chromium-reviews, feature-media-reviews_chromium.org, posciak+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Replace FFmpegDemuxer thread per element with base::TaskScheduler. I don't think we need to keep starting a thread per <audio> or <video> element anymore. Instead we can use a shared pool that only spins up a new thread when needed. This change switches FFmpegDemuxer from creating its own thread to using base::TaskScheduler for executing blocking network reads. The TaskScheduler API is perfectly suited for our use case and required little changes. Doing this required some changes to our BlockingUrlProtocol to make it safe to access after FFmpegDemuxer and potentially the DataSource have been destroyed. This should reduce the number of out of threads crashes we see on a fairly regular basis. BUG=61293 TEST=existing tests all pass, no slowdown noticed on pages like gfycat.com Review-Url: https://codereview.chromium.org/2710133003 Cr-Original-Commit-Position: refs/heads/master@{#453470} Committed: https://chromium.googlesource.com/chromium/src/+/5384b9fe1cf67869e1bf98ab8ff6bd21ae4216da Review-Url: https://codereview.chromium.org/2710133003 Cr-Commit-Position: refs/heads/master@{#454452} Committed: https://chromium.googlesource.com/chromium/src/+/f4a6dbf44108f1855faf5a78d4fb06c349ebd70d

Patch Set 1 #

Total comments: 1

Patch Set 2 : Use base::TaskScheduler. #

Total comments: 12

Patch Set 3 : Comments. Fix flaky test. #

Total comments: 19

Patch Set 4 : Fix comments. #

Patch Set 5 : Fix gn check. #

Patch Set 6 : Fix chromecast build. #

Total comments: 4

Patch Set 7 : Address all comments. #

Patch Set 8 : Give ffmpeg unittests time to release glue. #

Patch Set 9 : Give WeakPtr to URLProtocol. #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+163 lines, -162 lines) Patch
M chromecast/media/cma/backend/audio_video_pipeline_device_unittest.cc View 1 2 3 4 5 6 25 chunks +4 lines, -41 lines 0 comments Download
M media/base/demuxer_perftest.cc View 1 2 3 4 5 6 4 chunks +22 lines, -24 lines 0 comments Download
M media/filters/blocking_url_protocol.h View 1 2 3 3 chunks +12 lines, -5 lines 0 comments Download
M media/filters/blocking_url_protocol.cc View 4 chunks +30 lines, -18 lines 0 comments Download
M media/filters/blocking_url_protocol_unittest.cc View 1 2 3 4 5 6 5 chunks +34 lines, -30 lines 0 comments Download
M media/filters/ffmpeg_demuxer.h View 1 2 3 2 chunks +9 lines, -3 lines 0 comments Download
M media/filters/ffmpeg_demuxer.cc View 1 2 3 4 5 6 7 8 16 chunks +37 lines, -32 lines 3 comments Download
M media/filters/ffmpeg_demuxer_unittest.cc View 1 2 3 4 5 6 7 5 chunks +7 lines, -4 lines 0 comments Download
M media/test/BUILD.gn View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M media/test/pipeline_integration_test.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -5 lines 0 comments Download
M media/test/pipeline_integration_test_base.h View 1 2 3 4 5 6 2 chunks +4 lines, -0 lines 0 comments Download
M media/test/pipeline_integration_test_base.cc View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 61 (31 generated)
DaleCurtis
This is still early, but all tests pass (% some mock issues in BlockingUrlProtocol) so ...
3 years, 10 months ago (2017-02-23 03:00:18 UTC) #2
gab
On 2017/02/23 03:00:18, DaleCurtis wrote: > This is still early, but all tests pass (% ...
3 years, 10 months ago (2017-02-23 20:08:57 UTC) #3
DaleCurtis
On 2017/02/23 at 20:08:57, gab wrote: > On 2017/02/23 03:00:18, DaleCurtis wrote: > > This ...
3 years, 10 months ago (2017-02-23 20:10:52 UTC) #4
DaleCurtis
Actually that was super easy. PTAL! Thanks for the cool API. I still need to ...
3 years, 10 months ago (2017-02-23 20:27:25 UTC) #6
gab
Woohoo :) https://codereview.chromium.org/2710133003/diff/20001/media/base/run_all_perftests.cc File media/base/run_all_perftests.cc (right): https://codereview.chromium.org/2710133003/diff/20001/media/base/run_all_perftests.cc#newcode29 media/base/run_all_perftests.cc:29: base::TaskScheduler::CreateAndSetSimpleTaskScheduler(1); For tests see base::test::ScopedTaskScheduler, also you ...
3 years, 10 months ago (2017-02-23 21:37:10 UTC) #7
gab
PS: which process is this running in?
3 years, 10 months ago (2017-02-23 21:37:31 UTC) #8
DaleCurtis
Thanks, going through feedback now. This is in the renderer process.
3 years, 10 months ago (2017-02-23 22:14:12 UTC) #9
DaleCurtis
https://codereview.chromium.org/2710133003/diff/20001/media/base/run_all_perftests.cc File media/base/run_all_perftests.cc (right): https://codereview.chromium.org/2710133003/diff/20001/media/base/run_all_perftests.cc#newcode29 media/base/run_all_perftests.cc:29: base::TaskScheduler::CreateAndSetSimpleTaskScheduler(1); On 2017/02/23 at 21:37:09, gab wrote: > For ...
3 years, 10 months ago (2017-02-23 23:07:06 UTC) #10
xhwang
Cool, do I get it correct that the newly created SequencedTaskRunner will handle threading and ...
3 years, 10 months ago (2017-02-23 23:45:42 UTC) #11
gab
On 2017/02/23 23:45:42, xhwang_slow wrote: > Cool, do I get it correct that the newly ...
3 years, 10 months ago (2017-02-24 01:09:06 UTC) #12
DaleCurtis
https://codereview.chromium.org/2710133003/diff/40001/media/base/demuxer_perftest.cc File media/base/demuxer_perftest.cc (right): https://codereview.chromium.org/2710133003/diff/40001/media/base/demuxer_perftest.cc#newcode199 media/base/demuxer_perftest.cc:199: base::Bind(&QuitLoopWithStatus, &message_loop), On 2017/02/24 at 01:09:05, gab wrote: > ...
3 years, 10 months ago (2017-02-24 23:40:29 UTC) #13
DaleCurtis
+halliwell for chromecast/ change.
3 years, 10 months ago (2017-02-25 01:22:27 UTC) #24
xhwang
lgtm
3 years, 10 months ago (2017-02-25 01:25:39 UTC) #25
halliwell
On 2017/02/25 01:25:39, xhwang_slow wrote: > lgtm lgtm
3 years, 10 months ago (2017-02-25 01:42:50 UTC) #26
gab
TaskScheduler usage lgtm w/ comments, thanks! https://codereview.chromium.org/2710133003/diff/40001/media/test/pipeline_integration_test_base.h File media/test/pipeline_integration_test_base.h (right): https://codereview.chromium.org/2710133003/diff/40001/media/test/pipeline_integration_test_base.h#newcode137 media/test/pipeline_integration_test_base.h:137: std::unique_ptr<base::test::ScopedTaskScheduler> task_scheduler_; On ...
3 years, 9 months ago (2017-02-26 18:01:35 UTC) #31
DaleCurtis
halliwell: PTAL - gab@'s last request required significant changes to the unittest. https://codereview.chromium.org/2710133003/diff/40001/media/test/pipeline_integration_test_base.h File media/test/pipeline_integration_test_base.h ...
3 years, 9 months ago (2017-02-27 21:26:30 UTC) #32
halliwell
On 2017/02/27 21:26:30, DaleCurtis wrote: > halliwell: PTAL - gab@'s last request required significant changes ...
3 years, 9 months ago (2017-02-27 21:29:21 UTC) #35
DaleCurtis
Thanks!
3 years, 9 months ago (2017-02-27 21:31:25 UTC) #39
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/2710133003/120001
3 years, 9 months ago (2017-02-27 21:31:52 UTC) #40
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_asan_rel_ng/builds/319145)
3 years, 9 months ago (2017-02-28 00:04:08 UTC) #43
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/2710133003/140001
3 years, 9 months ago (2017-02-28 00:09:37 UTC) #46
commit-bot: I haz the power
Committed patchset #8 (id:140001) as https://chromium.googlesource.com/chromium/src/+/5384b9fe1cf67869e1bf98ab8ff6bd21ae4216da
3 years, 9 months ago (2017-02-28 02:35:14 UTC) #49
dvadym
A revert of this CL (patchset #8 id:140001) has been created in https://codereview.chromium.org/2719883005/ by dvadym@chromium.org. ...
3 years, 9 months ago (2017-02-28 10:13:18 UTC) #50
DaleCurtis
On 2017/02/28 at 10:13:18, dvadym wrote: > A revert of this CL (patchset #8 id:140001) ...
3 years, 9 months ago (2017-02-28 16:46:16 UTC) #51
DaleCurtis
Okay, issue resolved, the problem was a base::Unretained() by the blocking pool, it should have ...
3 years, 9 months ago (2017-03-02 22:01:01 UTC) #52
xhwang
lg % nit https://codereview.chromium.org/2710133003/diff/160001/media/filters/ffmpeg_demuxer.cc File media/filters/ffmpeg_demuxer.cc (right): https://codereview.chromium.org/2710133003/diff/160001/media/filters/ffmpeg_demuxer.cc#newcode901 media/filters/ffmpeg_demuxer.cc:901: &FFmpegDemuxer::OnDataSourceError, weak_this_)))); We have mixed use ...
3 years, 9 months ago (2017-03-02 22:05:01 UTC) #53
DaleCurtis
https://codereview.chromium.org/2710133003/diff/160001/media/filters/ffmpeg_demuxer.cc File media/filters/ffmpeg_demuxer.cc (right): https://codereview.chromium.org/2710133003/diff/160001/media/filters/ffmpeg_demuxer.cc#newcode901 media/filters/ffmpeg_demuxer.cc:901: &FFmpegDemuxer::OnDataSourceError, weak_this_)))); On 2017/03/02 at 22:05:01, xhwang_slow wrote: > ...
3 years, 9 months ago (2017-03-02 22:48:53 UTC) #55
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/2710133003/160001
3 years, 9 months ago (2017-03-02 22:49:34 UTC) #57
xhwang
lgtm https://codereview.chromium.org/2710133003/diff/160001/media/filters/ffmpeg_demuxer.cc File media/filters/ffmpeg_demuxer.cc (right): https://codereview.chromium.org/2710133003/diff/160001/media/filters/ffmpeg_demuxer.cc#newcode901 media/filters/ffmpeg_demuxer.cc:901: &FFmpegDemuxer::OnDataSourceError, weak_this_)))); On 2017/03/02 22:48:53, DaleCurtis wrote: > ...
3 years, 9 months ago (2017-03-02 23:07:13 UTC) #58
commit-bot: I haz the power
3 years, 9 months ago (2017-03-03 00:28:31 UTC) #61
Message was sent while issue was closed.
Committed patchset #9 (id:160001) as
https://chromium.googlesource.com/chromium/src/+/f4a6dbf44108f1855faf5a78d4fb...

Powered by Google App Engine
This is Rietveld 408576698