From dfc33dc92b16cc0c3fea601e204c24f5cc76fab7 Mon Sep 17 00:00:00 2001 From: Randy Lin Date: Fri, 26 Jul 2013 20:29:41 +0800 Subject: [PATCH] Bug 896353 - Media Recording - Can't record the mediaStream created by AudioContext. r=roc --- content/media/MediaRecorder.cpp | 6 ++++-- content/media/MediaRecorder.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/content/media/MediaRecorder.cpp b/content/media/MediaRecorder.cpp index f4a31b217a54..aad4f297824d 100644 --- a/content/media/MediaRecorder.cpp +++ b/content/media/MediaRecorder.cpp @@ -115,6 +115,9 @@ private: MediaRecorder::~MediaRecorder() { + if (mStreamPort) { + mStreamPort->Destroy(); + } if (mTrackUnionStream) { mTrackUnionStream->Destroy(); } @@ -192,8 +195,7 @@ MediaRecorder::Start(const Optional& aTimeSlice, ErrorResult& aResult) MOZ_ASSERT(mEncoder, "CreateEncoder failed"); mTrackUnionStream->SetAutofinish(true); - nsRefPtr port = - mTrackUnionStream->AllocateInputPort(mStream->GetStream(), MediaInputPort::FLAG_BLOCK_OUTPUT); + mStreamPort = mTrackUnionStream->AllocateInputPort(mStream->GetStream(), MediaInputPort::FLAG_BLOCK_OUTPUT); if (mEncoder) { mTrackUnionStream->AddListener(mEncoder); diff --git a/content/media/MediaRecorder.h b/content/media/MediaRecorder.h index 85350ae33f76..0a5e14217d86 100644 --- a/content/media/MediaRecorder.h +++ b/content/media/MediaRecorder.h @@ -110,6 +110,8 @@ protected: nsRefPtr mStream; // This media stream is used for notifying raw data to encoder and can be blocked. nsRefPtr mTrackUnionStream; + // This is used for destroing the inputport when destroy the mediaRecorder + nsRefPtr mStreamPort; // This object creates on start() and destroys in ~MediaRecorder. nsAutoPtr mEncodedBufferCache; // It specifies the container format as well as the audio and video capture formats.