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

Issue 1812543003: Allow muting/unmuting audio through media track API (Closed)

Created:
4 years, 9 months ago by servolk
Modified:
4 years, 8 months ago
Reviewers:
xhwang, wolenetz
CC:
chromium-reviews, feature-media-reviews_chromium.org, xhwang, perkj_chrome
Base URL:
https://chromium.googlesource.com/chromium/src.git@blink-sb-tracks6
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Allow muting/unmuting audio through media track API This CL implements muting/unmuting audio via HTML5 media track APIs. More specifically it adds basic plumbing to deliver media track state changes from blink level to media::Renderer, by translating blink track ids into DemuxerStream pointers in demuxer and then delivering DemuxerStream state information to media renderers. For now audio stream is disabled by setting volume to 0, but this can be done more efficiently in the future. BUG=249427 Committed: https://crrev.com/06e3a9ffca065ed73c1cd9e5d72f7ca2ee44f488 Cr-Commit-Position: refs/heads/master@{#387789}

Patch Set 1 #

Patch Set 2 : buildfixes #

Patch Set 3 : Implemented basic audio track control (enable/disable) #

Patch Set 4 : Refactoring to make ffmpeg path work too #

Patch Set 5 : Nits #

Patch Set 6 : rebase #

Patch Set 7 : rebase #

Patch Set 8 : Proper handling of AV tracks when blink runtime feature is disabled #

Patch Set 9 : Pass enabledAudioStreams by reference #

Patch Set 10 : Rebase #

Patch Set 11 : Added an integration test for muting/unmuting audio #

Patch Set 12 : rebase #

Patch Set 13 : rebase #

Patch Set 14 : rebase #

Patch Set 15 : rebase #

Patch Set 16 : rebase #

Patch Set 17 : rebase #

Total comments: 22

Patch Set 18 : CR feedback #

Patch Set 19 : Added some TODOs + ensure that setting volume doesn't unmute disabled audio #

Patch Set 20 : rebase #

Patch Set 21 : fixed logging #

Patch Set 22 : Improved track id mapping to demuxer streams #

Patch Set 23 : rebase #

Patch Set 24 : rebase #

Patch Set 25 : rebase #

Patch Set 26 : rebase #

Patch Set 27 : rebase #

Patch Set 28 : Added VideoTrackSelectDeselect test case #

Total comments: 13

Patch Set 29 : CR feedback #

Patch Set 30 : rebase #

Patch Set 31 : Don't call DemuxStream::type from the wrong thread #

Total comments: 25

Patch Set 32 : CR feedback #

Patch Set 33 : Add <vector> in renderer.h #

Patch Set 34 : Small cleanup + updated comments #

Patch Set 35 : Fixed issues that caused test failures #

Total comments: 14

Patch Set 36 : CR feedback #

Total comments: 1

Patch Set 37 : Added TODOs #

Patch Set 38 : Avoid ChunkDemuxer/PipelineImpl deadlock #

Unified diffs Side-by-side diffs Delta from patch set Stats (+505 lines, -63 lines) Patch
M media/base/demuxer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +13 lines, -1 line 0 comments Download
M media/base/media_tracks.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 2 chunks +31 lines, -10 lines 0 comments Download
M media/base/media_tracks.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 1 chunk +46 lines, -10 lines 0 comments Download
M media/base/mock_filters.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +5 lines, -0 lines 0 comments Download
M media/base/pipeline.h View 1 2 3 4 5 6 7 8 21 22 2 chunks +10 lines, -0 lines 0 comments Download
M media/base/pipeline_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 21 22 1 chunk +4 lines, -0 lines 0 comments Download
M media/base/pipeline_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 21 22 1 chunk +30 lines, -0 lines 0 comments Download
M media/base/renderer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 3 chunks +19 lines, -0 lines 0 comments Download
M media/blink/webmediaplayer_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +7 lines, -0 lines 0 comments Download
M media/blink/webmediaplayer_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 5 chunks +45 lines, -2 lines 0 comments Download
M media/blink/websourcebuffer_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +2 lines, -0 lines 0 comments Download
M media/filters/chunk_demuxer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 4 chunks +14 lines, -2 lines 0 comments Download
M media/filters/chunk_demuxer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 3 chunks +35 lines, -10 lines 0 comments Download
M media/filters/chunk_demuxer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 5 chunks +26 lines, -0 lines 0 comments Download
M media/filters/ffmpeg_demuxer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 4 chunks +13 lines, -0 lines 0 comments Download
M media/filters/ffmpeg_demuxer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2 chunks +19 lines, -4 lines 0 comments Download
M media/filters/media_source_state.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 2 chunks +2 lines, -3 lines 0 comments Download
M media/filters/media_source_state.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 5 chunks +34 lines, -7 lines 0 comments Download
M media/renderers/renderer_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2 chunks +7 lines, -0 lines 0 comments Download
M media/renderers/renderer_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 2 chunks +56 lines, -2 lines 0 comments Download
M media/test/pipeline_integration_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 5 chunks +75 lines, -7 lines 0 comments Download
M media/test/pipeline_integration_test_base.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +12 lines, -5 lines 0 comments Download

Messages

Total messages: 50 (13 generated)
servolk
4 years, 9 months ago (2016-03-22 19:07:01 UTC) #4
wolenetz
On 2016/03/22 19:07:01, servolk wrote: I'll get to this CR Monday. Of note, the title ...
4 years, 9 months ago (2016-03-25 23:01:08 UTC) #6
wolenetz
Looking pretty good. I think my biggest concern is over ownership of MediaTrack* and its ...
4 years, 8 months ago (2016-03-30 00:31:32 UTC) #7
servolk
https://codereview.chromium.org/1812543003/diff/320001/media/base/demuxer.h File media/base/demuxer.h (right): https://codereview.chromium.org/1812543003/diff/320001/media/base/demuxer.h#newcode70 media/base/demuxer.h:70: // (e.g. the inital stream metadata has been parsed ...
4 years, 8 months ago (2016-03-30 01:13:13 UTC) #8
servolk
https://codereview.chromium.org/1812543003/diff/320001/media/renderers/renderer_impl.cc File media/renderers/renderer_impl.cc (right): https://codereview.chromium.org/1812543003/diff/320001/media/renderers/renderer_impl.cc#newcode208 media/renderers/renderer_impl.cc:208: audio_volume_ = volume; On 2016/03/30 00:31:32, wolenetz wrote: > ...
4 years, 8 months ago (2016-03-30 01:29:49 UTC) #9
wolenetz
https://codereview.chromium.org/1812543003/diff/320001/media/renderers/renderer_impl.cc File media/renderers/renderer_impl.cc (right): https://codereview.chromium.org/1812543003/diff/320001/media/renderers/renderer_impl.cc#newcode208 media/renderers/renderer_impl.cc:208: audio_volume_ = volume; On 2016/03/30 01:29:49, servolk wrote: > ...
4 years, 8 months ago (2016-03-30 20:08:11 UTC) #10
wolenetz
Please also take a look at the bot failure on your (not yet in CR) ...
4 years, 8 months ago (2016-03-30 20:12:25 UTC) #11
wolenetz
Also: https://codereview.chromium.org/1812543003/diff/320001/media/filters/chunk_demuxer.h File media/filters/chunk_demuxer.h (right): https://codereview.chromium.org/1812543003/diff/320001/media/filters/chunk_demuxer.h#newcode212 media/filters/chunk_demuxer.h:212: // If |track| is null the association for ...
4 years, 8 months ago (2016-03-30 20:15:55 UTC) #12
servolk
On 2016/03/30 20:08:11, wolenetz wrote: > https://codereview.chromium.org/1812543003/diff/320001/media/renderers/renderer_impl.cc > File media/renderers/renderer_impl.cc (right): > > https://codereview.chromium.org/1812543003/diff/320001/media/renderers/renderer_impl.cc#newcode208 > ...
4 years, 8 months ago (2016-03-31 23:40:13 UTC) #14
servolk
On 2016/03/30 20:15:55, wolenetz wrote: > Also: > > https://codereview.chromium.org/1812543003/diff/320001/media/filters/chunk_demuxer.h > File media/filters/chunk_demuxer.h (right): > ...
4 years, 8 months ago (2016-03-31 23:42:16 UTC) #15
servolk
On 2016/03/31 23:42:16, servolk wrote: > On 2016/03/30 20:15:55, wolenetz wrote: > > Also: > ...
4 years, 8 months ago (2016-04-06 21:01:37 UTC) #16
wolenetz
On 2016/04/06 21:01:37, servolk wrote: > On 2016/03/31 23:42:16, servolk wrote: > > On 2016/03/30 ...
4 years, 8 months ago (2016-04-08 22:43:28 UTC) #17
wolenetz
On 2016/04/06 21:01:37, servolk wrote: > On 2016/03/31 23:42:16, servolk wrote: > > On 2016/03/30 ...
4 years, 8 months ago (2016-04-08 22:56:40 UTC) #18
wolenetz
On 2016/04/08 22:56:40, wolenetz wrote: > On 2016/04/06 21:01:37, servolk wrote: > > On 2016/03/31 ...
4 years, 8 months ago (2016-04-08 22:57:19 UTC) #19
wolenetz
partial CR comments. more will be forthcoming ASAP, though might be Monday morning as I'm ...
4 years, 8 months ago (2016-04-08 23:32:31 UTC) #20
servolk
https://codereview.chromium.org/1812543003/diff/530001/media/base/demuxer.h File media/base/demuxer.h (right): https://codereview.chromium.org/1812543003/diff/530001/media/base/demuxer.h#newcode137 media/base/demuxer.h:137: // Notifies the demuxer that track ids has been ...
4 years, 8 months ago (2016-04-08 23:47:20 UTC) #21
servolk
On 2016/04/08 23:47:20, servolk wrote: > https://codereview.chromium.org/1812543003/diff/530001/media/base/demuxer.h > File media/base/demuxer.h (right): > > https://codereview.chromium.org/1812543003/diff/530001/media/base/demuxer.h#newcode137 > ...
4 years, 8 months ago (2016-04-12 17:22:58 UTC) #22
wolenetz
On 2016/04/12 17:22:58, servolk wrote: > On 2016/04/08 23:47:20, servolk wrote: > > https://codereview.chromium.org/1812543003/diff/530001/media/base/demuxer.h > ...
4 years, 8 months ago (2016-04-12 23:09:51 UTC) #23
wolenetz
Looking pretty good. I'd really encourage unifying the track map maintenance into its own class, ...
4 years, 8 months ago (2016-04-14 20:43:39 UTC) #24
wolenetz
+xhwang@ for realz...
4 years, 8 months ago (2016-04-14 20:44:41 UTC) #26
wolenetz
Also: https://codereview.chromium.org/1812543003/diff/590001/media/test/pipeline_integration_test.cc File media/test/pipeline_integration_test.cc (right): https://codereview.chromium.org/1812543003/diff/590001/media/test/pipeline_integration_test.cc#newcode2160 media/test/pipeline_integration_test.cc:2160: // TODO(servolk): Find a way to verify that ...
4 years, 8 months ago (2016-04-14 22:44:12 UTC) #27
servolk
https://codereview.chromium.org/1812543003/diff/530001/media/base/media_tracks.h File media/base/media_tracks.h (right): https://codereview.chromium.org/1812543003/diff/530001/media/base/media_tracks.h#newcode50 media/base/media_tracks.h:50: void set_track_to_demux_stream_map(const TrackToDemuxStreamMap& m); On 2016/04/14 20:43:39, wolenetz wrote: ...
4 years, 8 months ago (2016-04-15 02:23:25 UTC) #28
servolk
https://codereview.chromium.org/1812543003/diff/530001/media/base/media_tracks.h File media/base/media_tracks.h (right): https://codereview.chromium.org/1812543003/diff/530001/media/base/media_tracks.h#newcode50 media/base/media_tracks.h:50: void set_track_to_demux_stream_map(const TrackToDemuxStreamMap& m); On 2016/04/15 02:23:24, servolk wrote: ...
4 years, 8 months ago (2016-04-15 02:33:00 UTC) #29
servolk
On 2016/04/15 02:33:00, servolk wrote: > https://codereview.chromium.org/1812543003/diff/530001/media/base/media_tracks.h > File media/base/media_tracks.h (right): > > https://codereview.chromium.org/1812543003/diff/530001/media/base/media_tracks.h#newcode50 > ...
4 years, 8 months ago (2016-04-15 02:36:18 UTC) #30
wolenetz
On 2016/04/15 02:36:18, servolk wrote: > On 2016/04/15 02:33:00, servolk wrote: > > > https://codereview.chromium.org/1812543003/diff/530001/media/base/media_tracks.h ...
4 years, 8 months ago (2016-04-15 22:44:04 UTC) #31
wolenetz
Thanks for the refactor of the map manipulation into MediaTracks. How feasible might it be ...
4 years, 8 months ago (2016-04-15 22:47:18 UTC) #33
servolk
https://codereview.chromium.org/1812543003/diff/590001/media/renderers/renderer_impl.cc File media/renderers/renderer_impl.cc (right): https://codereview.chromium.org/1812543003/diff/590001/media/renderers/renderer_impl.cc#newcode246 media/renderers/renderer_impl.cc:246: audio_stream_enabled = true; On 2016/04/15 22:47:18, wolenetz wrote: > ...
4 years, 8 months ago (2016-04-15 23:26:31 UTC) #34
servolk
On 2016/04/15 22:47:18, wolenetz wrote: > Thanks for the refactor of the map manipulation into ...
4 years, 8 months ago (2016-04-15 23:32:27 UTC) #35
wolenetz
On 2016/04/15 23:32:27, servolk wrote: > On 2016/04/15 22:47:18, wolenetz wrote: > > Thanks for ...
4 years, 8 months ago (2016-04-15 23:50:11 UTC) #36
wolenetz
lgtm % TODO below (crbug for mojo, et al, renderer not to use default streamschanged ...
4 years, 8 months ago (2016-04-15 23:52:17 UTC) #37
servolk
On 2016/04/15 23:52:17, wolenetz wrote: > lgtm % TODO below (crbug for mojo, et al, ...
4 years, 8 months ago (2016-04-16 00:09:57 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1812543003/710001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1812543003/710001
4 years, 8 months ago (2016-04-16 00:10:47 UTC) #41
commit-bot: I haz the power
Committed patchset #37 (id:710001)
4 years, 8 months ago (2016-04-16 02:20:21 UTC) #43
commit-bot: I haz the power
Patchset 37 (id:??) landed as https://crrev.com/06e3a9ffca065ed73c1cd9e5d72f7ca2ee44f488 Cr-Commit-Position: refs/heads/master@{#387789}
4 years, 8 months ago (2016-04-16 02:21:31 UTC) #45
perkj_chrome
A revert of this CL (patchset #37 id:710001) has been created in https://codereview.chromium.org/1894073002/ by perkj@chromium.org. ...
4 years, 8 months ago (2016-04-18 09:37:01 UTC) #46
xhwang
I discussed with servolk@ offline. For now we will still only support one audio and ...
4 years, 8 months ago (2016-04-18 17:49:32 UTC) #48
servolk
4 years, 8 months ago (2016-04-19 17:28:10 UTC) #50
Message was sent while issue was closed.
On 2016/04/18 09:37:01, perkj_chrome wrote:
> A revert of this CL (patchset #37 id:710001) has been created in
> https://codereview.chromium.org/1894073002/ by mailto:perkj@chromium.org.
> 
> The reason for reverting is: Tentative revert since it looks like it cause
flake
> on 
> 
>
http/tests/media/media-source/mediasource-config-change-webm-av-audio-bitrate.html.

Indeed, this CL has introduced some kind of issue, so thanks perkj@ for catching
this and reverting. I've spent quite a bit of time debugging and trying to
understand what's going on here, and I believe I understand it now. It's a race
condition that might cause occasional deadlock on MSE playback startup.
Here is what's going on:
1. At the beginning of MSE playback there is usually a lot of buffering
activity, which means that we spent significant amounts of time in
ChunkDemuxer::AppendData holding ChunkDemuxer::lock_. If the data being appended
at some point exceeds the currently known stream duration, FrameProcessor
invokes ChunkDemuxer::IncreaseDurationIfNecessary ->
ChunkDemuxer::UpdateDuration -> PipelineImpl::SetDuration, which waits to
acquire PipelineImpl::lock_.
2. Now this CL introduced another thing that happens at the beginning of media
playback - PipelineImpl::OnEnabledAudioStreamsChanged and
PipelineImpl::OnSelectedVideoStreamChanged. Those methods hold
PipelineImpl::lock_ while invoking corresponding methods in RendererImpl. Then
RendererImpl methods would call demuxer_->GetStream. Which in case of
ChunkDemuxer would need to acquire ChunkDemuxer::lock_.

So now if timing is right we might get a deadlock, where ChunkDemuxer::lock_ is
acquired by ChunkDemuxer::AppendData in #1 above, but PipelineImpl::lock_ is not
yet acquired. Then #2 happens, acquires PipelineImpl::lock_ and gets stuck
waiting forever for ChunkDemuxer::lock_.
I can think of a couple of way to fix this. The safest way seems to avoid
calling demuxer_->GetStream in RendererImpl (we don't really need them and only
use the stream pointers to do some sanity checks.

But now that this CL is reverted anyway, and after discussing this with xhwang@
I think I can also look into what it would take to rework this CL using the
Demuxer config change approach. If it works out, it might be a better long term
solution. If not, I'll just fix the deadlock as described above and will re-land
this CL.

Powered by Google App Engine
This is Rietveld 408576698