mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 1129882 - only send mozinterrupt when interrupt happens. r=baku.
This commit is contained in:
parent
9401ab6f5a
commit
2b0990fe9b
@ -2025,7 +2025,8 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
|
||||
mAutoplaying(true),
|
||||
mAutoplayEnabled(true),
|
||||
mPaused(true),
|
||||
mMuted(0),
|
||||
mMuted(AudioChannelService::IsAudioChannelMutedByDefault()
|
||||
? MUTED_BY_AUDIO_CHANNEL : 0),
|
||||
mStatsShowing(false),
|
||||
mAllowCasting(false),
|
||||
mIsCasting(false),
|
||||
@ -4447,18 +4448,20 @@ nsresult HTMLMediaElement::UpdateChannelMuteState(float aVolume, bool aMuted)
|
||||
SetVolumeInternal();
|
||||
}
|
||||
|
||||
// We have to mute this channel.
|
||||
if (aMuted && !ComputedMuted()) {
|
||||
SetMutedInternal(mMuted | MUTED_BY_AUDIO_CHANNEL);
|
||||
if (UseAudioChannelAPI()) {
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("mozinterruptbegin"));
|
||||
mHaveDispatchedInterruptBeginEvent = true;
|
||||
}
|
||||
} else if (!aMuted && ComputedMuted()) {
|
||||
SetMutedInternal(mMuted & ~MUTED_BY_AUDIO_CHANNEL);
|
||||
if (UseAudioChannelAPI() && mHaveDispatchedInterruptBeginEvent) {
|
||||
mHaveDispatchedInterruptBeginEvent = false;
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("mozinterruptend"));
|
||||
if (aMuted != ComputedMuted()) {
|
||||
// We have to mute this channel.
|
||||
if (aMuted && !ComputedMuted()) {
|
||||
SetMutedInternal(mMuted | MUTED_BY_AUDIO_CHANNEL);
|
||||
if (UseAudioChannelAPI() && !mHaveDispatchedInterruptBeginEvent) {
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("mozinterruptbegin"));
|
||||
mHaveDispatchedInterruptBeginEvent = true;
|
||||
}
|
||||
} else if (!aMuted && ComputedMuted()) {
|
||||
SetMutedInternal(mMuted & ~MUTED_BY_AUDIO_CHANNEL);
|
||||
if (UseAudioChannelAPI() && mHaveDispatchedInterruptBeginEvent) {
|
||||
mHaveDispatchedInterruptBeginEvent = false;
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("mozinterruptend"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
|
||||
, mFramesToProduce(aLength)
|
||||
, mAudioChannel(AudioChannel::Normal)
|
||||
, mIsOffline(aIsOffline)
|
||||
, mAudioChannelAgentPlaying(false)
|
||||
, mAudioChannelAgentMuted(AudioChannelService::IsAudioChannelMutedByDefault())
|
||||
, mExtraCurrentTime(0)
|
||||
, mExtraCurrentTimeSinceLastStartedBlocking(0)
|
||||
, mExtraCurrentTimeUpdatedSinceLastStableState(false)
|
||||
@ -492,8 +492,8 @@ AudioDestinationNode::SetCanPlay(float aVolume, bool aMuted)
|
||||
NS_IMETHODIMP
|
||||
AudioDestinationNode::WindowVolumeChanged(float aVolume, bool aMuted)
|
||||
{
|
||||
if (aMuted != mAudioChannelAgentPlaying) {
|
||||
mAudioChannelAgentPlaying = aMuted;
|
||||
if (aMuted != mAudioChannelAgentMuted) {
|
||||
mAudioChannelAgentMuted = aMuted;
|
||||
|
||||
if (UseAudioChannelAPI() &&
|
||||
(mHaveDispatchedInterruptBeginEvent || aMuted)) {
|
||||
|
@ -105,7 +105,7 @@ private:
|
||||
// Audio Channel Type.
|
||||
AudioChannel mAudioChannel;
|
||||
bool mIsOffline;
|
||||
bool mAudioChannelAgentPlaying;
|
||||
bool mAudioChannelAgentMuted;
|
||||
|
||||
TimeStamp mStartedBlockingDueToBeingOnlyNode;
|
||||
double mExtraCurrentTime;
|
||||
|
Loading…
Reference in New Issue
Block a user