summaryrefslogtreecommitdiff
path: root/media/webrtc
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-10-31 21:06:24 +0000
committerMoonchild <moonchild@palemoon.org>2022-04-02 14:48:02 +0200
commit023a71c6f2007eb08116ce539920f7cd11d52d8d (patch)
tree79a52d97616d0257927d3ad4b6abbf4570f103cc /media/webrtc
parentc83282fd4df510e77c7c7ffa89f2b49f8d0ec304 (diff)
downloaduxp-023a71c6f2007eb08116ce539920f7cd11d52d8d.tar.gz
Issue #21 - Remove Telemetry from Accessibility, EME and WebRTC.
Diffstat (limited to 'media/webrtc')
-rwxr-xr-xmedia/webrtc/signaling/src/media-conduit/AudioConduit.cpp1
-rw-r--r--media/webrtc/signaling/src/media-conduit/CodecStatistics.cpp1
-rw-r--r--media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp152
-rw-r--r--media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h5
-rw-r--r--media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h11
-rw-r--r--media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp78
6 files changed, 3 insertions, 245 deletions
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();