Bug 1321198 - this is a debugging patch which crashes when test_seek* time out to get the stack trace about what's stuck. r?jya draft
authorJW Wang <jwwang@mozilla.com>
Wed, 11 Jan 2017 11:15:24 +0800
changeset 458909 365dde73341fd7f5b7328c746a61f998f7eb0e4a
parent 458908 e3c517f6fab6c5eb4aaac11d051f18c096b72075
child 541777 ff0ec50de0e5f35e3f8ceba299bf9bf67d3db0c0
push id41096
push userjwwang@mozilla.com
push dateWed, 11 Jan 2017 08:26:34 +0000
reviewersjya
bugs1321198
milestone53.0a1
Bug 1321198 - this is a debugging patch which crashes when test_seek* time out to get the stack trace about what's stuck. r?jya MozReview-Commit-ID: L7Q3Fyapkzf
dom/media/MediaDecoderStateMachine.cpp
dom/media/test/seek_support.js
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -3669,30 +3669,35 @@ uint32_t MediaDecoderStateMachine::GetAm
     : std::max<uint32_t>(sVideoQueueDefaultSize, MIN_VIDEO_QUEUE_SIZE);
 }
 
 void
 MediaDecoderStateMachine::DumpDebugInfo()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
+  bool crash = Preferences::GetBool("media.test.crashOnDumpDebugInfo", false);
+
   // It is fine to capture a raw pointer here because MediaDecoder only call
   // this function before shutdown begins.
-  nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([this] () {
+  nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([this, crash] () {
     mMediaSink->DumpDebugInfo();
     mStateObj->DumpDebugInfo();
     DUMP_LOG(
       "GetMediaTime=%lld GetClock=%lld mMediaSink=%p "
       "mState=%s mPlayState=%d mSentFirstFrameLoadedEvent=%d IsPlaying=%d "
       "mAudioStatus=%s mVideoStatus=%s mDecodedAudioEndTime=%lld mDecodedVideoEndTime=%lld "
       "mAudioCompleted=%d mVideoCompleted=%d",
       GetMediaTime(), mMediaSink->IsStarted() ? GetClock() : -1, mMediaSink.get(),
       ToStateStr(), mPlayState.Ref(), mSentFirstFrameLoadedEvent, IsPlaying(),
       AudioRequestStatus(), VideoRequestStatus(), mDecodedAudioEndTime, mDecodedVideoEndTime,
       mAudioCompleted, mVideoCompleted);
+    if (crash) {
+      MOZ_CRASH();
+    }
   });
 
   // Since the task is run asynchronously, it is possible other tasks get first
   // and change the object states before we print them. Therefore we want to
   // dispatch this task immediately without waiting for the tail dispatching
   // phase so object states are less likely to change before being printed.
   OwnerThread()->Dispatch(r.forget(),
     AbstractThread::AssertDispatchSuccess, AbstractThread::TailDispatch);
--- a/dom/media/test/seek_support.js
+++ b/dom/media/test/seek_support.js
@@ -1,10 +1,12 @@
 var manager = new MediaTestManager;
 
+gTestPrefs = gTestPrefs.concat([['media.test.crashOnDumpDebugInfo', true]]);
+
 function createTestArray() {
   var tests = [];
   var tmpVid = document.createElement("video");
 
   for (var testNum=0; testNum<gSeekTests.length; testNum++) {
     var test = gSeekTests[testNum];
     if (!tmpVid.canPlayType(test.type)) {
       continue;