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

Issue 1671603002: Mute audio for Spitzer playbacks that haven't received focus yet. (Closed)

Created:
4 years, 10 months ago by DaleCurtis
Modified:
4 years, 9 months ago
CC:
avayvod+watch_chromium.org, chromium-reviews, darin-cc_chromium.org, feature-media-reviews_chromium.org, jam, mcasas+watch_chromium.org, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org, mlamouri+watch-media_chromium.org, posciak+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mute audio for Spitzer playbacks that haven't received focus yet. Android expects clients to not start playing audio until a focus request has been approved by the OS; very rarely this request will be denied (~0.5% according to UMA). Blocking playback startup on a hop to the UI thread would be unfortunate and slow, so instead mute playback until approval is granted. If approval is denied the player will be paused soon after, but during that tiny window some amount of audio can play out, thus the need to mute. This is done by always setting a volume multiplier of zero when a delegate observer is registered and when it is paused. A subsequent playback attempt will request focus and send the right volume multiplier to the player, which will likely have already started a silent playback in that time. The new behavior is codified in a couple of existing tests as well as some new ones in MediaSessionBrowserTest -- which I took some time to cleanup as well (mixing friend class + for_testing() is frowned upon). BUG=529887 TEST=new tests, hammering the play button plays no audio.

Patch Set 1 : Fix comment. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+98 lines, -55 lines) Patch
M content/browser/media/android/media_session.h View 2 chunks +4 lines, -8 lines 0 comments Download
M content/browser/media/android/media_session.cc View 5 chunks +20 lines, -40 lines 0 comments Download
M content/browser/media/android/media_session_browsertest.cc View 4 chunks +53 lines, -6 lines 0 comments Download
M content/browser/media/android/media_session_controller_unittest.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M content/renderer/media/renderer_webmediaplayer_delegate.h View 1 chunk +7 lines, -0 lines 0 comments Download
M content/renderer/media/renderer_webmediaplayer_delegate.cc View 3 chunks +12 lines, -1 line 0 comments Download

Messages

Total messages: 6 (2 generated)
DaleCurtis
Hey Mounir here's the idea I mentioned last time. I think it's much cleaner and ...
4 years, 10 months ago (2016-02-04 22:24:00 UTC) #3
DaleCurtis
Mounir, ping?
4 years, 10 months ago (2016-02-10 17:43:51 UTC) #4
mlamouri (slow - plz ping)
This is a bit larger of a change than I was expecting. It might be ...
4 years, 10 months ago (2016-02-16 17:08:52 UTC) #5
DaleCurtis
4 years, 10 months ago (2016-02-16 19:55:39 UTC) #6
Yeah ~70 of 98 lines are test cleanup :)

It won't be an issue if IPCs are working at a reasonable speed. I tested with
some gaming SFX clips I use for short sound testing: http://xorax.sea/gaming/
and approval comes way before the sound even starts. Rejection also comes before
current time even moves.

Powered by Google App Engine
This is Rietveld 408576698