diff options
-rw-r--r-- | accessible/base/NotificationController.cpp | 1 | ||||
-rw-r--r-- | dom/media/eme/DetailedPromise.cpp | 44 | ||||
-rw-r--r-- | dom/media/eme/DetailedPromise.h | 15 | ||||
-rw-r--r-- | dom/media/eme/EMEUtils.cpp | 11 | ||||
-rw-r--r-- | dom/media/eme/EMEUtils.h | 3 | ||||
-rwxr-xr-x | media/webrtc/signaling/src/media-conduit/AudioConduit.cpp | 1 | ||||
-rw-r--r-- | media/webrtc/signaling/src/media-conduit/CodecStatistics.cpp | 1 | ||||
-rw-r--r-- | media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp | 152 | ||||
-rw-r--r-- | media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h | 5 | ||||
-rw-r--r-- | media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h | 11 | ||||
-rw-r--r-- | media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp | 78 |
11 files changed, 3 insertions, 319 deletions
diff --git a/accessible/base/NotificationController.cpp b/accessible/base/NotificationController.cpp index 30382e75e3..adde8e4128 100644 --- a/accessible/base/NotificationController.cpp +++ b/accessible/base/NotificationController.cpp @@ -13,7 +13,6 @@ #include "mozilla/dom/TabChild.h" #include "mozilla/dom/Element.h" -#include "mozilla/Telemetry.h" using namespace mozilla; using namespace mozilla::a11y; diff --git a/dom/media/eme/DetailedPromise.cpp b/dom/media/eme/DetailedPromise.cpp index 50642bacda..1aa83bef5d 100644 --- a/dom/media/eme/DetailedPromise.cpp +++ b/dom/media/eme/DetailedPromise.cpp @@ -19,23 +19,8 @@ DetailedPromise::DetailedPromise(nsIGlobalObject* aGlobal, { } -DetailedPromise::DetailedPromise(nsIGlobalObject* aGlobal, - const nsACString& aName, - Telemetry::ID aSuccessLatencyProbe, - Telemetry::ID aFailureLatencyProbe) - : DetailedPromise(aGlobal, aName) -{ - mSuccessLatencyProbe.Construct(aSuccessLatencyProbe); - mFailureLatencyProbe.Construct(aFailureLatencyProbe); -} - DetailedPromise::~DetailedPromise() { - // It would be nice to assert that mResponded is identical to - // GetPromiseState() == PromiseState::Rejected. But by now we've been - // unlinked, so don't have a reference to our actual JS Promise object - // anymore. - MaybeReportTelemetry(Failed); } void @@ -45,8 +30,6 @@ DetailedPromise::MaybeReject(nsresult aArg, const nsACString& aReason) PromiseFlatCString(aReason).get()); EME_LOG(msg.get()); - MaybeReportTelemetry(Failed); - LogToBrowserConsole(NS_ConvertUTF8toUTF16(msg)); ErrorResult rv; @@ -70,32 +53,5 @@ DetailedPromise::Create(nsIGlobalObject* aGlobal, return aRv.Failed() ? nullptr : promise.forget(); } -/* static */ already_AddRefed<DetailedPromise> -DetailedPromise::Create(nsIGlobalObject* aGlobal, - ErrorResult& aRv, - const nsACString& aName, - Telemetry::ID aSuccessLatencyProbe, - Telemetry::ID aFailureLatencyProbe) -{ - RefPtr<DetailedPromise> promise = new DetailedPromise(aGlobal, aName, aSuccessLatencyProbe, aFailureLatencyProbe); - promise->CreateWrapper(nullptr, aRv); - return aRv.Failed() ? nullptr : promise.forget(); -} - -void -DetailedPromise::MaybeReportTelemetry(Status aStatus) -{ - if (mResponded) { - return; - } - mResponded = true; - if (!mSuccessLatencyProbe.WasPassed() || !mFailureLatencyProbe.WasPassed()) { - return; - } - uint32_t latency = (TimeStamp::Now() - mStartTime).ToMilliseconds(); - EME_LOG("%s %s latency %ums reported via telemetry", mName.get(), - ((aStatus == Succeeded) ? "succcess" : "failure"), latency); -} - } // namespace dom } // namespace mozilla diff --git a/dom/media/eme/DetailedPromise.h b/dom/media/eme/DetailedPromise.h index d75f098627..f7f10aa403 100644 --- a/dom/media/eme/DetailedPromise.h +++ b/dom/media/eme/DetailedPromise.h @@ -7,7 +7,6 @@ #define __DetailedPromise_h__ #include "mozilla/dom/Promise.h" -#include "mozilla/Telemetry.h" #include "EMEUtils.h" namespace mozilla { @@ -26,17 +25,10 @@ public: ErrorResult& aRv, const nsACString& aName); - static already_AddRefed<DetailedPromise> - Create(nsIGlobalObject* aGlobal, ErrorResult& aRv, - const nsACString& aName, - Telemetry::ID aSuccessLatencyProbe, - Telemetry::ID aFailureLatencyProbe); - template <typename T> void MaybeResolve(const T& aArg) { EME_LOG("%s promise resolved", mName.get()); - MaybeReportTelemetry(Succeeded); Promise::MaybeResolve<T>(aArg); } @@ -50,20 +42,13 @@ private: explicit DetailedPromise(nsIGlobalObject* aGlobal, const nsACString& aName); - explicit DetailedPromise(nsIGlobalObject* aGlobal, - const nsACString& aName, - Telemetry::ID aSuccessLatencyProbe, - Telemetry::ID aFailureLatencyProbe); virtual ~DetailedPromise(); enum Status { Succeeded, Failed }; - void MaybeReportTelemetry(Status aStatus); nsCString mName; bool mResponded; TimeStamp mStartTime; - Optional<Telemetry::ID> mSuccessLatencyProbe; - Optional<Telemetry::ID> mFailureLatencyProbe; }; } // namespace dom diff --git a/dom/media/eme/EMEUtils.cpp b/dom/media/eme/EMEUtils.cpp index fd51b0ae2a..68ef52d83e 100644 --- a/dom/media/eme/EMEUtils.cpp +++ b/dom/media/eme/EMEUtils.cpp @@ -83,15 +83,4 @@ KeySystemToGMPName(const nsAString& aKeySystem) return EmptyString(); } -CDMType -ToCDMTypeTelemetryEnum(const nsString& aKeySystem) -{ - if (IsWidevineKeySystem(aKeySystem)) { - return CDMType::eWidevine; - } else if (IsClearkeyKeySystem(aKeySystem)) { - return CDMType::eClearKey; - } - return CDMType::eUnknown; -} - } // namespace mozilla diff --git a/dom/media/eme/EMEUtils.h b/dom/media/eme/EMEUtils.h index b16f5b4ac0..aef1574829 100644 --- a/dom/media/eme/EMEUtils.h +++ b/dom/media/eme/EMEUtils.h @@ -99,9 +99,6 @@ enum CDMType { eUnknown = 3 }; -CDMType -ToCDMTypeTelemetryEnum(const nsString& aKeySystem); - } // namespace mozilla #endif // EME_LOG_H_ diff --git a/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp b/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp index 42a50533a4..2fa052c725 100755 --- a/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp +++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp @@ -20,7 +20,6 @@ #include "nsThreadUtils.h" #if !defined(MOZILLA_EXTERNAL_LINKAGE) #include "Latency.h" -#include "mozilla/Telemetry.h" #endif #include "webrtc/common.h" diff --git a/media/webrtc/signaling/src/media-conduit/CodecStatistics.cpp b/media/webrtc/signaling/src/media-conduit/CodecStatistics.cpp index da40a59eac..6441b8dd88 100644 --- a/media/webrtc/signaling/src/media-conduit/CodecStatistics.cpp +++ b/media/webrtc/signaling/src/media-conduit/CodecStatistics.cpp @@ -5,7 +5,6 @@ #include "CodecStatistics.h" #include "CSFLog.h" -#include "mozilla/Telemetry.h" using namespace mozilla; using namespace webrtc; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp index 515258efba..e0a1d70103 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp @@ -9,7 +9,6 @@ #include "runnable_utils.h" #include "prcvar.h" -#include "mozilla/Telemetry.h" #include "browser_logging/WebRtcLog.h" #if !defined(MOZILLA_EXTERNAL_LINKAGE) @@ -163,7 +162,6 @@ void PeerConnectionCtx::Destroy() { #if !defined(MOZILLA_EXTERNAL_LINKAGE) typedef Vector<nsAutoPtr<RTCStatsQuery>> RTCStatsQueries; -// Telemetry reporting every second after start of first call. // The threading model around the media pipelines is weird: // - The pipelines are containers, // - containers that are only safe on main thread, with members only safe on STS, @@ -196,155 +194,12 @@ FreeOnMain_m(nsAutoPtr<RTCStatsQueries> aQueryList) { MOZ_ASSERT(NS_IsMainThread()); } -static void -EverySecondTelemetryCallback_s(nsAutoPtr<RTCStatsQueries> aQueryList) { - using namespace Telemetry; - - if(!PeerConnectionCtx::isActive()) { - return; - } - PeerConnectionCtx *ctx = PeerConnectionCtx::GetInstance(); - - for (auto q = aQueryList->begin(); q != aQueryList->end(); ++q) { - PeerConnectionImpl::ExecuteStatsQuery_s(*q); - auto& r = *(*q)->report; - if (r.mInboundRTPStreamStats.WasPassed()) { - // First, get reports from a second ago, if any, for calculations below - const Sequence<RTCInboundRTPStreamStats> *lastInboundStats = nullptr; - { - auto i = FindId(ctx->mLastReports, r.mPcid); - if (i != ctx->mLastReports.NoIndex) { - lastInboundStats = &ctx->mLastReports[i]->mInboundRTPStreamStats.Value(); - } - } - // Then, look for the things we want telemetry on - auto& array = r.mInboundRTPStreamStats.Value(); - for (decltype(array.Length()) i = 0; i < array.Length(); i++) { - auto& s = array[i]; - bool isAudio = (s.mId.Value().Find("audio") != -1); - if (s.mPacketsLost.WasPassed() && s.mPacketsReceived.WasPassed() && - (s.mPacketsLost.Value() + s.mPacketsReceived.Value()) != 0) { - ID id; - if (s.mIsRemote) { - id = isAudio ? WEBRTC_AUDIO_QUALITY_OUTBOUND_PACKETLOSS_RATE : - WEBRTC_VIDEO_QUALITY_OUTBOUND_PACKETLOSS_RATE; - } else { - id = isAudio ? WEBRTC_AUDIO_QUALITY_INBOUND_PACKETLOSS_RATE : - WEBRTC_VIDEO_QUALITY_INBOUND_PACKETLOSS_RATE; - } - // *1000 so we can read in 10's of a percent (permille) - Accumulate(id, - (s.mPacketsLost.Value() * 1000) / - (s.mPacketsLost.Value() + s.mPacketsReceived.Value())); - } - if (s.mJitter.WasPassed()) { - ID id; - if (s.mIsRemote) { - id = isAudio ? WEBRTC_AUDIO_QUALITY_OUTBOUND_JITTER : - WEBRTC_VIDEO_QUALITY_OUTBOUND_JITTER; - } else { - id = isAudio ? WEBRTC_AUDIO_QUALITY_INBOUND_JITTER : - WEBRTC_VIDEO_QUALITY_INBOUND_JITTER; - } - Accumulate(id, s.mJitter.Value()); - } - if (s.mMozRtt.WasPassed()) { - MOZ_ASSERT(s.mIsRemote); - ID id = isAudio ? WEBRTC_AUDIO_QUALITY_OUTBOUND_RTT : - WEBRTC_VIDEO_QUALITY_OUTBOUND_RTT; - Accumulate(id, s.mMozRtt.Value()); - } - if (lastInboundStats && s.mBytesReceived.WasPassed()) { - auto& laststats = *lastInboundStats; - auto i = FindId(laststats, s.mId.Value()); - if (i != laststats.NoIndex) { - auto& lasts = laststats[i]; - if (lasts.mBytesReceived.WasPassed()) { - auto delta_ms = int32_t(s.mTimestamp.Value() - - lasts.mTimestamp.Value()); - // In theory we're called every second, so delta *should* be in that range. - // Small deltas could cause errors due to division - if (delta_ms > 500 && delta_ms < 60000) { - ID id; - if (s.mIsRemote) { - id = isAudio ? WEBRTC_AUDIO_QUALITY_OUTBOUND_BANDWIDTH_KBITS : - WEBRTC_VIDEO_QUALITY_OUTBOUND_BANDWIDTH_KBITS; - } else { - id = isAudio ? WEBRTC_AUDIO_QUALITY_INBOUND_BANDWIDTH_KBITS : - WEBRTC_VIDEO_QUALITY_INBOUND_BANDWIDTH_KBITS; - } - Accumulate(id, ((s.mBytesReceived.Value() - - lasts.mBytesReceived.Value()) * 8) / delta_ms); - } - // We could accumulate values until enough time has passed - // and then Accumulate() but this isn't that important. - } - } - } - } - } - } - // Steal and hang on to reports for the next second - ctx->mLastReports.Clear(); - for (auto q = aQueryList->begin(); q != aQueryList->end(); ++q) { - ctx->mLastReports.AppendElement((*q)->report.forget()); // steal avoids copy - } - // Container must be freed back on main thread - NS_DispatchToMainThread(WrapRunnableNM(&FreeOnMain_m, aQueryList), - NS_DISPATCH_NORMAL); -} - -void -PeerConnectionCtx::EverySecondTelemetryCallback_m(nsITimer* timer, void *closure) { - MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(PeerConnectionCtx::isActive()); - auto ctx = static_cast<PeerConnectionCtx*>(closure); - if (ctx->mPeerConnections.empty()) { - return; - } - nsresult rv; - nsCOMPtr<nsIEventTarget> stsThread = - do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); - if (NS_FAILED(rv)) { - return; - } - MOZ_ASSERT(stsThread); - - nsAutoPtr<RTCStatsQueries> queries(new RTCStatsQueries); - for (auto p = ctx->mPeerConnections.begin(); - p != ctx->mPeerConnections.end(); ++p) { - if (p->second->HasMedia()) { - if (!queries->append(nsAutoPtr<RTCStatsQuery>(new RTCStatsQuery(true)))) { - return; - } - if (NS_WARN_IF(NS_FAILED(p->second->BuildStatsQuery_m(nullptr, // all tracks - queries->back())))) { - queries->popBack(); - } else { - MOZ_ASSERT(queries->back()->report); - } - } - } - if (!queries->empty()) { - rv = RUN_ON_THREAD(stsThread, - WrapRunnableNM(&EverySecondTelemetryCallback_s, queries), - NS_DISPATCH_NORMAL); - NS_ENSURE_SUCCESS_VOID(rv); - } -} #endif nsresult PeerConnectionCtx::Initialize() { initGMP(); #if !defined(MOZILLA_EXTERNAL_LINKAGE) - mTelemetryTimer = do_CreateInstance(NS_TIMER_CONTRACTID); - MOZ_ASSERT(mTelemetryTimer); - nsresult rv = mTelemetryTimer->SetTarget(gMainThread); - NS_ENSURE_SUCCESS(rv, rv); - mTelemetryTimer->InitWithFuncCallback(EverySecondTelemetryCallback_m, this, 1000, - nsITimer::TYPE_REPEATING_PRECISE_CAN_SKIP); - if (XRE_IsContentProcess()) { WebrtcGlobalChild::Create(); } @@ -399,13 +254,6 @@ nsresult PeerConnectionCtx::Cleanup() { } PeerConnectionCtx::~PeerConnectionCtx() { - // ensure mTelemetryTimer ends on main thread - MOZ_ASSERT(NS_IsMainThread()); -#if !defined(MOZILLA_EXTERNAL_LINKAGE) - if (mTelemetryTimer) { - mTelemetryTimer->Cancel(); - } -#endif }; void PeerConnectionCtx::queueJSEPOperation(nsIRunnable* aOperation) { diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h index 3f7d6250b0..6ab75a95cb 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h @@ -76,12 +76,7 @@ class PeerConnectionCtx { void initGMP(); - static void - EverySecondTelemetryCallback_m(nsITimer* timer, void *); - #if !defined(MOZILLA_EXTERNAL_LINKAGE) - nsCOMPtr<nsITimer> mTelemetryTimer; - public: // TODO(jib): If we ever enable move semantics on std::map... //std::map<nsString,nsAutoPtr<mozilla::dom::RTCStatsReportInternal>> mLastReports; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index 6229e1c95b..7b53ea1160 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -210,7 +210,6 @@ class RTCStatsQuery { nsAutoPtr<mozilla::dom::RTCStatsReportInternal> report; std::string error; - // A timestamp to help with telemetry. mozilla::TimeStamp iceStartTime; // Just for convenience, maybe integrate into the report later bool failed; @@ -734,10 +733,7 @@ private: #endif // When ICE completes, we record a bunch of statistics that outlive the - // PeerConnection. This is just telemetry right now, but this can also - // include things like dumping the RLogConnector somewhere, saving away - // an RTCStatsReport somewhere so it can be inspected after the call is over, - // or other things. + // PeerConnection. void RecordLongtermICEStatistics(); void OnNegotiationNeeded(); @@ -816,9 +812,9 @@ private: std::string mPreviousIcePwd; // used during rollback of ice restart #if !defined(MOZILLA_EXTERNAL_LINKAGE) - // Start time of ICE, used for telemetry + // Start time of ICE mozilla::TimeStamp mIceStartTime; - // Start time of call used for Telemetry + // Start time of call mozilla::TimeStamp mStartTime; #endif @@ -840,7 +836,6 @@ private: bool mPrivateWindow; - // storage for Telemetry data uint16_t mMaxReceiving[SdpMediaSection::kMediaTypes]; uint16_t mMaxSending[SdpMediaSection::kMediaTypes]; diff --git a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp index f283d61110..2f860cac60 100644 --- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp +++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp @@ -25,7 +25,6 @@ #include "mozilla/ErrorResult.h" #include "mozilla/Vector.h" #include "nsProxyRelease.h" -#include "mozilla/Telemetry.h" #include "mozilla/Unused.h" #include "mozilla/StaticMutex.h" #include "mozilla/RefPtr.h" @@ -977,8 +976,6 @@ static void StoreLongTermICEStatisticsImpl_m( nsresult result, nsAutoPtr<RTCStatsQuery> query) { - using namespace Telemetry; - if (NS_FAILED(result) || !query->error.empty() || !query->report->mIceCandidateStats.WasPassed()) { @@ -1090,81 +1087,6 @@ static void StoreLongTermICEStatisticsImpl_m( streamResults[streamId].candidateTypeBitpattern |= candBitmask; } - for (auto i = streamResults.begin(); i != streamResults.end(); ++i) { - Telemetry::RecordWebrtcIceCandidates(i->second.candidateTypeBitpattern, - i->second.streamSucceeded); - } - - // Beyond ICE, accumulate telemetry for various PER_CALL settings here. - - if (query->report->mOutboundRTPStreamStats.WasPassed()) { - auto& array = query->report->mOutboundRTPStreamStats.Value(); - for (decltype(array.Length()) i = 0; i < array.Length(); i++) { - auto& s = array[i]; - bool isVideo = (s.mId.Value().Find("video") != -1); - if (!isVideo || s.mIsRemote) { - continue; - } - if (s.mBitrateMean.WasPassed()) { - Accumulate(WEBRTC_VIDEO_ENCODER_BITRATE_AVG_PER_CALL_KBPS, - uint32_t(s.mBitrateMean.Value() / 1000)); - } - if (s.mBitrateStdDev.WasPassed()) { - Accumulate(WEBRTC_VIDEO_ENCODER_BITRATE_STD_DEV_PER_CALL_KBPS, - uint32_t(s.mBitrateStdDev.Value() / 1000)); - } - if (s.mFramerateMean.WasPassed()) { - Accumulate(WEBRTC_VIDEO_ENCODER_FRAMERATE_AVG_PER_CALL, - uint32_t(s.mFramerateMean.Value())); - } - if (s.mFramerateStdDev.WasPassed()) { - Accumulate(WEBRTC_VIDEO_ENCODER_FRAMERATE_10X_STD_DEV_PER_CALL, - uint32_t(s.mFramerateStdDev.Value() * 10)); - } - if (s.mDroppedFrames.WasPassed() && !query->iceStartTime.IsNull()) { - double mins = (TimeStamp::Now() - query->iceStartTime).ToSeconds() / 60; - if (mins > 0) { - Accumulate(WEBRTC_VIDEO_ENCODER_DROPPED_FRAMES_PER_CALL_FPM, - uint32_t(double(s.mDroppedFrames.Value()) / mins)); - } - } - } - } - - if (query->report->mInboundRTPStreamStats.WasPassed()) { - auto& array = query->report->mInboundRTPStreamStats.Value(); - for (decltype(array.Length()) i = 0; i < array.Length(); i++) { - auto& s = array[i]; - bool isVideo = (s.mId.Value().Find("video") != -1); - if (!isVideo || s.mIsRemote) { - continue; - } - if (s.mBitrateMean.WasPassed()) { - Accumulate(WEBRTC_VIDEO_DECODER_BITRATE_AVG_PER_CALL_KBPS, - uint32_t(s.mBitrateMean.Value() / 1000)); - } - if (s.mBitrateStdDev.WasPassed()) { - Accumulate(WEBRTC_VIDEO_DECODER_BITRATE_STD_DEV_PER_CALL_KBPS, - uint32_t(s.mBitrateStdDev.Value() / 1000)); - } - if (s.mFramerateMean.WasPassed()) { - Accumulate(WEBRTC_VIDEO_DECODER_FRAMERATE_AVG_PER_CALL, - uint32_t(s.mFramerateMean.Value())); - } - if (s.mFramerateStdDev.WasPassed()) { - Accumulate(WEBRTC_VIDEO_DECODER_FRAMERATE_10X_STD_DEV_PER_CALL, - uint32_t(s.mFramerateStdDev.Value() * 10)); - } - if (s.mDiscardedPackets.WasPassed() && !query->iceStartTime.IsNull()) { - double mins = (TimeStamp::Now() - query->iceStartTime).ToSeconds() / 60; - if (mins > 0) { - Accumulate(WEBRTC_VIDEO_DECODER_DISCARDED_PACKETS_PER_CALL_PPM, - uint32_t(double(s.mDiscardedPackets.Value()) / mins)); - } - } - } - } - // Finally, store the stats PeerConnectionCtx *ctx = GetPeerConnectionCtx(); |