Bug 1198168 - add debugging logs. r=kaku

MozReview-Commit-ID: D35N9bNNOeK

--HG--
extra : rebase_source : 4da554e41c48e52f9f90e3c9d222d4a85130da87
This commit is contained in:
JW Wang 2016-11-01 14:41:09 +08:00
parent be15eb6990
commit f682200758
4 changed files with 32 additions and 0 deletions

View File

@ -21,6 +21,9 @@
namespace mozilla {
#undef DUMP_LOG
#define DUMP_LOG(x, ...) NS_DebugBreak(NS_DEBUG_WARNING, nsPrintfCString(x, ##__VA_ARGS__).get(), nullptr, nullptr, -1)
/*
* A container class to make it easier to pass the playback info all the
* way to DecodedStreamGraphListener from DecodedStream.
@ -127,6 +130,7 @@ public:
void SetPlaying(bool aPlaying);
MediaEventSource<int64_t>& OnOutput();
void Forget();
void DumpDebugInfo();
/* The following group of fields are protected by the decoder's monitor
* and can be read or written on any thread.
@ -216,6 +220,17 @@ DecodedStreamData::Forget()
mListener->Forget();
}
void
DecodedStreamData::DumpDebugInfo()
{
DUMP_LOG(
"DecodedStreamData=%p mPlaying=%d mAudioFramesWritten=%lld"
"mNextAudioTime=%lld mNextVideoTime=%lld mHaveSentFinish=%d"
"mHaveSentFinishAudio=%d mHaveSentFinishVideo=%d",
this, mPlaying, mAudioFramesWritten, mNextAudioTime, mNextVideoTime,
mHaveSentFinish, mHaveSentFinishAudio, mHaveSentFinishVideo);
}
DecodedStream::DecodedStream(AbstractThread* aOwnerThread,
MediaQueue<MediaData>& aAudioQueue,
MediaQueue<MediaData>& aVideoQueue,
@ -749,4 +764,16 @@ DecodedStream::DisconnectListener()
mVideoFinishListener.Disconnect();
}
void
DecodedStream::DumpDebugInfo()
{
AssertOwnerThread();
DUMP_LOG(
"DecodedStream=%p mStartTime=%lld mLastOutputTime=%lld mPlaying=%d mData=%p",
this, mStartTime.valueOr(-1), mLastOutputTime, mPlaying, mData.get());
if (mData) {
mData->DumpDebugInfo();
}
}
} // namespace mozilla

View File

@ -63,6 +63,8 @@ public:
bool IsStarted() const override;
bool IsPlaying() const override;
void DumpDebugInfo() override;
protected:
virtual ~DecodedStream();

View File

@ -474,6 +474,7 @@ VideoSink::DumpDebugInfo()
"mEndPromiseHolder.IsEmpty()=%d",
IsStarted(), IsPlaying(), VideoQueue().IsFinished(), VideoQueue().GetSize(),
mVideoFrameEndTime, mHasVideo, mVideoSinkEndRequest.Exists(), mEndPromiseHolder.IsEmpty());
mAudioSink->DumpDebugInfo();
}
} // namespace media

View File

@ -9,6 +9,8 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
PARALLEL_TESTS = 1;
SimpleTest.requestCompleteLog();
var manager = new MediaTestManager;
function startTest(test, token) {