forked from mirrors/gecko-dev
Bug 1831052 - Record audio codec process when FinishDecodeFirstFrame() runs r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D176994
This commit is contained in:
parent
2004dce9a4
commit
a84b118dac
3 changed files with 40 additions and 18 deletions
|
|
@ -477,20 +477,8 @@ void MediaFormatReader::DecoderFactory::DoInitDecoder(Data& aData) {
|
|||
ownerData.GetCurrentInfo()->mMimeType);
|
||||
}
|
||||
if (aTrack == TrackInfo::kAudioTrack) {
|
||||
nsCString processName = ownerData.mDecoder->GetProcessName();
|
||||
nsCString audioProcessPerCodecName(
|
||||
processName + ","_ns + ownerData.mDecoder->GetCodecName());
|
||||
if (processName != "utility"_ns) {
|
||||
if (!StaticPrefs::media_rdd_process_enabled()) {
|
||||
audioProcessPerCodecName += ",rdd-disabled"_ns;
|
||||
}
|
||||
if (!StaticPrefs::media_utility_process_enabled()) {
|
||||
audioProcessPerCodecName += ",utility-disabled"_ns;
|
||||
}
|
||||
}
|
||||
Telemetry::ScalarAdd(
|
||||
Telemetry::ScalarID::MEDIA_AUDIO_PROCESS_PER_CODEC_NAME,
|
||||
NS_ConvertUTF8toUTF16(audioProcessPerCodecName), 1);
|
||||
ownerData.mProcessName = ownerData.mDecoder->GetProcessName();
|
||||
ownerData.mCodecName = ownerData.mDecoder->GetCodecName();
|
||||
}
|
||||
},
|
||||
[this, &aData, &ownerData](const MediaResult& aError) {
|
||||
|
|
@ -1373,6 +1361,12 @@ void MediaFormatReader::ReadUpdatedMetadata(MediaInfo* aInfo) {
|
|||
MutexAutoLock lock(mAudio.mMutex);
|
||||
if (HasAudio()) {
|
||||
aInfo->mAudio = *mAudio.GetWorkingInfo()->GetAsAudioInfo();
|
||||
Maybe<nsCString> audioProcessPerCodecName = GetAudioProcessPerCodec();
|
||||
if (audioProcessPerCodecName.isSome()) {
|
||||
Telemetry::ScalarAdd(
|
||||
Telemetry::ScalarID::MEDIA_AUDIO_PROCESS_PER_CODEC_NAME,
|
||||
NS_ConvertUTF8toUTF16(*audioProcessPerCodecName), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3248,6 +3242,28 @@ RefPtr<GenericPromise> MediaFormatReader::RequestDebugInfo(
|
|||
return GenericPromise::CreateAndResolve(true, __func__);
|
||||
}
|
||||
|
||||
Maybe<nsCString> MediaFormatReader::GetAudioProcessPerCodec() {
|
||||
if (mAudio.mDescription == "uninitialized"_ns) {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mAudio.mProcessName.Length() > 0,
|
||||
"Should have had a process name");
|
||||
MOZ_ASSERT(mAudio.mCodecName.Length() > 0, "Should have had a codec name");
|
||||
|
||||
nsCString processName = mAudio.mProcessName;
|
||||
nsCString audioProcessPerCodecName(processName + ","_ns + mAudio.mCodecName);
|
||||
if (processName != "utility"_ns) {
|
||||
if (!StaticPrefs::media_rdd_process_enabled()) {
|
||||
audioProcessPerCodecName += ",rdd-disabled"_ns;
|
||||
}
|
||||
if (!StaticPrefs::media_utility_process_enabled()) {
|
||||
audioProcessPerCodecName += ",utility-disabled"_ns;
|
||||
}
|
||||
}
|
||||
return Some(audioProcessPerCodecName);
|
||||
}
|
||||
|
||||
void MediaFormatReader::GetDebugInfo(dom::MediaFormatReaderDebugInfo& aInfo) {
|
||||
MOZ_ASSERT(OnTaskQueue(),
|
||||
"Don't call this off the task queue, it's going to touch a lot of "
|
||||
|
|
|
|||
|
|
@ -194,6 +194,8 @@ class MediaFormatReader final
|
|||
RefPtr<GenericPromise> RequestDebugInfo(
|
||||
dom::MediaFormatReaderDebugInfo& aInfo);
|
||||
|
||||
Maybe<nsCString> GetAudioProcessPerCodec();
|
||||
|
||||
// Switch the video decoder to NullDecoderModule. It might takes effective
|
||||
// since a few samples later depends on how much demuxed samples are already
|
||||
// queued in the original video decoder.
|
||||
|
|
@ -363,7 +365,9 @@ class MediaFormatReader final
|
|||
: mOwner(aOwner),
|
||||
mType(aType),
|
||||
mMutex("DecoderData"),
|
||||
mDescription("shutdown"),
|
||||
mDescription("uninitialized"),
|
||||
mProcessName(""),
|
||||
mCodecName(""),
|
||||
mUpdateScheduled(false),
|
||||
mDemuxEOS(false),
|
||||
mWaitingForData(false),
|
||||
|
|
@ -407,14 +411,16 @@ class MediaFormatReader final
|
|||
// Only non-null up until the decoder is created.
|
||||
RefPtr<TaskQueue> mTaskQueue;
|
||||
|
||||
// Mutex protecting mDescription, mDecoder, mTrackDemuxer and mWorkingInfo
|
||||
// as those can be read outside the TaskQueue.
|
||||
// Mutex protecting mDescription, mDecoder, mTrackDemuxer, mWorkingInfo,
|
||||
// mProcessName and mCodecName as those can be read outside the TaskQueue.
|
||||
// They are only written on the TaskQueue however, as such mMutex doesn't
|
||||
// need to be held when those members are read on the TaskQueue.
|
||||
Mutex mMutex MOZ_UNANNOTATED;
|
||||
// The platform decoder.
|
||||
RefPtr<MediaDataDecoder> mDecoder;
|
||||
nsCString mDescription;
|
||||
nsCString mProcessName;
|
||||
nsCString mCodecName;
|
||||
void ShutdownDecoder();
|
||||
|
||||
// Only accessed from reader's task queue.
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ async function verifyTelemetryForProcess(process, codecNames, extraKey = "") {
|
|||
// But we dont care really we just want to ensure 0 on RDD, Content and others
|
||||
// in the wild.[${codecName}]
|
||||
codecNames.forEach(codecName => {
|
||||
Assert.greaterOrEqual(
|
||||
Assert.equal(
|
||||
telemetry[MEDIA_AUDIO_PROCESS][`${process},${codecName}${extraKey}`],
|
||||
1,
|
||||
`${MEDIA_AUDIO_PROCESS} must have the correct value (${process}, ${codecName}).`
|
||||
|
|
|
|||
Loading…
Reference in a new issue