Bug 1131638 - Record invalid frames as dropped for video playback stats. r=ajones

This commit is contained in:
Matt Woodrow 2015-03-12 22:14:04 +13:00
parent 67f43c6536
commit 6db2c9ff04
2 changed files with 20 additions and 2 deletions

View File

@ -956,7 +956,8 @@ public:
mParsedFrames(0),
mDecodedFrames(0),
mPresentedFrames(0),
mDroppedFrames(0) {}
mDroppedFrames(0),
mCorruptFrames(0) {}
// Returns number of frames which have been parsed from the media.
// Can be called on any thread.
@ -983,7 +984,13 @@ public:
// Number of frames that have been skipped because they have missed their
// compoisition deadline.
uint32_t GetDroppedFrames() {
return mDroppedFrames;
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
return mDroppedFrames + mCorruptFrames;
}
uint32_t GetCorruptedFrames() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
return mCorruptFrames;
}
// Increments the parsed and decoded frame counters by the passed in counts.
@ -1005,6 +1012,11 @@ public:
++mPresentedFrames;
}
void NotifyCorruptFrame() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
++mCorruptFrames;
}
private:
// ReentrantMonitor to protect access of playback statistics.
@ -1023,6 +1035,8 @@ public:
uint32_t mPresentedFrames;
uint32_t mDroppedFrames;
uint32_t mCorruptFrames;
};
// Return the frame decode/paint related statistics.

View File

@ -2888,6 +2888,10 @@ void MediaDecoderStateMachine::RenderVideoFrame(VideoData* aData,
VideoFrameContainer* container = mDecoder->GetVideoFrameContainer();
if (container) {
if (aData->mImage && !aData->mImage->IsValid()) {
MediaDecoder::FrameStatistics& frameStats = mDecoder->GetFrameStatistics();
frameStats.NotifyCorruptFrame();
}
container->SetCurrentFrame(ThebesIntSize(aData->mDisplay), aData->mImage,
aTarget);
MOZ_ASSERT(container->GetFrameDelay() >= 0 || IsRealTime());