DescriptionMute 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. #
Messages
Total messages: 6 (2 generated)
|