Bug 1163223 - Reuse rendezvous when coming out of dormant mode. r=jww
☠☠ backed out by db848e0a090d ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Wed, 10 Jun 2015 18:07:38 -0700
changeset 248571 a8271be8264e
parent 248570 a8f7e2ad9543
child 248572 4cbdd2f615c2
push id61010
push userbobbyholley@gmail.com
push date2015-06-12 16:51 +0000
treeherdermozilla-inbound@8985172298c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjww
bugs1163223
milestone41.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 1163223 - Reuse rendezvous when coming out of dormant mode. r=jww
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2150,28 +2150,32 @@ MediaDecoderStateMachine::OnMetadataRead
   MOZ_ASSERT(OnTaskQueue());
   MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA);
   ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
   mMetadataRequest.Complete();
 
   mDecoder->SetMediaSeekable(mReader->IsMediaSeekable());
   mInfo = aMetadata->mInfo;
   mMetadataTags = aMetadata->mTags.forget();
-
-  mStartTimeRendezvous = new StartTimeRendezvous(TaskQueue(), HasAudio(), HasVideo(),
-                                                 mReader->ForceZeroStartTime() || IsRealTime());
-
   nsRefPtr<MediaDecoderStateMachine> self = this;
-  mStartTimeRendezvous->AwaitStartTime()->Then(TaskQueue(), __func__,
-    [self] () -> void {
-      ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
-      self->mReader->SetStartTime(self->StartTime());
-    },
-    [] () -> void { NS_WARNING("Setting start time on reader failed"); }
-  );
+
+  // Set up the start time rendezvous if it doesn't already exist (which is
+  // generally the case, unless we're coming out of dormant mode).
+  if (!mStartTimeRendezvous) {
+    mStartTimeRendezvous = new StartTimeRendezvous(TaskQueue(), HasAudio(), HasVideo(),
+                                                   mReader->ForceZeroStartTime() || IsRealTime());
+
+    mStartTimeRendezvous->AwaitStartTime()->Then(TaskQueue(), __func__,
+      [self] () -> void {
+        ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
+        self->mReader->SetStartTime(self->StartTime());
+      },
+      [] () -> void { NS_WARNING("Setting start time on reader failed"); }
+    );
+  }
 
   if (mInfo.mMetadataDuration.isSome()) {
     RecomputeDuration();
   } else if (mInfo.mUnadjustedMetadataEndTime.isSome()) {
     mStartTimeRendezvous->AwaitStartTime()->Then(TaskQueue(), __func__,
       [self] () -> void {
         TimeUnit unadjusted = self->mInfo.mUnadjustedMetadataEndTime.ref();
         TimeUnit adjustment = TimeUnit::FromMicroseconds(self->StartTime());