Bug 1302350 - part2 : provide a method to check whether the agent was started. r=baku

Since the agent is created in beginning in patch1, we need another way to know
whether we have already called notifyStartedPlaying().

MozReview-Commit-ID: 5YNhwEl5Xfp
This commit is contained in:
Alastor Wu
2016-11-01 17:46:09 +08:00
parent 5d226762d6
commit 03e0ef5d80
3 changed files with 17 additions and 5 deletions

View File

@@ -6430,7 +6430,9 @@ HTMLMediaElement::SetAudibleState(bool aAudible)
void
HTMLMediaElement::NotifyAudioPlaybackChanged(AudibleChangedReasons aReason)
{
if (!mAudioChannelAgent) {
MOZ_ASSERT(mAudioChannelAgent);
if (!mAudioChannelAgent->IsPlayingStarted()) {
return;
}
@@ -6554,16 +6556,17 @@ HTMLMediaElement::SetMediaInfo(const MediaInfo& aInfo)
void
HTMLMediaElement::AudioCaptureStreamChangeIfNeeded()
{
// Window audio capturing only happens after creating audio channel agent.
if (!mAudioChannelAgent) {
return;
}
MOZ_ASSERT(mAudioChannelAgent);
// No need to capture a silence media element.
if (!HasAudio()) {
return;
}
if (!mAudioChannelAgent->IsPlayingStarted()) {
return;
}
if (mAudioCapturedByWindow && !mCaptureStreamPort) {
nsCOMPtr<nsPIDOMWindowInner> window = OwnerDoc()->GetInnerWindow();
if (!OwnerDoc()->GetInnerWindow()) {