mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-24 09:27:31 +09:00
Telemetry: Remove stubs and related code
This commit is contained in:
parent
10053448d6
commit
aea50f182f
134 changed files with 68 additions and 3422 deletions
|
|
@ -10,7 +10,6 @@
|
|||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include "OggDecoder.h"
|
||||
#include "OggDemuxer.h"
|
||||
|
|
@ -85,22 +84,6 @@ DecoderTraits::IsWebMAudioType(const nsACString& aType)
|
|||
return aType.EqualsASCII("audio/webm");
|
||||
}
|
||||
|
||||
static char const *const gHttpLiveStreamingTypes[] = {
|
||||
// For m3u8.
|
||||
// https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-10
|
||||
"application/vnd.apple.mpegurl",
|
||||
// Some sites serve these as the informal m3u type.
|
||||
"application/x-mpegurl",
|
||||
"audio/x-mpegurl",
|
||||
nullptr
|
||||
};
|
||||
|
||||
static bool
|
||||
IsHttpLiveStreamingType(const nsACString& aType)
|
||||
{
|
||||
return CodecListContains(gHttpLiveStreamingTypes, aType);
|
||||
}
|
||||
|
||||
#ifdef MOZ_FMP4
|
||||
static bool
|
||||
IsMP4SupportedType(const MediaContentType& aParsedType,
|
||||
|
|
@ -247,10 +230,6 @@ CanHandleMediaType(const MediaContentType& aType,
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (IsHttpLiveStreamingType(aType.GetMIMEType())) {
|
||||
/* Telemetry STUB */
|
||||
}
|
||||
|
||||
if (aType.HaveCodecs()) {
|
||||
CanPlayStatus result = CanHandleCodecsType(aType, aDiagnostics);
|
||||
if (result == CANPLAY_NO || result == CANPLAY_YES) {
|
||||
|
|
|
|||
|
|
@ -629,7 +629,6 @@ AudioCallbackDriver::Init()
|
|||
cubeb_stream_params output;
|
||||
cubeb_stream_params input;
|
||||
uint32_t latency_frames;
|
||||
bool firstStream = CubebUtils::GetFirstStream();
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread(),
|
||||
"This is blocking and should never run on the main thread.");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include "mozilla/dom/VideoTrack.h"
|
||||
#include "mozilla/dom/VideoTrackList.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "GMPService.h"
|
||||
#include "Layers.h"
|
||||
#include "mozilla/layers/ShadowLayers.h"
|
||||
|
|
@ -421,7 +420,6 @@ MediaDecoder::MediaDecoder(MediaDecoderOwner* aOwner)
|
|||
, INIT_CANONICAL(mPlaybackRateReliable, true)
|
||||
, INIT_CANONICAL(mDecoderPosition, 0)
|
||||
, INIT_CANONICAL(mIsVisible, !aOwner->IsHidden())
|
||||
, mTelemetryReported(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(MediaDecoder);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
|
@ -841,41 +839,6 @@ MediaDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
|
|||
// So we call Invalidate() after calling mOwner->MetadataLoaded to ensure
|
||||
// the media element has the latest dimensions.
|
||||
Invalidate();
|
||||
|
||||
EnsureTelemetryReported();
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoder::EnsureTelemetryReported()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mTelemetryReported || !mInfo) {
|
||||
// Note: sometimes we get multiple MetadataLoaded calls (for example
|
||||
// for chained ogg). So we ensure we don't report duplicate results for
|
||||
// these resources.
|
||||
return;
|
||||
}
|
||||
|
||||
nsTArray<nsCString> codecs;
|
||||
if (mInfo->HasAudio() && !mInfo->mAudio.GetAsAudioInfo()->mMimeType.IsEmpty()) {
|
||||
codecs.AppendElement(mInfo->mAudio.GetAsAudioInfo()->mMimeType);
|
||||
}
|
||||
if (mInfo->HasVideo() && !mInfo->mVideo.GetAsVideoInfo()->mMimeType.IsEmpty()) {
|
||||
codecs.AppendElement(mInfo->mVideo.GetAsVideoInfo()->mMimeType);
|
||||
}
|
||||
if (codecs.IsEmpty()) {
|
||||
if (mResource->GetContentType().IsEmpty()) {
|
||||
NS_WARNING("Somehow the resource's content type is empty");
|
||||
return;
|
||||
}
|
||||
codecs.AppendElement(nsPrintfCString("resource; %s", mResource->GetContentType().get()));
|
||||
}
|
||||
for (const nsCString& codec : codecs) {
|
||||
DECODER_LOG("Telemetry MEDIA_CODEC_USED= '%s'", codec.get());
|
||||
}
|
||||
|
||||
mTelemetryReported = true;
|
||||
}
|
||||
|
||||
const char*
|
||||
|
|
|
|||
|
|
@ -440,8 +440,6 @@ private:
|
|||
|
||||
void SetCDMProxy(CDMProxy* aProxy);
|
||||
|
||||
void EnsureTelemetryReported();
|
||||
|
||||
static bool IsOggEnabled();
|
||||
static bool IsOpusEnabled();
|
||||
static bool IsWaveEnabled();
|
||||
|
|
@ -852,8 +850,6 @@ private:
|
|||
// download has ended. Called on the main thread only. aStatus is
|
||||
// the result from OnStopRequest.
|
||||
void NotifyDownloadEnded(nsresult aStatus);
|
||||
|
||||
bool mTelemetryReported;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
|||
|
|
@ -1173,27 +1173,12 @@ StateObject::HandleShutdown()
|
|||
return SetState<ShutdownState>();
|
||||
}
|
||||
|
||||
static void
|
||||
ReportRecoveryTelemetry(const TimeStamp& aRecoveryStart,
|
||||
const MediaInfo& aMediaInfo,
|
||||
bool aIsHardwareAccelerated)
|
||||
{
|
||||
/* STUB */
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoderStateMachine::
|
||||
StateObject::HandleResumeVideoDecoding()
|
||||
{
|
||||
MOZ_ASSERT(mMaster->mVideoDecodeSuspended);
|
||||
|
||||
// Start counting recovery time from right now.
|
||||
TimeStamp start = TimeStamp::Now();
|
||||
|
||||
// Local reference to mInfo, so that it will be copied in the lambda below.
|
||||
auto& info = Info();
|
||||
bool hw = Reader()->VideoIsHardwareAccelerated();
|
||||
|
||||
// Start video-only seek to the current time.
|
||||
SeekJob seekJob;
|
||||
|
||||
|
|
@ -1205,10 +1190,7 @@ StateObject::HandleResumeVideoDecoding()
|
|||
type,
|
||||
true /* aVideoOnly */);
|
||||
|
||||
SetState<SeekingState>(Move(seekJob), EventVisibility::Suppressed)->Then(
|
||||
AbstractThread::MainThread(), __func__,
|
||||
[start, info, hw](){ ReportRecoveryTelemetry(start, info, hw); },
|
||||
[](){});
|
||||
SetState<SeekingState>(Move(seekJob), EventVisibility::Suppressed);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -2035,7 +2035,6 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
|
|||
}
|
||||
|
||||
// Determine permissions early (while we still have a stack).
|
||||
|
||||
nsIURI* docURI = aWindow->GetDocumentURI();
|
||||
if (!docURI) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
|
@ -2045,22 +2044,9 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
|
|||
Preferences::GetBool("media.navigator.permission.disabled", false);
|
||||
bool isHTTPS = false;
|
||||
docURI->SchemeIs("https", &isHTTPS);
|
||||
nsCString host;
|
||||
nsresult rv = docURI->GetHost(host);
|
||||
// Test for some other schemes that ServiceWorker recognizes
|
||||
bool isFile;
|
||||
docURI->SchemeIs("file", &isFile);
|
||||
bool isApp;
|
||||
docURI->SchemeIs("app", &isApp);
|
||||
// Same localhost check as ServiceWorkers uses
|
||||
// (see IsOriginPotentiallyTrustworthy())
|
||||
bool isLocalhost = NS_SUCCEEDED(rv) &&
|
||||
(host.LowerCaseEqualsLiteral("localhost") ||
|
||||
host.LowerCaseEqualsLiteral("127.0.0.1") ||
|
||||
host.LowerCaseEqualsLiteral("::1"));
|
||||
|
||||
nsCString origin;
|
||||
rv = nsPrincipal::GetOriginForURI(docURI, origin);
|
||||
nsresult rv = nsPrincipal::GetOriginForURI(docURI, origin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
#include "mp4_demuxer/Index.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
// Used for telemetry
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mp4_demuxer/AnnexB.h"
|
||||
#include "mp4_demuxer/H264.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
|
|
@ -72,23 +69,10 @@ private:
|
|||
// Queued samples extracted by the demuxer, but not yet returned.
|
||||
RefPtr<MediaRawData> mQueuedSample;
|
||||
bool mNeedReIndex;
|
||||
bool mNeedSPSForTelemetry;
|
||||
bool mIsH264 = false;
|
||||
};
|
||||
|
||||
|
||||
// Returns true if no SPS was found and search for it should continue.
|
||||
bool
|
||||
AccumulateSPSTelemetry(const MediaByteBuffer* aExtradata)
|
||||
{
|
||||
// XXX: Do we still need this without telemetry?
|
||||
mp4_demuxer::SPSData spsdata;
|
||||
if (mp4_demuxer::H264::DecodeSPSFromExtraData(aExtradata, spsdata)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
MP4Demuxer::MP4Demuxer(MediaResource* aResource)
|
||||
: mResource(aResource)
|
||||
, mStream(new mp4_demuxer::ResourceStream(aResource))
|
||||
|
|
@ -219,25 +203,10 @@ MP4TrackDemuxer::MP4TrackDemuxer(MP4Demuxer* aParent,
|
|||
EnsureUpToDateIndex(); // Force update of index
|
||||
|
||||
VideoInfo* videoInfo = mInfo->GetAsVideoInfo();
|
||||
// Collect telemetry from h264 AVCC SPS.
|
||||
if (videoInfo &&
|
||||
(mInfo->mMimeType.EqualsLiteral("video/mp4") ||
|
||||
mInfo->mMimeType.EqualsLiteral("video/avc"))) {
|
||||
mIsH264 = true;
|
||||
RefPtr<MediaByteBuffer> extraData = videoInfo->mExtraData;
|
||||
mNeedSPSForTelemetry = AccumulateSPSTelemetry(extraData);
|
||||
mp4_demuxer::SPSData spsdata;
|
||||
if (mp4_demuxer::H264::DecodeSPSFromExtraData(extraData, spsdata) &&
|
||||
spsdata.pic_width > 0 && spsdata.pic_height > 0 &&
|
||||
mp4_demuxer::H264::EnsureSPSIsSane(spsdata)) {
|
||||
videoInfo->mImage.width = spsdata.pic_width;
|
||||
videoInfo->mImage.height = spsdata.pic_height;
|
||||
videoInfo->mDisplay.width = spsdata.display_width;
|
||||
videoInfo->mDisplay.height = spsdata.display_height;
|
||||
}
|
||||
} else {
|
||||
// No SPS to be found.
|
||||
mNeedSPSForTelemetry = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -364,15 +333,6 @@ MP4TrackDemuxer::GetSamples(int32_t aNumSamples)
|
|||
if (samples->mSamples.IsEmpty()) {
|
||||
return SamplesPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_END_OF_STREAM, __func__);
|
||||
} else {
|
||||
for (const auto& sample : samples->mSamples) {
|
||||
// Collect telemetry from h264 Annex B SPS.
|
||||
if (mNeedSPSForTelemetry && mp4_demuxer::AnnexB::HasSPS(sample)) {
|
||||
RefPtr<MediaByteBuffer> extradata =
|
||||
mp4_demuxer::AnnexB::ExtractExtraData(sample);
|
||||
mNeedSPSForTelemetry = AccumulateSPSTelemetry(extradata);
|
||||
}
|
||||
}
|
||||
|
||||
if (mNextKeyframeTime.isNothing() ||
|
||||
samples->mSamples.LastElement()->mTime >= mNextKeyframeTime.value().ToMicroseconds()) {
|
||||
SetNextKeyFrameTime();
|
||||
|
|
|
|||
|
|
@ -38,39 +38,6 @@ WMFMediaDataDecoder::Init()
|
|||
return InitPromise::CreateAndResolve(mMFTManager->GetType(), __func__);
|
||||
}
|
||||
|
||||
// A single telemetry sample is reported for each MediaDataDecoder object
|
||||
// that has detected error or produced output successfully.
|
||||
static void
|
||||
SendTelemetry(unsigned long hr)
|
||||
{
|
||||
// Collapse the error codes into a range of 0-0xff that can be viewed in
|
||||
// telemetry histograms. For most MF_E_* errors, unique samples are used,
|
||||
// retaining the least significant 7 or 8 bits. Other error codes are
|
||||
// bucketed.
|
||||
uint32_t sample;
|
||||
if (SUCCEEDED(hr)) {
|
||||
sample = 0;
|
||||
} else if (hr < 0xc00d36b0) {
|
||||
sample = 1; // low bucket
|
||||
} else if (hr < 0xc00d3700) {
|
||||
sample = hr & 0xffU; // MF_E_*
|
||||
} else if (hr <= 0xc00d3705) {
|
||||
sample = 0x80 + (hr & 0xfU); // more MF_E_*
|
||||
} else if (hr < 0xc00d6d60) {
|
||||
sample = 2; // mid bucket
|
||||
} else if (hr <= 0xc00d6d78) {
|
||||
sample = hr & 0xffU; // MF_E_TRANSFORM_*
|
||||
} else {
|
||||
sample = 3; // high bucket
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction(
|
||||
[sample] {
|
||||
/* Telemetry STUB */
|
||||
});
|
||||
NS_DispatchToMainThread(runnable);
|
||||
}
|
||||
|
||||
void
|
||||
WMFMediaDataDecoder::Shutdown()
|
||||
{
|
||||
|
|
@ -90,9 +57,6 @@ WMFMediaDataDecoder::ProcessShutdown()
|
|||
if (mMFTManager) {
|
||||
mMFTManager->Shutdown();
|
||||
mMFTManager = nullptr;
|
||||
if (!mRecordedError && mHasSuccessfulOutput) {
|
||||
SendTelemetry(S_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -124,10 +88,6 @@ WMFMediaDataDecoder::ProcessDecode(MediaRawData* aSample)
|
|||
NS_WARNING("MFTManager rejected sample");
|
||||
mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
|
||||
RESULT_DETAIL("MFTManager::Input:%x", hr)));
|
||||
if (!mRecordedError) {
|
||||
SendTelemetry(hr);
|
||||
mRecordedError = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +103,6 @@ WMFMediaDataDecoder::ProcessOutput()
|
|||
HRESULT hr = S_OK;
|
||||
while (SUCCEEDED(hr = mMFTManager->Output(mLastStreamOffset, output)) &&
|
||||
output) {
|
||||
mHasSuccessfulOutput = true;
|
||||
mCallback->Output(output);
|
||||
}
|
||||
if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) {
|
||||
|
|
@ -152,10 +111,6 @@ WMFMediaDataDecoder::ProcessOutput()
|
|||
NS_WARNING("WMFMediaDataDecoder failed to output data");
|
||||
mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
|
||||
RESULT_DETAIL("MFTManager::Output:%x", hr)));
|
||||
if (!mRecordedError) {
|
||||
SendTelemetry(hr);
|
||||
mRecordedError = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,10 +136,6 @@ private:
|
|||
Atomic<bool> mIsFlushing;
|
||||
|
||||
bool mIsShutDown;
|
||||
|
||||
// For telemetry
|
||||
bool mHasSuccessfulOutput = false;
|
||||
bool mRecordedError = false;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue