diff --git a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp index bcd850e46050..a2221f149f1e 100644 --- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp +++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp @@ -242,6 +242,8 @@ static void StoreLongTermICEStatisticsImpl_m( nsresult result, nsAutoPtr query) { + using namespace Telemetry; + if (NS_FAILED(result) || !query->error.empty() || !query->report->mIceCandidateStats.WasPassed()) { @@ -346,6 +348,78 @@ static void StoreLongTermICEStatisticsImpl_m( } } + // 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()) { + 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()) { + 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(); if (ctx) { ctx->mStatsForClosedPeerConnections.AppendElement(*query->report); diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index f3284105c8e9..9b7ee013ff3a 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -5338,6 +5338,76 @@ "n_buckets": 1000, "description": "Roundtrip time of outbound audio (ms). Sampled every second of a call." }, + "WEBRTC_VIDEO_ENCODER_BITRATE_AVG_PER_CALL_KBPS": { + "expires_in_version": "never", + "kind": "exponential", + "high": 10000, + "n_buckets": 100, + "description": "Video encoder's average bitrate (in kbits/s) over an entire call" + }, + "WEBRTC_VIDEO_ENCODER_BITRATE_STD_DEV_PER_CALL_KBPS": { + "expires_in_version": "never", + "kind": "exponential", + "high": 5000, + "n_buckets": 100, + "description": "Standard deviation from video encoder's average bitrate (in kbits/s) over an entire call" + }, + "WEBRTC_VIDEO_ENCODER_FRAMERATE_AVG_PER_CALL": { + "expires_in_version": "never", + "kind": "exponential", + "high": 200, + "n_buckets": 50, + "description": "Video encoder's average framerate (in fps) over an entire call" + }, + "WEBRTC_VIDEO_ENCODER_FRAMERATE_10X_STD_DEV_PER_CALL": { + "expires_in_version": "never", + "kind": "exponential", + "high": 200, + "n_buckets": 50, + "description": "Standard deviation from video encoder's average framerate (in 1/10 fps) over an entire call" + }, + "WEBRTC_VIDEO_ENCODER_DROPPED_FRAMES_PER_CALL_FPM": { + "expires_in_version": "never", + "kind": "exponential", + "high": 50000, + "n_buckets": 100, + "description": "Video encoder's number of frames dropped (in frames/min) over an entire call" + }, + "WEBRTC_VIDEO_DECODER_BITRATE_AVG_PER_CALL_KBPS": { + "expires_in_version": "never", + "kind": "exponential", + "high": 10000, + "n_buckets": 100, + "description": "Video decoder's average bitrate (in kbits/s) over an entire call" + }, + "WEBRTC_VIDEO_DECODER_BITRATE_STD_DEV_PER_CALL_KBPS": { + "expires_in_version": "never", + "kind": "exponential", + "high": 5000, + "n_buckets": 100, + "description": "Standard deviation from video decoder's average bitrate (in kbits/s) over an entire call" + }, + "WEBRTC_VIDEO_DECODER_FRAMERATE_AVG_PER_CALL": { + "expires_in_version": "never", + "kind": "exponential", + "high": "200", + "n_buckets": "50", + "description": "Video decoder's average framerate (in fps) over an entire call" + }, + "WEBRTC_VIDEO_DECODER_FRAMERATE_10X_STD_DEV_PER_CALL": { + "expires_in_version": "never", + "kind": "exponential", + "high": "200", + "n_buckets": "50", + "description": "Standard deviation from video decoder's average framerate (in 1/10 fps) over an entire call" + }, + "WEBRTC_VIDEO_DECODER_DISCARDED_PACKETS_PER_CALL_PPM": { + "expires_in_version": "never", + "kind": "exponential", + "high": 50000, + "n_buckets": 100, + "description": "Video decoder's number of discarded packets (in packets/min) over an entire call" + }, "WEBRTC_CALL_DURATION": { "expires_in_version": "never", "kind": "exponential",