Bug 1230295 - Add telemetry to report when Ogg chaining is used. r=rillian,r=vladan

This commit is contained in:
Chris Pearce 2015-12-10 12:10:41 -05:00
parent f7471d0bb1
commit 2e36234bd0
3 changed files with 29 additions and 6 deletions

View File

@ -22,6 +22,8 @@ extern "C" {
#include "MediaMetadataManager.h"
#include "nsISeekableStream.h"
#include "gfx2DGlue.h"
#include "mozilla/Telemetry.h"
#include "nsPrintfCString.h"
using namespace mozilla::gfx;
using namespace mozilla::media;
@ -148,6 +150,17 @@ OggReader::~OggReader()
{
ogg_sync_clear(&mOggState);
MOZ_COUNT_DTOR(OggReader);
if (HasAudio() || HasVideo()) {
// If we were able to initialize our decoders, report whether we encountered
// a chained stream or not.
ReentrantMonitorAutoEnter mon(mMonitor);
bool isChained = mIsChained;
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction([=]() -> void {
LOG(LogLevel::Debug, (nsPrintfCString("Reporting telemetry MEDIA_OGG_LOADED_IS_CHAINED=%d", isChained).get()));
Telemetry::Accumulate(Telemetry::ID::MEDIA_OGG_LOADED_IS_CHAINED, isChained);
});
AbstractThread::MainThread()->Dispatch(task.forget());
}
}
nsresult OggReader::Init() {
@ -704,10 +717,13 @@ bool OggReader::DecodeAudioData()
return true;
}
void OggReader::SetChained(bool aIsChained) {
void OggReader::SetChained() {
{
ReentrantMonitorAutoEnter mon(mMonitor);
mIsChained = aIsChained;
if (mIsChained) {
return;
}
mIsChained = true;
}
mOnMediaNotSeekable.Notify();
}
@ -800,7 +816,7 @@ bool OggReader::ReadOggChain()
}
if (chained) {
SetChained(true);
SetChained();
{
auto t = mDecodedAudioFrames * USECS_PER_S / mInfo.mAudio.mRate;
mTimedMetadataEvent.Notify(
@ -1139,7 +1155,7 @@ int64_t OggReader::RangeEndTime(int64_t aStartOffset,
// This page is from a bitstream which we haven't encountered yet.
// It's probably from a new "link" in a "chained" ogg. Don't
// bother even trying to find a duration...
SetChained(true);
SetChained();
endTime = -1;
break;
}
@ -1913,7 +1929,7 @@ media::TimeIntervals OggReader::GetBuffered()
// ogg), return OK to abort the finding any further ranges. This
// prevents us searching through the rest of the media when we
// may not be able to extract timestamps from it.
SetChained(true);
SetChained();
return buffered;
}
}

View File

@ -252,7 +252,7 @@ private:
// Set this media as being a chain and notifies the state machine that the
// media is no longer seekable.
void SetChained(bool aIsChained);
void SetChained();
// Returns the next Ogg packet for an bitstream/codec state. Returns a
// pointer to an ogg_packet on success, or nullptr if the read failed.

View File

@ -6285,6 +6285,13 @@
"n_values": 256,
"description": "WMF media decoder error or success (0) codes."
},
"MEDIA_OGG_LOADED_IS_CHAINED": {
"alert_emails": ["cpearce@mozilla.com"],
"expires_in_version": "53",
"kind": "boolean",
"description": "Whether Ogg audio/video encountered are chained or not.",
"bug_numbers": [1230295]
},
"VIDEO_CAN_CREATE_AAC_DECODER": {
"alert_emails": ["cpearce@mozilla.com"],
"expires_in_version": "50",