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
Родитель 7d7f307148
Коммит 00807e14ef
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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) {