From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../modules/include/module_common_types.h | 66 ++++++++++++++++++++++ .../modules/include/module_common_types_public.h | 62 ++++++++++++++++++++ .../libwebrtc/modules/include/module_fec_types.h | 34 +++++++++++ 3 files changed, 162 insertions(+) create mode 100644 third_party/libwebrtc/modules/include/module_common_types.h create mode 100644 third_party/libwebrtc/modules/include/module_common_types_public.h create mode 100644 third_party/libwebrtc/modules/include/module_fec_types.h (limited to 'third_party/libwebrtc/modules/include') 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 + +#include + +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& 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 + +#include "absl/types/optional.h" + +namespace webrtc { + +template +inline bool IsNewer(U value, U prev_value) { + static_assert(!std::numeric_limits::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::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(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_ -- cgit v1.2.3