Bug 1302350 - part3 : provide a method to know the media-block-state before connecting to the AudioChannelService
In order to refactor the blocking mechanism, we want to know the blocking state
before calling notifyStartedPlaying().
MozReview-Commit-ID: 3wa2M7qwUAm
--- a/dom/audiochannel/AudioChannelAgent.cpp
+++ b/dom/audiochannel/AudioChannelAgent.cpp
@@ -356,8 +356,14 @@ AudioChannelAgent::WindowAudioCaptureCha
}
bool
AudioChannelAgent::IsPlayingStarted() const
{
return mIsRegToService;
}
+bool
+AudioChannelAgent::ShouldBlockMedia() const
+{
+ return mWindow ?
+ mWindow->GetMediaSuspend() == nsISuspendedTypes::SUSPENDED_BLOCK : false;
+}
--- a/dom/audiochannel/AudioChannelAgent.h
+++ b/dom/audiochannel/AudioChannelAgent.h
@@ -44,16 +44,17 @@ public:
{
return mWindow;
}
uint64_t WindowID() const;
uint64_t InnerWindowID() const;
bool IsPlayingStarted() const;
+ bool ShouldBlockMedia() const;
private:
virtual ~AudioChannelAgent();
AudioPlaybackConfig GetMediaConfig();
bool IsDisposableSuspend(nsSuspendedTypes aSuspend) const;
// Returns mCallback if that's non-null, or otherwise tries to get an