debug MediaCache. draft
authorJW Wang <jwwang@mozilla.com>
Fri, 20 Jan 2017 15:20:18 +0800
changeset 479144 9a0f77082b94fd984564378aa2947d8ff5670b57
parent 479117 6c998914bad21a65c7fe2ee7e8c1c7f5269c750d
child 479145 fdc74d3f567fef454f60eed3717aef796fe6fe66
push id44158
push userjwwang@mozilla.com
push dateMon, 06 Feb 2017 02:30:28 +0000
milestone54.0a1
debug MediaCache. MozReview-Commit-ID: 3uGC1nCUKi0
dom/media/MediaCache.cpp
--- a/dom/media/MediaCache.cpp
+++ b/dom/media/MediaCache.cpp
@@ -2269,17 +2269,31 @@ MediaCacheStream::Read(char* aBuffer, ui
           streamWithPartialBlock->mMetadataInPartialBlockBuffer = true;
         }
         streamOffset += bytes;
         count = bytes;
         break;
       }
 
       // No data has been read yet, so block
-      mon.Wait();
+      auto t1 = TimeStamp::NowLoRes();
+      mon.Wait(PR_SecondsToInterval(10));
+      auto t2 = TimeStamp::NowLoRes();
+      if ((t2 - t1).ToSeconds() > 30) {
+        auto&& msg = nsPrintfCString(
+          "aCount=%u count=%u mClosed=%d mStreamOffset=%lld streamOffset=%lld "
+          "mStreamLength=%lld mChannelOffset=%lld #mBlocks=%d mDidNotifyDataEnded=%d "
+          "mCacheSuspended=%d mChannelEnded=%d mNotifyDataEndedStatus=%x",
+          aCount, count, mClosed, mStreamOffset, streamOffset, mStreamLength,
+          mChannelOffset, mBlocks.Length(), mDidNotifyDataEnded, mCacheSuspended,
+          mChannelEnded, mNotifyDataEndedStatus);
+        NS_DebugBreak(NS_DEBUG_WARNING, msg.Data(), nullptr, __FILE__, __LINE__);
+        MOZ_CRASH("timed out in waiting for data");
+      }
+
       if (mClosed) {
         // We may have successfully read some data, but let's just throw
         // that out.
         return NS_ERROR_FAILURE;
       }
       continue;
     }