bug 1132328 remove mCurrentDecoder handling from RemoveDecoder() r=jya a=lmandel
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 12 Feb 2015 15:57:40 +1300
changeset 249932 bdbae3abf53fe90ad953ce5c4249a8baca1d1949
parent 249931 6595ccb73af6f15b4bf15f62df9618c915013f3f
child 249933 2580e92051c630c7d7f387e859e43975f2ccaee8
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, lmandel
bugs1132328
milestone37.0a2
bug 1132328 remove mCurrentDecoder handling from RemoveDecoder() r=jya a=lmandel
dom/media/mediasource/TrackBuffer.cpp
dom/media/mediasource/TrackBuffer.h
--- a/dom/media/mediasource/TrackBuffer.cpp
+++ b/dom/media/mediasource/TrackBuffer.cpp
@@ -820,52 +820,46 @@ TrackBuffer::Dump(const char* aPath)
 
     mDecoders[i]->GetResource()->Dump(buf);
   }
 }
 #endif
 
 class ReleaseDecoderTask : public nsRunnable {
 public:
-  ReleaseDecoderTask(SourceBufferDecoder* aDecoder, TrackBuffer* aTrackBuffer)
+  ReleaseDecoderTask(SourceBufferDecoder* aDecoder)
     : mDecoder(aDecoder)
-    , mTrackBuffer(aTrackBuffer)
   {
   }
 
   NS_IMETHOD Run() MOZ_OVERRIDE MOZ_FINAL {
-    if (mTrackBuffer->mCurrentDecoder == mDecoder) {
-      mTrackBuffer->DiscardCurrentDecoder();
-    }
-
     mDecoder->GetReader()->BreakCycles();
     mDecoder = nullptr;
     return NS_OK;
   }
 
 private:
   nsRefPtr<SourceBufferDecoder> mDecoder;
-  nsRefPtr<TrackBuffer> mTrackBuffer;
 };
 
 class DelayedDispatchToMainThread : public nsRunnable {
 public:
   DelayedDispatchToMainThread(SourceBufferDecoder* aDecoder, TrackBuffer* aTrackBuffer)
     : mDecoder(aDecoder)
     , mTrackBuffer(aTrackBuffer)
   {
   }
 
   NS_IMETHOD Run() MOZ_OVERRIDE MOZ_FINAL {
     // Shutdown the reader, and remove its reference to the decoder
     // so that it can't accidentally read it after the decoder
     // is destroyed.
     mDecoder->GetReader()->Shutdown();
     mDecoder->GetReader()->ClearDecoder();
-    RefPtr<nsIRunnable> task = new ReleaseDecoderTask(mDecoder, mTrackBuffer);
+    RefPtr<nsIRunnable> task = new ReleaseDecoderTask(mDecoder);
     mDecoder = nullptr;
     // task now holds the only ref to the decoder.
     NS_DispatchToMainThread(task);
     return NS_OK;
   }
 
 private:
   nsRefPtr<SourceBufferDecoder> mDecoder;
--- a/dom/media/mediasource/TrackBuffer.h
+++ b/dom/media/mediasource/TrackBuffer.h
@@ -109,17 +109,16 @@ public:
 #endif
 
 #if defined(DEBUG)
   void Dump(const char* aPath);
 #endif
 
 private:
   friend class DecodersToInitialize;
-  friend class ReleaseDecoderTask;
   ~TrackBuffer();
 
   // Create a new decoder, set mCurrentDecoder to the new decoder and
   // returns it. The new decoder must be queued using QueueInitializeDecoder
   // for initialization.
   // The decoder is not considered initialized until it is added to
   // mInitializedDecoders.
   already_AddRefed<SourceBufferDecoder> NewDecoder(int64_t aTimestampOffset /* microseconds */);