Bug 876133. Ensure output audio volume is updated when 'volume' attribute is set on media element. r=cpearce

--HG--
extra : rebase_source : defbb7d13b70349d321006db37f005888fb6a79e
This commit is contained in:
Robert O'Callahan 2013-05-27 17:13:05 +12:00
parent b3f9ceb38a
commit 94905a3054
2 changed files with 11 additions and 1 deletions

View File

@ -796,6 +796,11 @@ protected:
* Mute or unmute the audio and change the value that the |muted| map.
*/
void SetMutedInternal(uint32_t aMuted);
/**
* Update the volume of the output audio stream to match the element's
* current mMuted/mVolume state.
*/
void SetVolumeInternal();
/**
* Suspend (if aPauseForInactiveDocument) or resume element playback and

View File

@ -1509,7 +1509,7 @@ HTMLMediaElement::SetVolume(double aVolume, ErrorResult& aRv)
mVolume = aVolume;
// Here we want just to update the volume.
SetMutedInternal(mMuted);
SetVolumeInternal();
DispatchAsyncEvent(NS_LITERAL_STRING("volumechange"));
}
@ -1687,6 +1687,11 @@ void HTMLMediaElement::SetMutedInternal(uint32_t aMuted)
return;
}
SetVolumeInternal();
}
void HTMLMediaElement::SetVolumeInternal()
{
float effectiveVolume = mMuted ? 0.0f : float(mVolume);
if (mDecoder) {