Bug 1236703: P1. Add debugging information for MSE to about:media plugin. r=kentuckyfriedtakahe

Add : number of frames decoded and number of frames skipped during skip to next key frame and if hardware acceleration is currently in use.
This commit is contained in:
Jean-Yves Avenard 2016-01-18 10:21:59 +11:00
parent df877e4c27
commit 7e95055d1a
4 changed files with 27 additions and 4 deletions

View File

@ -1363,6 +1363,7 @@ MediaFormatReader::OnVideoSkipCompleted(uint32_t aSkipped)
if (mDecoder) {
mDecoder->NotifyDecodedFrames(aSkipped, 0, aSkipped);
}
mVideo.mNumSamplesSkippedTotal += aSkipped;
MOZ_ASSERT(!mVideo.mError); // We have flushed the decoder, no frame could
// have been decoded (and as such errored)
NotifyDecodingRequested(TrackInfo::kVideoTrack);
@ -1661,4 +1662,19 @@ MediaFormatReader::GetImageContainer()
? mVideoFrameContainer->GetImageContainer() : nullptr;
}
void
MediaFormatReader::GetMozDebugReaderData(nsAString& aString)
{
nsAutoCString result;
result += nsPrintfCString("hardware video decoding: %s\n",
VideoIsHardwareAccelerated() ? "enabled" : "disabled");
result += nsPrintfCString("audio frames decoded: %lld (skipped:%lld)\n"
"video frames decoded: %lld (skipped:%lld)\n",
mAudio.mNumSamplesOutputTotal,
mAudio.mNumSamplesSkippedTotal,
mVideo.mNumSamplesOutputTotal,
mVideo.mNumSamplesSkippedTotal);
aString += NS_ConvertUTF8toUTF16(result);
}
} // namespace mozilla

View File

@ -96,6 +96,10 @@ public:
void SetCDMProxy(CDMProxy* aProxy) override;
#endif
// Returns a string describing the state of the decoder data.
// Used for debugging purposes.
void GetMozDebugReaderData(nsAString& aString);
private:
bool HasVideo() { return mVideo.mTrackDemuxer; }
bool HasAudio() { return mAudio.mTrackDemuxer; }
@ -226,6 +230,7 @@ private:
, mNumSamplesInput(0)
, mNumSamplesOutput(0)
, mNumSamplesOutputTotal(0)
, mNumSamplesSkippedTotal(0)
, mSizeOfQueue(0)
, mIsHardwareAccelerated(false)
, mLastStreamSourceID(UINT32_MAX)
@ -289,6 +294,7 @@ private:
uint64_t mNumSamplesInput;
uint64_t mNumSamplesOutput;
uint64_t mNumSamplesOutputTotal;
uint64_t mNumSamplesSkippedTotal;
// These get overriden in the templated concrete class.
// Indicate if we have a pending promise for decoded frame.

View File

@ -13,7 +13,6 @@
#include "MediaSourceResource.h"
#include "MediaSourceUtils.h"
#include "VideoUtils.h"
#include "MediaFormatReader.h"
#include "MediaSourceDemuxer.h"
#include "SourceBufferList.h"
#include <algorithm>
@ -47,9 +46,8 @@ MediaSourceDecoder::CreateStateMachine()
{
MOZ_ASSERT(NS_IsMainThread());
mDemuxer = new MediaSourceDemuxer();
RefPtr<MediaFormatReader> reader =
new MediaFormatReader(this, mDemuxer, GetVideoFrameContainer());
return new MediaDecoderStateMachine(this, reader);
mReader = new MediaFormatReader(this, mDemuxer, GetVideoFrameContainer());
return new MediaDecoderStateMachine(this, mReader);
}
nsresult
@ -241,6 +239,7 @@ MediaSourceDecoder::GetMediaSourceDuration()
void
MediaSourceDecoder::GetMozDebugReaderData(nsAString& aString)
{
mReader->GetMozDebugReaderData(aString);
mDemuxer->GetMozDebugReaderData(aString);
}

View File

@ -12,6 +12,7 @@
#include "nsCOMPtr.h"
#include "nsError.h"
#include "MediaDecoder.h"
#include "MediaFormatReader.h"
class nsIStreamListener;
@ -88,6 +89,7 @@ private:
// mMediaSource.
dom::MediaSource* mMediaSource;
RefPtr<MediaSourceDemuxer> mDemuxer;
RefPtr<MediaFormatReader> mReader;
Atomic<bool> mEnded;
};