Backed out changeset c17987dfa969 (bug 1129882)

This commit is contained in:
Carsten "Tomcat" Book 2015-07-24 16:30:31 +02:00
Родитель 7cdb62ba5f
Коммит 1225980bea
6 изменённых файлов: 5 добавлений и 33 удалений

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

@ -2055,8 +2055,7 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
mPlayingThroughTheAudioChannel(false), mPlayingThroughTheAudioChannel(false),
mDisableVideo(false), mDisableVideo(false),
mPlayBlockedBecauseHidden(false), mPlayBlockedBecauseHidden(false),
mElementInTreeState(ELEMENT_NOT_INTREE), mElementInTreeState(ELEMENT_NOT_INTREE)
mHaveDispatchedInterruptBeginEvent(false)
{ {
if (!gMediaElementLog) { if (!gMediaElementLog) {
gMediaElementLog = PR_NewLogModule("nsMediaElement"); gMediaElementLog = PR_NewLogModule("nsMediaElement");
@ -4452,12 +4451,10 @@ nsresult HTMLMediaElement::UpdateChannelMuteState(float aVolume, bool aMuted)
SetMutedInternal(mMuted | MUTED_BY_AUDIO_CHANNEL); SetMutedInternal(mMuted | MUTED_BY_AUDIO_CHANNEL);
if (UseAudioChannelAPI()) { if (UseAudioChannelAPI()) {
DispatchAsyncEvent(NS_LITERAL_STRING("mozinterruptbegin")); DispatchAsyncEvent(NS_LITERAL_STRING("mozinterruptbegin"));
mHaveDispatchedInterruptBeginEvent = true;
} }
} else if (!aMuted && ComputedMuted()) { } else if (!aMuted && ComputedMuted()) {
SetMutedInternal(mMuted & ~MUTED_BY_AUDIO_CHANNEL); SetMutedInternal(mMuted & ~MUTED_BY_AUDIO_CHANNEL);
if (UseAudioChannelAPI() && mHaveDispatchedInterruptBeginEvent) { if (UseAudioChannelAPI()) {
mHaveDispatchedInterruptBeginEvent = false;
DispatchAsyncEvent(NS_LITERAL_STRING("mozinterruptend")); DispatchAsyncEvent(NS_LITERAL_STRING("mozinterruptend"));
} }
} }

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

@ -1414,8 +1414,6 @@ protected:
ElementInTreeState mElementInTreeState; ElementInTreeState mElementInTreeState;
bool mHaveDispatchedInterruptBeginEvent;
public: public:
// Helper class to measure times for MSE telemetry stats // Helper class to measure times for MSE telemetry stats
class TimeDurationAccumulator { class TimeDurationAccumulator {

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

@ -326,7 +326,6 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
, mExtraCurrentTime(0) , mExtraCurrentTime(0)
, mExtraCurrentTimeSinceLastStartedBlocking(0) , mExtraCurrentTimeSinceLastStartedBlocking(0)
, mExtraCurrentTimeUpdatedSinceLastStableState(false) , mExtraCurrentTimeUpdatedSinceLastStableState(false)
, mHaveDispatchedInterruptBeginEvent(false)
{ {
bool startWithAudioDriver = true; bool startWithAudioDriver = true;
MediaStreamGraph* graph = aIsOffline ? MediaStreamGraph* graph = aIsOffline ?
@ -495,12 +494,10 @@ AudioDestinationNode::WindowVolumeChanged(float aVolume, bool aMuted)
if (aMuted != mAudioChannelAgentPlaying) { if (aMuted != mAudioChannelAgentPlaying) {
mAudioChannelAgentPlaying = aMuted; mAudioChannelAgentPlaying = aMuted;
if (UseAudioChannelAPI() && if (UseAudioChannelAPI()) {
(mHaveDispatchedInterruptBeginEvent || aMuted)) {
Context()->DispatchTrustedEvent( Context()->DispatchTrustedEvent(
!aMuted ? NS_LITERAL_STRING("mozinterruptend") !aMuted ? NS_LITERAL_STRING("mozinterruptend")
: NS_LITERAL_STRING("mozinterruptbegin")); : NS_LITERAL_STRING("mozinterruptbegin"));
mHaveDispatchedInterruptBeginEvent = aMuted;
} }
} }

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

@ -111,7 +111,6 @@ private:
double mExtraCurrentTime; double mExtraCurrentTime;
double mExtraCurrentTimeSinceLastStartedBlocking; double mExtraCurrentTimeSinceLastStartedBlocking;
bool mExtraCurrentTimeUpdatedSinceLastStableState; bool mExtraCurrentTimeUpdatedSinceLastStableState;
bool mHaveDispatchedInterruptBeginEvent;
}; };
} // namespace dom } // namespace dom

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

@ -21,7 +21,7 @@
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "AudioChannelService.h" #include "AudioChannelAgent.h"
#include "CallsList.h" #include "CallsList.h"
#include "TelephonyCall.h" #include "TelephonyCall.h"
#include "TelephonyCallGroup.h" #include "TelephonyCallGroup.h"
@ -65,8 +65,7 @@ public:
Telephony::Telephony(nsPIDOMWindow* aOwner) Telephony::Telephony(nsPIDOMWindow* aOwner)
: DOMEventTargetHelper(aOwner), : DOMEventTargetHelper(aOwner),
mIsAudioStartPlaying(false), mIsAudioStartPlaying(false)
mHaveDispatchedInterruptBeginEvent(false)
{ {
MOZ_ASSERT(aOwner); MOZ_ASSERT(aOwner);
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aOwner); nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aOwner);
@ -77,7 +76,6 @@ Telephony::Telephony(nsPIDOMWindow* aOwner)
MOZ_ASSERT(!rv.Failed()); MOZ_ASSERT(!rv.Failed());
mReadyPromise = promise; mReadyPromise = promise;
mMuted = AudioChannelService::IsAudioChannelMutedByDefault();
} }
Telephony::~Telephony() Telephony::~Telephony()
@ -682,21 +680,6 @@ Telephony::WindowVolumeChanged(float aVolume, bool aMuted)
return rv.StealNSResult(); return rv.StealNSResult();
} }
// These events will be triggered when the telephony is interrupted by other
// audio channel.
if (mMuted != aMuted) {
mMuted = aMuted;
// We should not dispatch "mozinterruptend" when the system app initializes
// the telephony audio from muted to unmuted at the first time. The event
// "mozinterruptend" must be dispatched after the "mozinterruptbegin".
if (!mHaveDispatchedInterruptBeginEvent && mMuted) {
DispatchTrustedEvent(NS_LITERAL_STRING("mozinterruptbegin"));
mHaveDispatchedInterruptBeginEvent = mMuted;
} else if (mHaveDispatchedInterruptBeginEvent && !mMuted) {
DispatchTrustedEvent(NS_LITERAL_STRING("mozinterruptend"));
mHaveDispatchedInterruptBeginEvent = mMuted;
}
}
return NS_OK; return NS_OK;
} }

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

@ -59,8 +59,6 @@ class Telephony final : public DOMEventTargetHelper,
nsRefPtr<Promise> mReadyPromise; nsRefPtr<Promise> mReadyPromise;
bool mIsAudioStartPlaying; bool mIsAudioStartPlaying;
bool mHaveDispatchedInterruptBeginEvent;
bool mMuted;
public: public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED