Bug 1228564 - part 1 : revert the changeset of bug 1190040. r=baku.

--HG--
extra : commitid : JZF4VU0qxpg
This commit is contained in:
Alastor Wu 2015-12-24 17:17:30 +08:00
Родитель fe4028261e
Коммит b4cb129af1
12 изменённых файлов: 21 добавлений и 42 удалений

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

@ -41,7 +41,6 @@ AudioChannelAgent::AudioChannelAgent()
: mAudioChannelType(AUDIO_AGENT_CHANNEL_ERROR)
, mInnerWindowID(0)
, mIsRegToService(false)
, mNotifyPlayback(false)
{
}
@ -208,8 +207,7 @@ AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType,
return NS_OK;
}
NS_IMETHODIMP AudioChannelAgent::NotifyStartedPlaying(uint32_t aNotifyPlayback,
float *aVolume,
NS_IMETHODIMP AudioChannelAgent::NotifyStartedPlaying(float *aVolume,
bool* aMuted)
{
MOZ_ASSERT(aVolume);
@ -228,7 +226,7 @@ NS_IMETHODIMP AudioChannelAgent::NotifyStartedPlaying(uint32_t aNotifyPlayback,
return NS_ERROR_FAILURE;
}
service->RegisterAudioChannelAgent(this, aNotifyPlayback,
service->RegisterAudioChannelAgent(this,
static_cast<AudioChannel>(mAudioChannelType));
service->GetState(mWindow, mAudioChannelType, aVolume, aMuted);
@ -237,7 +235,6 @@ NS_IMETHODIMP AudioChannelAgent::NotifyStartedPlaying(uint32_t aNotifyPlayback,
("AudioChannelAgent, NotifyStartedPlaying, this = %p, mute = %d, "
"volume = %f\n", this, *aMuted, *aVolume));
mNotifyPlayback = aNotifyPlayback;
mIsRegToService = true;
return NS_OK;
}
@ -254,7 +251,7 @@ NS_IMETHODIMP AudioChannelAgent::NotifyStoppedPlaying()
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
if (service) {
service->UnregisterAudioChannelAgent(this, mNotifyPlayback);
service->UnregisterAudioChannelAgent(this);
}
mIsRegToService = false;

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

@ -66,7 +66,6 @@ private:
int32_t mAudioChannelType;
uint64_t mInnerWindowID;
bool mIsRegToService;
bool mNotifyPlayback;
};
} // namespace dom

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

@ -268,7 +268,6 @@ AudioChannelService::~AudioChannelService()
void
AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
uint32_t aNotifyPlayback,
AudioChannel aChannel)
{
uint64_t windowID = aAgent->WindowID();
@ -289,8 +288,7 @@ AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
}
// If this is the first agent for this window, we must notify the observers.
if (aNotifyPlayback == nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY &&
winData->mAgents.Length() == 1) {
if (winData->mAgents.Length() == 1) {
RefPtr<MediaPlaybackRunnable> runnable =
new MediaPlaybackRunnable(aAgent->Window(), true /* active */);
NS_DispatchToCurrentThread(runnable);
@ -300,8 +298,7 @@ AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
}
void
AudioChannelService::UnregisterAudioChannelAgent(AudioChannelAgent* aAgent,
uint32_t aNotifyPlayback)
AudioChannelService::UnregisterAudioChannelAgent(AudioChannelAgent* aAgent)
{
AudioChannelWindow* winData = GetWindowData(aAgent->WindowID());
if (!winData) {
@ -333,8 +330,7 @@ AudioChannelService::UnregisterAudioChannelAgent(AudioChannelAgent* aAgent,
#endif
// If this is the last agent for this window, we must notify the observers.
if (aNotifyPlayback == nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY &&
winData->mAgents.IsEmpty()) {
if (winData->mAgents.IsEmpty()) {
RefPtr<MediaPlaybackRunnable> runnable =
new MediaPlaybackRunnable(aAgent->Window(), false /* active */);
NS_DispatchToCurrentThread(runnable);

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

@ -56,15 +56,13 @@ public:
* this service, sharing the AudioChannel.
*/
void RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
uint32_t aNotifyPlayback,
AudioChannel aChannel);
/**
* Any audio channel agent that stops playing should unregister itself to
* this service.
*/
void UnregisterAudioChannelAgent(AudioChannelAgent* aAgent,
uint32_t aNotifyPlayback);
void UnregisterAudioChannelAgent(AudioChannelAgent* aAgent);
/**
* For nested iframes.

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

@ -34,7 +34,7 @@ interface nsIAudioChannelAgentCallback : nsISupports
* 1. Changes to the playable status of this channel.
*/
[uuid(18222148-1b32-463d-b050-b741f43a07ba)]
[uuid(ab7e21c0-970c-11e5-a837-0800200c9a66)]
interface nsIAudioChannelAgent : nsISupports
{
const long AUDIO_AGENT_CHANNEL_NORMAL = 0;
@ -52,9 +52,6 @@ interface nsIAudioChannelAgent : nsISupports
const long AUDIO_AGENT_STATE_MUTED = 1;
const long AUDIO_AGENT_STATE_FADED = 2;
const long AUDIO_AGENT_DONT_NOTIFY = 0;
const long AUDIO_AGENT_NOTIFY = 1;
/**
* Before init() is called, this returns AUDIO_AGENT_CHANNEL_ERROR.
*/
@ -101,10 +98,6 @@ interface nsIAudioChannelAgent : nsISupports
* Note: Gecko component SHOULD call this function first then start to
* play audio stream only when return value is true.
*
* @param notifyPlaying
* Whether to send audio-playback notifications, one of AUDIO_CHANNEL_NOTIFY
* or AUDIO_CHANNEL_DONT_NOTIFY.
*
* @return
* normal state: the agent has registered with audio channel service and
* the component should start playback.
@ -113,7 +106,7 @@ interface nsIAudioChannelAgent : nsISupports
* faded state: the agent has registered with audio channel service the
* component should start playback as well as reducing the volume.
*/
void notifyStartedPlaying(in unsigned long notifyPlayback, out float volume, out bool muted);
void notifyStartedPlaying(out float volume, out bool muted);
/**
* Notify the agent we no longer want to play.

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

@ -1187,8 +1187,7 @@ nsDOMCameraControl::NotifyRecordingStatusChange(const nsString& aMsg)
// Video recording doesn't output any sound, so it's not necessary to check canPlay.
float volume = 0.0;
bool muted = true;
rv = mAudioChannelAgent->NotifyStartedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_DONT_NOTIFY,
&volume, &muted);
rv = mAudioChannelAgent->NotifyStartedPlaying(&volume, &muted);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

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

@ -454,8 +454,7 @@ FMRadio::EnableAudioChannelAgent()
float volume = 0.0;
bool muted = true;
mAudioChannelAgent->NotifyStartedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY,
&volume, &muted);
mAudioChannelAgent->NotifyStartedPlaying(&volume, &muted);
WindowVolumeChanged(volume, muted);
mAudioChannelAgentEnabled = true;

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

@ -4816,6 +4816,11 @@ HTMLMediaElement::UpdateAudioChannelPlayingState()
void
HTMLMediaElement::NotifyAudioChannelAgent(bool aPlaying)
{
// Don't do anything if this element doesn't have any audio tracks.
if (!HasAudio()) {
return;
}
// Immediately check if this should go to the MSG instead of the normal
// media playback route.
WindowAudioCaptureChanged();
@ -4826,13 +4831,9 @@ HTMLMediaElement::NotifyAudioChannelAgent(bool aPlaying)
AutoNoJSAPI nojsapi;
if (aPlaying) {
// Don't notify playback if this element doesn't have any audio tracks.
uint32_t notify = HasAudio() ? nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY :
nsIAudioChannelAgent::AUDIO_AGENT_DONT_NOTIFY;
float volume = 0.0;
bool muted = true;
mAudioChannelAgent->NotifyStartedPlaying(notify, &volume, &muted);
mAudioChannelAgent->NotifyStartedPlaying(&volume, &muted);
WindowVolumeChanged(volume, muted);
} else {
mAudioChannelAgent->NotifyStoppedPlaying();

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

@ -746,8 +746,7 @@ AudioDestinationNode::InputMuted(bool aMuted)
float volume = 0.0;
bool muted = true;
nsresult rv = mAudioChannelAgent->NotifyStartedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY,
&volume, &muted);
nsresult rv = mAudioChannelAgent->NotifyStartedPlaying(&volume, &muted);
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}

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

@ -696,7 +696,7 @@ nsSpeechTask::CreateAudioChannelAgent()
this);
float volume = 0.0f;
bool muted = true;
mAudioChannelAgent->NotifyStartedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY, &volume, &muted);
mAudioChannelAgent->NotifyStartedPlaying(&volume, &muted);
}
void

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

@ -2296,8 +2296,7 @@ _setvalue(NPP npp, NPPVariable variable, void *result)
} else {
float volume = 0.0;
bool muted = true;
rv = agent->NotifyStartedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY,
&volume, &muted);
rv = agent->NotifyStartedPlaying(&volume, &muted);
if (NS_WARN_IF(NS_FAILED(rv))) {
return NPERR_NO_ERROR;
}

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

@ -562,8 +562,7 @@ Telephony::HandleAudioAgentState()
mIsAudioStartPlaying = true;
float volume;
bool muted;
rv = mAudioAgent->NotifyStartedPlaying(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY,
&volume, &muted);
rv = mAudioAgent->NotifyStartedPlaying(&volume, &muted);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}