Bug 1249706: Added telemetry for the proportion of frames dropped keyed by several details. r=jya

This commit is contained in:
Louis Christie 2016-02-23 13:19:40 +13:00
Родитель 548b45eaca
Коммит 4a902ba49c
5 изменённых файлов: 86 добавлений и 6 удалений

Просмотреть файл

@ -86,6 +86,10 @@ MediaFormatReader::Shutdown()
{
MOZ_ASSERT(OnTaskQueue());
if (HasVideo()) {
ReportDroppedFramesTelemetry();
}
mDemuxerInitRequest.DisconnectIfExists();
mMetadataPromise.RejectIfExists(ReadMetadataFailureReason::METADATA_ERROR, __func__);
mSeekPromise.RejectIfExists(NS_ERROR_FAILURE, __func__);
@ -667,6 +671,7 @@ MediaFormatReader::NotifyNewOutput(TrackType aTrack, MediaData* aSample)
decoder.mOutput.AppendElement(aSample);
decoder.mNumSamplesOutput++;
decoder.mNumSamplesOutputTotal++;
decoder.mNumSamplesOutputTotalSinceTelemetry++;
ScheduleUpdate(aTrack);
}
@ -910,6 +915,9 @@ MediaFormatReader::HandleDemuxedSamples(TrackType aTrack,
LOG("%s stream id has changed from:%d to:%d, draining decoder.",
TrackTypeToStr(aTrack), decoder.mLastStreamSourceID,
info->GetID());
if (aTrack == TrackType::kVideoTrack) {
ReportDroppedFramesTelemetry();
}
decoder.mNeedDraining = true;
decoder.mNextStreamSourceID = Some(info->GetID());
ScheduleUpdate(aTrack);
@ -1371,6 +1379,7 @@ MediaFormatReader::OnVideoSkipCompleted(uint32_t aSkipped)
mDecoder->NotifyDecodedFrames(aSkipped, 0, aSkipped);
}
mVideo.mNumSamplesSkippedTotal += aSkipped;
mVideo.mNumSamplesSkippedTotalSinceTelemetry += aSkipped;
MOZ_ASSERT(!mVideo.mError); // We have flushed the decoder, no frame could
// have been decoded (and as such errored)
NotifyDecodingRequested(TrackInfo::kVideoTrack);
@ -1700,4 +1709,51 @@ MediaFormatReader::GetMozDebugReaderData(nsAString& aString)
aString += NS_ConvertUTF8toUTF16(result);
}
void
MediaFormatReader::ReportDroppedFramesTelemetry()
{
MOZ_ASSERT(OnTaskQueue());
const VideoInfo* info =
mVideo.mInfo ? mVideo.mInfo->GetAsVideoInfo() : &mInfo.mVideo;
if (!info || !mVideo.mDecoder) {
return;
}
nsCString keyPhrase = nsCString("MimeType=");
keyPhrase.Append(info->mMimeType);
keyPhrase.Append("; ");
keyPhrase.Append("Resolution=");
keyPhrase.AppendInt(info->mDisplay.width);
keyPhrase.Append('x');
keyPhrase.AppendInt(info->mDisplay.height);
keyPhrase.Append("; ");
keyPhrase.Append("HardwareAcceleration=");
if (VideoIsHardwareAccelerated()) {
keyPhrase.Append(mVideo.mDecoder->GetDescriptionName());
keyPhrase.Append("enabled");
} else {
keyPhrase.Append("disabled");
}
if (mVideo.mNumSamplesOutputTotalSinceTelemetry) {
uint32_t percentage =
100 * mVideo.mNumSamplesSkippedTotalSinceTelemetry /
mVideo.mNumSamplesOutputTotalSinceTelemetry;
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([=]() -> void {
LOG("Reporting telemetry DROPPED_FRAMES_IN_VIDEO_PLAYBACK");
Telemetry::Accumulate(Telemetry::VIDEO_DETAILED_DROPPED_FRAMES_PROPORTION,
keyPhrase,
percentage);
});
AbstractThread::MainThread()->Dispatch(task.forget());
}
mVideo.mNumSamplesSkippedTotalSinceTelemetry = 0;
mVideo.mNumSamplesOutputTotalSinceTelemetry = 0;
}
} // namespace mozilla

Просмотреть файл

@ -234,6 +234,8 @@ private:
, mNumSamplesOutput(0)
, mNumSamplesOutputTotal(0)
, mNumSamplesSkippedTotal(0)
, mNumSamplesOutputTotalSinceTelemetry(0)
, mNumSamplesSkippedTotalSinceTelemetry(0)
, mSizeOfQueue(0)
, mIsHardwareAccelerated(false)
, mLastStreamSourceID(UINT32_MAX)
@ -312,6 +314,9 @@ private:
uint64_t mNumSamplesOutputTotal;
uint64_t mNumSamplesSkippedTotal;
uint64_t mNumSamplesOutputTotalSinceTelemetry;
uint64_t mNumSamplesSkippedTotalSinceTelemetry;
// These get overriden in the templated concrete class.
// Indicate if we have a pending promise for decoded frame.
// Rejecting the promise will stop the reader from decoding ahead.
@ -465,6 +470,9 @@ private:
{
OnSeekFailed(TrackType::kAudioTrack, aFailure);
}
void ReportDroppedFramesTelemetry();
// Temporary seek information while we wait for the data
Maybe<SeekTarget> mOriginalSeekTarget;
Maybe<media::TimeUnit> mPendingSeekTime;

Просмотреть файл

@ -651,6 +651,17 @@ WMFVideoMFTManager::IsHardwareAccelerated(nsACString& aFailureReason) const
return mDecoder && mUseHwAccel;
}
const char*
WMFVideoMFTManager::GetDescriptionName() const
{
if (mDecoder && mUseHwAccel && mDXVA2Manager) {
return (mDXVA2Manager->IsD3D11()) ?
"D3D11 Hardware Decoder" : "D3D9 Hardware Decoder";
} else {
return "wmf software video decoder";
}
}
void
WMFVideoMFTManager::ConfigurationChanged(const TrackInfo& aConfig)
{

Просмотреть файл

@ -41,12 +41,7 @@ public:
void ConfigurationChanged(const TrackInfo& aConfig) override;
const char* GetDescriptionName() const override
{
nsCString failureReason;
return IsHardwareAccelerated(failureReason)
? "wmf hardware video decoder" : "wmf software video decoder";
}
const char* GetDescriptionName() const override;
private:

Просмотреть файл

@ -10328,6 +10328,16 @@
"bug_numbers": [1238433],
"description": "Percentage of frames decoded frames dropped in an HTMLVideoElement"
},
"VIDEO_DETAILED_DROPPED_FRAMES_PROPORTION" : {
"alert_emails": ["lchristie@mozilla.com", "cpearce@mozilla.com"],
"expires_in_version": "55",
"kind": "linear",
"high": 100,
"n_buckets": 50,
"keyed": true,
"bug_numbers": [1238433],
"description": "Percentage of frames decoded frames dropped in an HTMLVideoElement, keyed by MimeType, Resolution and Hardware Accelerated Decoding"
},
"TAB_SWITCH_CACHE_POSITION": {
"expires_in_version": "55",
"bug_numbers": [1242013],