mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1235612 - Part 2: Notify audible state in NotifyStartedPlaying. r=baku
MozReview-Commit-ID: B1u8FYaX5wd --HG-- extra : rebase_source : 73db1d40298be67945aa630412b46d49710f7502
This commit is contained in:
parent
56716374de
commit
12d3b72c2e
@ -202,7 +202,8 @@ AudioChannelAgent::InitInternal(nsPIDOMWindowInner* aWindow,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AudioChannelAgent::NotifyStartedPlaying(AudioPlaybackConfig* aConfig)
|
||||
AudioChannelAgent::NotifyStartedPlaying(AudioPlaybackConfig* aConfig,
|
||||
bool aAudible)
|
||||
{
|
||||
if (NS_WARN_IF(!aConfig)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -214,7 +215,10 @@ AudioChannelAgent::NotifyStartedPlaying(AudioPlaybackConfig* aConfig)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
service->RegisterAudioChannelAgent(this);
|
||||
MOZ_ASSERT(AudioChannelService::AudibleState::eAudible == true &&
|
||||
AudioChannelService::AudibleState::eNotAudible == false);
|
||||
service->RegisterAudioChannelAgent(this,
|
||||
static_cast<AudioChannelService::AudibleState>(aAudible));
|
||||
|
||||
AudioPlaybackConfig config = service->GetMediaConfig(mWindow,
|
||||
mAudioChannelType);
|
||||
|
@ -248,7 +248,8 @@ AudioChannelService::~AudioChannelService()
|
||||
}
|
||||
|
||||
void
|
||||
AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent)
|
||||
AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
|
||||
AudibleState aAudible)
|
||||
{
|
||||
MOZ_ASSERT(aAgent);
|
||||
|
||||
@ -263,7 +264,7 @@ AudioChannelService::RegisterAudioChannelAgent(AudioChannelAgent* aAgent)
|
||||
// callback function of AudioChannelAgentOwner that means the agent might be
|
||||
// released in their callback.
|
||||
RefPtr<AudioChannelAgent> kungFuDeathGrip(aAgent);
|
||||
winData->AppendAgent(aAgent);
|
||||
winData->AppendAgent(aAgent, aAudible);
|
||||
|
||||
MaybeSendStatusUpdate();
|
||||
}
|
||||
@ -1001,13 +1002,14 @@ AudioChannelService::IsAudioChannelMutedByDefault()
|
||||
}
|
||||
|
||||
void
|
||||
AudioChannelService::AudioChannelWindow::AppendAgent(AudioChannelAgent* aAgent)
|
||||
AudioChannelService::AudioChannelWindow::AppendAgent(AudioChannelAgent* aAgent,
|
||||
AudibleState aAudible)
|
||||
{
|
||||
MOZ_ASSERT(aAgent);
|
||||
|
||||
AppendAgentAndIncreaseAgentsNum(aAgent);
|
||||
AudioCapturedChanged(aAgent, AudioCaptureState::eCapturing);
|
||||
// Audio-playback would be notified when the agent owner starts audible.
|
||||
AudioAudibleChanged(aAgent, aAudible);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -93,7 +93,8 @@ public:
|
||||
* Any audio channel agent that starts playing should register itself to
|
||||
* this service, sharing the AudioChannel.
|
||||
*/
|
||||
void RegisterAudioChannelAgent(AudioChannelAgent* aAgent);
|
||||
void RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
|
||||
AudibleState aAudible);
|
||||
|
||||
/**
|
||||
* Any audio channel agent that stops playing should unregister itself to
|
||||
@ -244,7 +245,7 @@ private:
|
||||
|
||||
void AudioAudibleChanged(AudioChannelAgent* aAgent, AudibleState aAudible);
|
||||
|
||||
void AppendAgent(AudioChannelAgent* aAgent);
|
||||
void AppendAgent(AudioChannelAgent* aAgent, AudibleState aAudible);
|
||||
void RemoveAgent(AudioChannelAgent* aAgent);
|
||||
|
||||
uint64_t mWindowID;
|
||||
|
@ -163,7 +163,7 @@ interface nsIAudioChannelAgent : nsISupports
|
||||
* @param config
|
||||
* It contains the playback related states (volume/mute/suspend)
|
||||
*/
|
||||
void notifyStartedPlaying(in AudioPlaybackConfig config);
|
||||
void notifyStartedPlaying(in AudioPlaybackConfig config, in bool audible);
|
||||
|
||||
/**
|
||||
* Notify the agent we no longer want to play.
|
||||
|
Loading…
Reference in New Issue
Block a user