Bug 1402584 - per comment 16, add more logs for debugging. draft
authorJW Wang <jwwang@mozilla.com>
Fri, 06 Oct 2017 08:56:29 +0800
changeset 675854 177045a0fb8eb0db503c0782ff08cae40d08a0c1
parent 675853 e332d1fe94822fbff434fd438306487bcf6d3eef
child 734738 8ab4ae812f47c13045e6e688007ae2a58ffaf2cc
push id83272
push userjwwang@mozilla.com
push dateFri, 06 Oct 2017 02:10:31 +0000
bugs1402584
milestone58.0a1
Bug 1402584 - per comment 16, add more logs for debugging. MozReview-Commit-ID: 9DDz0HNqgu2
dom/html/HTMLMediaElement.cpp
dom/media/MediaDecoder.cpp
dom/media/MediaDecoder.h
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -6053,19 +6053,20 @@ void HTMLMediaElement::ChangeReadyState(
       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",
+      "Metadata not loaded! readyState=%d networkState=%d oldState=%d",
       static_cast<int>(mReadyState.Ref()),
-      static_cast<int>(mNetworkState));
+      static_cast<int>(mNetworkState),
+      static_cast<int>(oldState));
   }
 #endif
 }
 
 static const char* const gNetworkStateToString[] = {
   "EMPTY",
   "IDLE",
   "LOADING",
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -712,21 +712,23 @@ MediaDecoder::OnMetadataUpdate(TimedMeta
 void
 MediaDecoder::MetadataLoaded(UniquePtr<MediaInfo> aInfo,
                              UniquePtr<MetadataTags> aTags,
                              MediaDecoderEventVisibility aEventVisibility)
 {
   MOZ_ASSERT(NS_IsMainThread());
   AbstractThread::AutoEnter context(AbstractMainThread());
   MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
+  MOZ_DIAGNOSTIC_ASSERT(aInfo, "Null media info!");
 
   LOG("MetadataLoaded, channels=%u rate=%u hasAudio=%d hasVideo=%d",
       aInfo->mAudio.mChannels, aInfo->mAudio.mRate,
       aInfo->HasAudio(), aInfo->HasVideo());
 
+  mMetadataLoaded = true;
   mMediaSeekable = aInfo->mMediaSeekable;
   mMediaSeekableOnlyInBufferedRanges = aInfo->mMediaSeekableOnlyInBufferedRanges;
   mInfo = aInfo.release();
   GetOwner()->ConstructMediaTracks(mInfo);
 
   // Make sure the element and the frame (if any) are told about
   // our new size.
   if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -235,17 +235,17 @@ 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; }
+  bool IsMetadataLoaded() const { return mMetadataLoaded; }
 
   // 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
@@ -693,13 +693,14 @@ public:
 
 private:
   // Notify owner when the audible state changed
   void NotifyAudibleStateChanged();
 
   bool mTelemetryReported;
   const MediaContainerType mContainerType;
   bool mCanPlayThrough = false;
+  bool mMetadataLoaded = false;
 };
 
 } // namespace mozilla
 
 #endif