Bug 1065855 - Ignore updating check when setting MediaSource Duration within a SourceBuffer append - r=kinetik
authorChris Double <chris.double@double.co.nz>
Tue, 16 Sep 2014 15:15:55 +1200
changeset 205585 b742dd3aece6ef902f9f47b0192611b8d4fe4231
parent 205584 7cb9cd1191769b83e40f2f499a68dc50e825b008
child 205586 97e08c477d63e4fdc7265320e2540c3984dc90bc
push id27498
push userkwierso@gmail.com
push dateWed, 17 Sep 2014 00:06:56 +0000
treeherdermozilla-central@8252eae8278c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1065855
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1065855 - Ignore updating check when setting MediaSource Duration within a SourceBuffer append - r=kinetik
content/media/mediasource/MediaSource.h
content/media/mediasource/MediaSourceDecoder.cpp
--- a/content/media/mediasource/MediaSource.h
+++ b/content/media/mediasource/MediaSource.h
@@ -100,16 +100,20 @@ public:
 
 #if defined(DEBUG)
   // Dump the contents of each SourceBuffer to a series of files under aPath.
   // aPath must exist.  Debug only, invoke from your favourite debugger.
   void Dump(const char* aPath);
 #endif
 
 private:
+  // MediaSourceDecoder uses DurationChange to set the duration
+  // without hitting the checks in SetDuration.
+  friend class mozilla::MediaSourceDecoder;
+
   ~MediaSource();
 
   explicit MediaSource(nsPIDOMWindow* aWindow);
 
   friend class AsyncEventRunner<MediaSource>;
   void DispatchSimpleEvent(const char* aName);
   void QueueAsyncSimpleEvent(const char* aName);
 
--- a/content/media/mediasource/MediaSourceDecoder.cpp
+++ b/content/media/mediasource/MediaSourceDecoder.cpp
@@ -71,16 +71,17 @@ MediaSourceDecoder::Load(nsIStreamListen
 
 nsresult
 MediaSourceDecoder::GetSeekable(dom::TimeRanges* aSeekable)
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (!mMediaSource) {
     return NS_ERROR_FAILURE;
   }
+
   double duration = mMediaSource->Duration();
   if (IsNaN(duration)) {
     // Return empty range.
   } else if (duration > 0 && mozilla::IsInfinite(duration)) {
     nsRefPtr<dom::TimeRanges> bufferedRanges = new dom::TimeRanges();
     mMediaSource->GetBuffered(bufferedRanges);
     aSeekable->Add(bufferedRanges->GetStartTime(), bufferedRanges->GetEndTime());
   } else {
@@ -164,17 +165,17 @@ MediaSourceDecoder::Ended()
 void
 MediaSourceDecoder::SetMediaSourceDuration(double aDuration)
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (!mMediaSource) {
     return;
   }
   ErrorResult dummy;
-  mMediaSource->SetDuration(aDuration, dummy);
+  mMediaSource->DurationChange(aDuration, dummy);
 }
 
 void
 MediaSourceDecoder::NotifyTimeRangesChanged()
 {
   ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
   mon.NotifyAll();
 }