From 4276cea1b03fedf19b4f21cc4e6adc54b72045dc Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Tue, 28 Oct 2014 13:21:13 +1300 Subject: [PATCH] Bug 1071482 - Break a cycle in TrackBuffer and SourceBufferDecoder's MediaTaskQueue's SharedThreadPool. r=cajbir --- dom/media/mediasource/SourceBufferDecoder.h | 12 ++++++++++++ dom/media/mediasource/TrackBuffer.cpp | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dom/media/mediasource/SourceBufferDecoder.h b/dom/media/mediasource/SourceBufferDecoder.h index b064c2aaddec..fb272162be9a 100644 --- a/dom/media/mediasource/SourceBufferDecoder.h +++ b/dom/media/mediasource/SourceBufferDecoder.h @@ -84,6 +84,18 @@ public: mTaskQueue = aTaskQueue; } + void BreakCycles() + { + if (mReader) { + mReader->BreakCycles(); + mReader = nullptr; + } + mTaskQueue = nullptr; +#ifdef MOZ_EME + mCDMProxy = nullptr; +#endif + } + #ifdef MOZ_EME virtual nsresult SetCDMProxy(CDMProxy* aProxy) { diff --git a/dom/media/mediasource/TrackBuffer.cpp b/dom/media/mediasource/TrackBuffer.cpp index 98f8b4c84a67..f8e2a40fa425 100644 --- a/dom/media/mediasource/TrackBuffer.cpp +++ b/dom/media/mediasource/TrackBuffer.cpp @@ -391,7 +391,7 @@ TrackBuffer::BreakCycles() MOZ_ASSERT(NS_IsMainThread()); for (uint32_t i = 0; i < mDecoders.Length(); ++i) { - mDecoders[i]->GetReader()->BreakCycles(); + mDecoders[i]->BreakCycles(); } mDecoders.Clear();