Bug 1198168 - add debugging logs.
MozReview-Commit-ID: D35N9bNNOeK
--- a/dom/media/mediasink/DecodedStream.cpp
+++ b/dom/media/mediasink/DecodedStream.cpp
@@ -16,16 +16,19 @@
#include "MediaStreamListener.h"
#include "OutputStreamManager.h"
#include "SharedBuffer.h"
#include "VideoSegment.h"
#include "VideoUtils.h"
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.
*/
struct PlaybackInfoInit {
int64_t mStartTime;
MediaInfo mInfo;
};
@@ -122,16 +125,17 @@ class DecodedStreamData {
public:
DecodedStreamData(OutputStreamManager* aOutputStreamManager,
PlaybackInfoInit&& aInit,
MozPromiseHolder<GenericPromise>&& aPromise);
~DecodedStreamData();
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.
*/
// Count of audio frames written to the stream
int64_t mAudioFramesWritten;
// mNextVideoTime is the end timestamp for the last packet sent to the stream.
// Therefore video packets starting at or after this time need to be copied
@@ -211,16 +215,27 @@ DecodedStreamData::SetPlaying(bool aPlay
}
void
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,
OutputStreamManager* aOutputStreamManager,
const bool& aSameOrigin,
const PrincipalHandle& aPrincipalHandle)
: mOwnerThread(aOwnerThread)
, mOutputStreamManager(aOutputStreamManager)
@@ -744,9 +759,21 @@ DecodedStream::DisconnectListener()
AssertOwnerThread();
mAudioPushListener.Disconnect();
mVideoPushListener.Disconnect();
mAudioFinishListener.Disconnect();
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
--- a/dom/media/mediasink/DecodedStream.h
+++ b/dom/media/mediasink/DecodedStream.h
@@ -58,16 +58,18 @@ public:
void SetPreservesPitch(bool aPreservesPitch) override;
void SetPlaying(bool aPlaying) override;
void Start(int64_t aStartTime, const MediaInfo& aInfo) override;
void Stop() override;
bool IsStarted() const override;
bool IsPlaying() const override;
+ void DumpDebugInfo() override;
+
protected:
virtual ~DecodedStream();
private:
void DestroyData(UniquePtr<DecodedStreamData> aData);
void AdvanceTracks();
void SendAudio(double aVolume, bool aIsSameOrigin, const PrincipalHandle& aPrincipalHandle);
void SendVideo(bool aIsSameOrigin, const PrincipalHandle& aPrincipalHandle);
--- a/dom/media/mediasink/VideoSink.cpp
+++ b/dom/media/mediasink/VideoSink.cpp
@@ -469,12 +469,13 @@ VideoSink::DumpDebugInfo()
{
AssertOwnerThread();
DUMP_LOG(
"IsStarted=%d IsPlaying=%d, VideoQueue: finished=%d size=%d, "
"mVideoFrameEndTime=%lld mHasVideo=%d mVideoSinkEndRequest.Exists()=%d "
"mEndPromiseHolder.IsEmpty()=%d",
IsStarted(), IsPlaying(), VideoQueue().IsFinished(), VideoQueue().GetSize(),
mVideoFrameEndTime, mHasVideo, mVideoSinkEndRequest.Exists(), mEndPromiseHolder.IsEmpty());
+ mAudioSink->DumpDebugInfo();
}
} // namespace media
} // namespace mozilla
--- a/dom/media/test/test_bug1113600.html
+++ b/dom/media/test/test_bug1113600.html
@@ -4,16 +4,18 @@
<title>Test that a video element captured to a stream mid-playback can be played to the end</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
+PARALLEL_TESTS = 1;
+SimpleTest.requestCompleteLog();
var manager = new MediaTestManager;
function startTest(test, token) {
var v = document.createElement('video');
v.style = "background-color:#aca;";
v.width = 160;
v.height = 120;