diff --git a/content/media/mediasource/SourceBuffer.cpp b/content/media/mediasource/SourceBuffer.cpp index 57fe1f586470..320e2a6559e1 100644 --- a/content/media/mediasource/SourceBuffer.cpp +++ b/content/media/mediasource/SourceBuffer.cpp @@ -416,8 +416,21 @@ SourceBuffer::Dump(const char* aPath) } #endif -NS_IMPL_CYCLE_COLLECTION_INHERITED(SourceBuffer, DOMEventTargetHelper, - mMediaSource) +NS_IMPL_CYCLE_COLLECTION_CLASS(SourceBuffer) + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(SourceBuffer) + // Tell the TrackBuffer to end its current SourceBufferResource. + TrackBuffer* track = tmp->mTrackBuffer; + if (track) { + track->Detach(); + } + NS_IMPL_CYCLE_COLLECTION_UNLINK(mMediaSource) +NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(DOMEventTargetHelper) + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(SourceBuffer, + DOMEventTargetHelper) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaSource) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_ADDREF_INHERITED(SourceBuffer, DOMEventTargetHelper) NS_IMPL_RELEASE_INHERITED(SourceBuffer, DOMEventTargetHelper) diff --git a/content/media/mediasource/TrackBuffer.cpp b/content/media/mediasource/TrackBuffer.cpp index 6edeb005c069..98f8b4c84a67 100644 --- a/content/media/mediasource/TrackBuffer.cpp +++ b/content/media/mediasource/TrackBuffer.cpp @@ -70,10 +70,6 @@ private: void TrackBuffer::Shutdown() { - // End the SourceBufferResource associated with mCurrentDecoder, which will - // unblock any decoder initialization in ReadMetadata(). - DiscardDecoder(); - // Finish any decoder initialization, which may add to mInitializedDecoders. // Shutdown waits for any pending events, which may require the monitor, // so we must not hold the monitor during this call.