summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/modules/include
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/include
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/include')
-rw-r--r--third_party/libwebrtc/modules/include/module_common_types.h66
-rw-r--r--third_party/libwebrtc/modules/include/module_common_types_public.h62
-rw-r--r--third_party/libwebrtc/modules/include/module_fec_types.h34
3 files changed, 162 insertions, 0 deletions
diff --git a/third_party/libwebrtc/modules/include/module_common_types.h b/third_party/libwebrtc/modules/include/module_common_types.h
new file mode 100644
index 0000000000..8e4e5465fa
--- /dev/null
+++ b/third_party/libwebrtc/modules/include/module_common_types.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2012 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_INCLUDE_MODULE_COMMON_TYPES_H_
+#define MODULES_INCLUDE_MODULE_COMMON_TYPES_H_
+
+#include <stdint.h>
+
+#include <vector>
+
+namespace webrtc {
+
+// Interface used by the CallStats class to distribute call statistics.
+// Callbacks will be triggered as soon as the class has been registered to a
+// CallStats object using RegisterStatsObserver.
+class CallStatsObserver {
+ public:
+ virtual void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) = 0;
+
+ virtual ~CallStatsObserver() {}
+};
+
+// Interface used by NackModule and JitterBuffer.
+class NackSender {
+ public:
+ // If `buffering_allowed`, other feedback messages (e.g. key frame requests)
+ // may be added to the same outgoing feedback message. In that case, it's up
+ // to the user of the interface to ensure that when all buffer-able messages
+ // have been added, the feedback message is triggered.
+ virtual void SendNack(const std::vector<uint16_t>& sequence_numbers,
+ bool buffering_allowed) = 0;
+
+ protected:
+ virtual ~NackSender() {}
+};
+
+// Interface used by NackModule and JitterBuffer.
+class KeyFrameRequestSender {
+ public:
+ virtual void RequestKeyFrame() = 0;
+
+ protected:
+ virtual ~KeyFrameRequestSender() {}
+};
+
+// Interface used by LossNotificationController to communicate to RtpRtcp.
+class LossNotificationSender {
+ public:
+ virtual ~LossNotificationSender() {}
+
+ virtual void SendLossNotification(uint16_t last_decoded_seq_num,
+ uint16_t last_received_seq_num,
+ bool decodability_flag,
+ bool buffering_allowed) = 0;
+};
+
+} // namespace webrtc
+
+#endif // MODULES_INCLUDE_MODULE_COMMON_TYPES_H_
diff --git a/third_party/libwebrtc/modules/include/module_common_types_public.h b/third_party/libwebrtc/modules/include/module_common_types_public.h
new file mode 100644
index 0000000000..5a6f634df7
--- /dev/null
+++ b/third_party/libwebrtc/modules/include/module_common_types_public.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2017 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_INCLUDE_MODULE_COMMON_TYPES_PUBLIC_H_
+#define MODULES_INCLUDE_MODULE_COMMON_TYPES_PUBLIC_H_
+
+#include <limits>
+
+#include "absl/types/optional.h"
+
+namespace webrtc {
+
+template <typename U>
+inline bool IsNewer(U value, U prev_value) {
+ static_assert(!std::numeric_limits<U>::is_signed, "U must be unsigned");
+ // kBreakpoint is the half-way mark for the type U. For instance, for a
+ // uint16_t it will be 0x8000, and for a uint32_t, it will be 0x8000000.
+ constexpr U kBreakpoint = (std::numeric_limits<U>::max() >> 1) + 1;
+ // Distinguish between elements that are exactly kBreakpoint apart.
+ // If t1>t2 and |t1-t2| = kBreakpoint: IsNewer(t1,t2)=true,
+ // IsNewer(t2,t1)=false
+ // rather than having IsNewer(t1,t2) = IsNewer(t2,t1) = false.
+ if (value - prev_value == kBreakpoint) {
+ return value > prev_value;
+ }
+ return value != prev_value &&
+ static_cast<U>(value - prev_value) < kBreakpoint;
+}
+
+// NB: Doesn't fulfill strict weak ordering requirements.
+// Mustn't be used as std::map Compare function.
+inline bool IsNewerSequenceNumber(uint16_t sequence_number,
+ uint16_t prev_sequence_number) {
+ return IsNewer(sequence_number, prev_sequence_number);
+}
+
+// NB: Doesn't fulfill strict weak ordering requirements.
+// Mustn't be used as std::map Compare function.
+inline bool IsNewerTimestamp(uint32_t timestamp, uint32_t prev_timestamp) {
+ return IsNewer(timestamp, prev_timestamp);
+}
+
+inline uint16_t LatestSequenceNumber(uint16_t sequence_number1,
+ uint16_t sequence_number2) {
+ return IsNewerSequenceNumber(sequence_number1, sequence_number2)
+ ? sequence_number1
+ : sequence_number2;
+}
+
+inline uint32_t LatestTimestamp(uint32_t timestamp1, uint32_t timestamp2) {
+ return IsNewerTimestamp(timestamp1, timestamp2) ? timestamp1 : timestamp2;
+}
+
+} // namespace webrtc
+#endif // MODULES_INCLUDE_MODULE_COMMON_TYPES_PUBLIC_H_
diff --git a/third_party/libwebrtc/modules/include/module_fec_types.h b/third_party/libwebrtc/modules/include/module_fec_types.h
new file mode 100644
index 0000000000..fa35342764
--- /dev/null
+++ b/third_party/libwebrtc/modules/include/module_fec_types.h
@@ -0,0 +1,34 @@
+/*
+ * 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_INCLUDE_MODULE_FEC_TYPES_H_
+#define MODULES_INCLUDE_MODULE_FEC_TYPES_H_
+
+namespace webrtc {
+
+// Types for the FEC packet masks. The type `kFecMaskRandom` is based on a
+// random loss model. The type `kFecMaskBursty` is based on a bursty/consecutive
+// loss model. The packet masks are defined in
+// modules/rtp_rtcp/fec_private_tables_random(bursty).h
+enum FecMaskType {
+ kFecMaskRandom,
+ kFecMaskBursty,
+};
+
+// Struct containing forward error correction settings.
+struct FecProtectionParams {
+ int fec_rate = 0;
+ int max_fec_frames = 0;
+ FecMaskType fec_mask_type = FecMaskType::kFecMaskRandom;
+};
+
+} // namespace webrtc
+
+#endif // MODULES_INCLUDE_MODULE_FEC_TYPES_H_