summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/modules/rtp_rtcp/include/rtcp_statistics.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /third_party/libwebrtc/modules/rtp_rtcp/include/rtcp_statistics.h
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/modules/rtp_rtcp/include/rtcp_statistics.h')
-rw-r--r--third_party/libwebrtc/modules/rtp_rtcp/include/rtcp_statistics.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/third_party/libwebrtc/modules/rtp_rtcp/include/rtcp_statistics.h b/third_party/libwebrtc/modules/rtp_rtcp/include/rtcp_statistics.h
new file mode 100644
index 0000000000..6d6246d8a8
--- /dev/null
+++ b/third_party/libwebrtc/modules/rtp_rtcp/include/rtcp_statistics.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef MODULES_RTP_RTCP_INCLUDE_RTCP_STATISTICS_H_
+#define MODULES_RTP_RTCP_INCLUDE_RTCP_STATISTICS_H_
+
+#include <stdint.h>
+
+#include "absl/strings/string_view.h"
+
+namespace webrtc {
+
+// Statistics for RTCP packet types.
+struct RtcpPacketTypeCounter {
+ RtcpPacketTypeCounter()
+ : nack_packets(0),
+ fir_packets(0),
+ pli_packets(0),
+ nack_requests(0),
+ unique_nack_requests(0) {}
+
+ void Add(const RtcpPacketTypeCounter& other) {
+ nack_packets += other.nack_packets;
+ fir_packets += other.fir_packets;
+ pli_packets += other.pli_packets;
+ nack_requests += other.nack_requests;
+ unique_nack_requests += other.unique_nack_requests;
+ }
+
+ void Subtract(const RtcpPacketTypeCounter& other) {
+ nack_packets -= other.nack_packets;
+ fir_packets -= other.fir_packets;
+ pli_packets -= other.pli_packets;
+ nack_requests -= other.nack_requests;
+ unique_nack_requests -= other.unique_nack_requests;
+ }
+
+ int UniqueNackRequestsInPercent() const {
+ if (nack_requests == 0) {
+ return 0;
+ }
+ return static_cast<int>((unique_nack_requests * 100.0f / nack_requests) +
+ 0.5f);
+ }
+
+ uint32_t nack_packets; // Number of RTCP NACK packets.
+ uint32_t fir_packets; // Number of RTCP FIR packets.
+ uint32_t pli_packets; // Number of RTCP PLI packets.
+ uint32_t nack_requests; // Number of NACKed RTP packets.
+ uint32_t unique_nack_requests; // Number of unique NACKed RTP packets.
+};
+
+class RtcpPacketTypeCounterObserver {
+ public:
+ virtual ~RtcpPacketTypeCounterObserver() {}
+ virtual void RtcpPacketTypesCounterUpdated(
+ uint32_t ssrc,
+ const RtcpPacketTypeCounter& packet_counter) = 0;
+};
+
+// Invoked for each cname passed in RTCP SDES blocks.
+class RtcpCnameCallback {
+ public:
+ virtual ~RtcpCnameCallback() = default;
+
+ virtual void OnCname(uint32_t ssrc, absl::string_view cname) = 0;
+};
+
+} // namespace webrtc
+#endif // MODULES_RTP_RTCP_INCLUDE_RTCP_STATISTICS_H_