Backed out changeset e17425d9f940 (bug 1402584) for frequent mda failures on Windows 10, e.g. in dom/media/test/test_seek-2.html. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sun, 08 Oct 2017 01:16:34 +0200
changeset 385030 db5526c855d07beb52b3c0f4b5b1ec769bb89fce
parent 385029 53548fbb1e5fd6ce9f973a5ed9089750dcb81296
child 385031 f7b9b00dfe1737236efe4032661d3bf2bb9aaea5
child 385037 5e030a486ad8535969c4f6c1955c253a12ee8c51
push id52867
push userarchaeopteryx@coole-files.de
push dateSat, 07 Oct 2017 23:18:30 +0000
treeherderautoland@db5526c855d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1402584
milestone58.0a1
backs oute17425d9f94036ea32ef689eea4f20e27b19925a
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
Backed out changeset e17425d9f940 (bug 1402584) for frequent mda failures on Windows 10, e.g. in dom/media/test/test_seek-2.html. r=backout
dom/html/HTMLMediaElement.cpp
dom/media/MediaDecoder.h
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -2840,16 +2840,27 @@ HTMLMediaElement::Seek(double aTime,
   //       actual seek target before beginning the synchronous section, but
   //       that requires changing all MediaDecoderReaders to support telling
   //       us the fastSeek target, and it's currently not possible to get
   //       this information as we don't yet control the demuxer for all
   //       MediaDecoderReaders.
 
   mPlayingBeforeSeek = IsPotentiallyPlaying();
 
+#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
+  if (!mDecoder->IsMetadataLoaded()) {
+    // This is for debugging bug 1402584.
+    // We should reach here only after metadata loaded by the decoder.
+    MOZ_CRASH_UNSAFE_PRINTF(
+      "Metadata not loaded! readyState=%d networkState=%d",
+      static_cast<int>(mReadyState.Ref()),
+      static_cast<int>(mNetworkState));
+  }
+#endif
+
   // The media backend is responsible for dispatching the timeupdate
   // event if it changes the playback position as a result of the seek.
   LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) starting seek", this, aTime));
   nsresult rv = mDecoder->Seek(aTime, aSeekType);
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return nullptr;
   }
@@ -6037,16 +6048,26 @@ void HTMLMediaElement::ChangeReadyState(
   }
 
   CheckAutoplayDataReady();
 
   if (oldState < nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA &&
       mReadyState >= nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA) {
     DispatchAsyncEvent(NS_LITERAL_STRING("canplaythrough"));
   }
+
+#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
+  if (mReadyState >= nsIDOMHTMLMediaElement::HAVE_METADATA && mDecoder &&
+      !mDecoder->IsMetadataLoaded()) {
+    MOZ_CRASH_UNSAFE_PRINTF(
+      "Metadata not loaded! readyState=%d networkState=%d",
+      static_cast<int>(mReadyState.Ref()),
+      static_cast<int>(mNetworkState));
+  }
+#endif
 }
 
 static const char* const gNetworkStateToString[] = {
   "EMPTY",
   "IDLE",
   "LOADING",
   "NO_SOURCE"
  };
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -235,16 +235,19 @@ public:
 
   MediaDecoderStateMachine* GetStateMachine() const;
   void SetStateMachine(MediaDecoderStateMachine* aStateMachine);
 
   // Constructs the time ranges representing what segments of the media
   // are buffered and playable.
   virtual media::TimeIntervals GetBuffered();
 
+  // For debugging bug 1402584.
+  bool IsMetadataLoaded() const { return !!mInfo; }
+
   // Returns the size, in bytes, of the heap memory used by the currently
   // queued decoded video and audio data.
   size_t SizeOfVideoQueue();
   size_t SizeOfAudioQueue();
 
   // Helper struct for accumulating resource sizes that need to be measured
   // asynchronously. Once all references are dropped the callback will be
   // invoked.