summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/api
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/libwebrtc/api/BUILD.gn22
-rw-r--r--third_party/libwebrtc/api/DEPS7
-rw-r--r--third_party/libwebrtc/api/audio_codecs/BUILD.gn1
-rw-r--r--third_party/libwebrtc/api/audio_codecs/audio_format.cc4
-rw-r--r--third_party/libwebrtc/api/audio_codecs/audio_format.h10
-rw-r--r--third_party/libwebrtc/api/call/call_factory_interface.h43
-rw-r--r--third_party/libwebrtc/api/callfactory_api_gn/moz.build213
-rw-r--r--third_party/libwebrtc/api/candidate.cc18
-rw-r--r--third_party/libwebrtc/api/candidate.h54
-rw-r--r--third_party/libwebrtc/api/create_peerconnection_factory.cc3
-rw-r--r--third_party/libwebrtc/api/enable_media.cc5
-rw-r--r--third_party/libwebrtc/api/environment/environment_factory.cc10
-rw-r--r--third_party/libwebrtc/api/environment/environment_factory_gn/moz.build231
-rw-r--r--third_party/libwebrtc/api/fec_controller.h5
-rw-r--r--third_party/libwebrtc/api/metronome/BUILD.gn2
-rw-r--r--third_party/libwebrtc/api/metronome/metronome.h2
-rw-r--r--third_party/libwebrtc/api/metronome/test/BUILD.gn9
-rw-r--r--third_party/libwebrtc/api/metronome/test/fake_metronome.cc10
-rw-r--r--third_party/libwebrtc/api/metronome/test/fake_metronome.h17
-rw-r--r--third_party/libwebrtc/api/peer_connection_interface.h8
-rw-r--r--third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc7
-rw-r--r--third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.h5
-rw-r--r--third_party/libwebrtc/api/rtp_parameters.cc9
-rw-r--r--third_party/libwebrtc/api/rtp_parameters.h4
-rw-r--r--third_party/libwebrtc/api/stats/attribute.h96
-rw-r--r--third_party/libwebrtc/api/stats/rtc_stats.h329
-rw-r--r--third_party/libwebrtc/api/stats/rtc_stats_member.h185
-rw-r--r--third_party/libwebrtc/api/stats/rtcstats_objects.h36
-rw-r--r--third_party/libwebrtc/api/task_queue/BUILD.gn7
-rw-r--r--third_party/libwebrtc/api/task_queue/default_task_queue_factory_gn/moz.build198
-rw-r--r--third_party/libwebrtc/api/test/create_network_emulation_manager.cc6
-rw-r--r--third_party/libwebrtc/api/test/create_network_emulation_manager.h4
-rw-r--r--third_party/libwebrtc/api/test/create_time_controller.cc13
-rw-r--r--third_party/libwebrtc/api/test/pclf/BUILD.gn1
-rw-r--r--third_party/libwebrtc/api/test/pclf/media_configuration.h1
-rw-r--r--third_party/libwebrtc/api/test/pclf/media_quality_test_params.h1
-rw-r--r--third_party/libwebrtc/api/test/pclf/peer_configurer.cc5
-rw-r--r--third_party/libwebrtc/api/test/pclf/peer_configurer.h2
-rw-r--r--third_party/libwebrtc/api/test/peerconnection_quality_test_fixture.h1
-rw-r--r--third_party/libwebrtc/api/test/video_quality_test_fixture.h2
-rw-r--r--third_party/libwebrtc/api/transport/rtp/dependency_descriptor.h21
-rw-r--r--third_party/libwebrtc/api/transport/stun.cc20
-rw-r--r--third_party/libwebrtc/api/video_codecs/BUILD.gn1
-rw-r--r--third_party/libwebrtc/api/video_codecs/av1_profile.cc6
-rw-r--r--third_party/libwebrtc/api/video_codecs/av1_profile.h6
-rw-r--r--third_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc6
-rw-r--r--third_party/libwebrtc/api/video_codecs/h264_profile_level_id.h6
-rw-r--r--third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.cc496
-rw-r--r--third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.h218
-rw-r--r--third_party/libwebrtc/api/video_codecs/sdp_video_format.cc11
-rw-r--r--third_party/libwebrtc/api/video_codecs/sdp_video_format.h10
-rw-r--r--third_party/libwebrtc/api/video_codecs/test/h264_profile_level_id_unittest.cc6
-rw-r--r--third_party/libwebrtc/api/video_codecs/test/h265_profile_tier_level_unittest.cc496
-rw-r--r--third_party/libwebrtc/api/video_codecs/test/sdp_video_format_unittest.cc2
-rw-r--r--third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libaom_av1_adapter.h3
-rw-r--r--third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter.h3
-rw-r--r--third_party/libwebrtc/api/video_codecs/vp9_profile.cc6
-rw-r--r--third_party/libwebrtc/api/video_codecs/vp9_profile.h6
58 files changed, 1602 insertions, 1307 deletions
diff --git a/third_party/libwebrtc/api/BUILD.gn b/third_party/libwebrtc/api/BUILD.gn
index 10a4c8c95f..1628660c3c 100644
--- a/third_party/libwebrtc/api/BUILD.gn
+++ b/third_party/libwebrtc/api/BUILD.gn
@@ -26,15 +26,6 @@ rtc_source_set("call_api") {
sources = [ "call/audio_sink.h" ]
}
-rtc_source_set("callfactory_api") {
- visibility = [ "*" ]
- sources = [ "call/call_factory_interface.h" ]
- deps = [
- "../call:rtp_interfaces",
- "../rtc_base/system:rtc_export",
- ]
-}
-
rtc_source_set("enable_media") {
visibility = [ "*" ]
sources = [
@@ -545,6 +536,7 @@ rtc_library("rtp_parameters") {
":array_view",
":priority",
":rtp_transceiver_direction",
+ "../media:media_constants",
"../rtc_base:checks",
"../rtc_base:stringutils",
"../rtc_base/system:rtc_export",
@@ -604,7 +596,6 @@ if (!build_with_mozilla) {
deps = [
":array_view",
":audio_quality_analyzer_api",
- ":callfactory_api",
":fec_controller_api",
":frame_generator_api",
":function_view",
@@ -673,6 +664,7 @@ if (rtc_include_tests) {
"test/create_network_emulation_manager.h",
]
deps = [
+ ":field_trials_view",
":network_emulation_manager_api",
"../test/network:emulated_network",
]
@@ -811,8 +803,10 @@ rtc_source_set("rtc_stats_api") {
visibility = [ "*" ]
cflags = []
sources = [
+ "stats/attribute.h",
"stats/rtc_stats.h",
"stats/rtc_stats_collector_callback.h",
+ "stats/rtc_stats_member.h",
"stats/rtc_stats_report.h",
"stats/rtcstats_objects.h",
]
@@ -828,7 +822,10 @@ rtc_source_set("rtc_stats_api") {
"units:timestamp",
]
- absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/types:optional",
+ "//third_party/abseil-cpp/absl/types:variant",
+ ]
}
rtc_library("audio_options_api") {
@@ -930,6 +927,7 @@ rtc_source_set("fec_controller_api") {
deps = [
"../modules:module_fec_api",
+ "environment",
"video:video_frame_type",
]
}
@@ -1434,12 +1432,12 @@ if (rtc_include_tests) {
":time_controller",
"../call",
"../call:call_interfaces",
- "../call:rtp_interfaces",
"../pc:media_factory",
"../rtc_base:checks",
"../system_wrappers",
"../test/time_controller",
"environment",
+ "environment:environment_factory",
]
absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ]
}
diff --git a/third_party/libwebrtc/api/DEPS b/third_party/libwebrtc/api/DEPS
index 3a650b6253..5a5c285856 100644
--- a/third_party/libwebrtc/api/DEPS
+++ b/third_party/libwebrtc/api/DEPS
@@ -159,13 +159,6 @@ specific_include_rules = {
"+modules/audio_processing/include/audio_processing.h",
],
- "fake_metronome\.h": [
- "+rtc_base/synchronization/mutex.h",
- "+rtc_base/task_queue.h",
- "+rtc_base/task_utils/repeating_task.h",
- "+rtc_base/thread_annotations.h",
- ],
-
"make_ref_counted\.h": [
"+rtc_base/ref_counted_object.h",
],
diff --git a/third_party/libwebrtc/api/audio_codecs/BUILD.gn b/third_party/libwebrtc/api/audio_codecs/BUILD.gn
index 158ab74cce..2719942488 100644
--- a/third_party/libwebrtc/api/audio_codecs/BUILD.gn
+++ b/third_party/libwebrtc/api/audio_codecs/BUILD.gn
@@ -35,6 +35,7 @@ rtc_library("audio_codecs_api") {
"..:ref_count",
"..:scoped_refptr",
"../../api:field_trials_view",
+ "../../api:rtp_parameters",
"../../rtc_base:buffer",
"../../rtc_base:checks",
"../../rtc_base:event_tracer",
diff --git a/third_party/libwebrtc/api/audio_codecs/audio_format.cc b/third_party/libwebrtc/api/audio_codecs/audio_format.cc
index 2a529a49ee..8dc11fd80f 100644
--- a/third_party/libwebrtc/api/audio_codecs/audio_format.cc
+++ b/third_party/libwebrtc/api/audio_codecs/audio_format.cc
@@ -27,7 +27,7 @@ SdpAudioFormat::SdpAudioFormat(absl::string_view name,
SdpAudioFormat::SdpAudioFormat(absl::string_view name,
int clockrate_hz,
size_t num_channels,
- const Parameters& param)
+ const CodecParameterMap& param)
: name(name),
clockrate_hz(clockrate_hz),
num_channels(num_channels),
@@ -36,7 +36,7 @@ SdpAudioFormat::SdpAudioFormat(absl::string_view name,
SdpAudioFormat::SdpAudioFormat(absl::string_view name,
int clockrate_hz,
size_t num_channels,
- Parameters&& param)
+ CodecParameterMap&& param)
: name(name),
clockrate_hz(clockrate_hz),
num_channels(num_channels),
diff --git a/third_party/libwebrtc/api/audio_codecs/audio_format.h b/third_party/libwebrtc/api/audio_codecs/audio_format.h
index 0cf67799b8..edccc17e7d 100644
--- a/third_party/libwebrtc/api/audio_codecs/audio_format.h
+++ b/third_party/libwebrtc/api/audio_codecs/audio_format.h
@@ -17,6 +17,7 @@
#include <string>
#include "absl/strings/string_view.h"
+#include "api/rtp_parameters.h"
#include "rtc_base/checks.h"
#include "rtc_base/system/rtc_export.h"
@@ -24,7 +25,8 @@ namespace webrtc {
// SDP specification for a single audio codec.
struct RTC_EXPORT SdpAudioFormat {
- using Parameters = std::map<std::string, std::string>;
+ using Parameters [[deprecated(("Use webrtc::CodecParameterMap"))]] =
+ std::map<std::string, std::string>;
SdpAudioFormat(const SdpAudioFormat&);
SdpAudioFormat(SdpAudioFormat&&);
@@ -32,11 +34,11 @@ struct RTC_EXPORT SdpAudioFormat {
SdpAudioFormat(absl::string_view name,
int clockrate_hz,
size_t num_channels,
- const Parameters& param);
+ const CodecParameterMap& param);
SdpAudioFormat(absl::string_view name,
int clockrate_hz,
size_t num_channels,
- Parameters&& param);
+ CodecParameterMap&& param);
~SdpAudioFormat();
// Returns true if this format is compatible with `o`. In SDP terminology:
@@ -55,7 +57,7 @@ struct RTC_EXPORT SdpAudioFormat {
std::string name;
int clockrate_hz;
size_t num_channels;
- Parameters parameters;
+ CodecParameterMap parameters;
};
// Information about how an audio format is treated by the codec implementation.
diff --git a/third_party/libwebrtc/api/call/call_factory_interface.h b/third_party/libwebrtc/api/call/call_factory_interface.h
deleted file mode 100644
index db53d724a6..0000000000
--- a/third_party/libwebrtc/api/call/call_factory_interface.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 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 API_CALL_CALL_FACTORY_INTERFACE_H_
-#define API_CALL_CALL_FACTORY_INTERFACE_H_
-
-#include <memory>
-
-#include "rtc_base/system/rtc_export.h"
-
-namespace webrtc {
-
-// These classes are not part of the API, and are treated as opaque pointers.
-class Call;
-struct CallConfig;
-
-// This interface exists to allow webrtc to be optionally built without media
-// support (i.e., if only being used for data channels). PeerConnectionFactory
-// is constructed with a CallFactoryInterface, which may or may not be null.
-// TODO(bugs.webrtc.org/15574): Delete this interface when
-// `PeerConnectionFactoryDependencies::call_factory` is removed in favor of
-// `PeerConnectionFactoryDependencies::media_factory`.
-class CallFactoryInterface {
- public:
- virtual ~CallFactoryInterface() = default;
-
- virtual std::unique_ptr<Call> CreateCall(const CallConfig& config) = 0;
-};
-
-[[deprecated("bugs.webrtc.org/15574")]] //
-RTC_EXPORT std::unique_ptr<CallFactoryInterface>
-CreateCallFactory();
-
-} // namespace webrtc
-
-#endif // API_CALL_CALL_FACTORY_INTERFACE_H_
diff --git a/third_party/libwebrtc/api/callfactory_api_gn/moz.build b/third_party/libwebrtc/api/callfactory_api_gn/moz.build
deleted file mode 100644
index 157a34ec8e..0000000000
--- a/third_party/libwebrtc/api/callfactory_api_gn/moz.build
+++ /dev/null
@@ -1,213 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
- ### This moz.build was AUTOMATICALLY GENERATED from a GN config, ###
- ### DO NOT edit it by hand. ###
-
-COMPILE_FLAGS["OS_INCLUDES"] = []
-AllowCompilerWarnings()
-
-DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
-DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
-DEFINES["RTC_ENABLE_VP9"] = True
-DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
-DEFINES["WEBRTC_LIBRARY_IMPL"] = True
-DEFINES["WEBRTC_MOZILLA_BUILD"] = True
-DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
-DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
-
-FINAL_LIBRARY = "webrtc"
-
-
-LOCAL_INCLUDES += [
- "!/ipc/ipdl/_ipdlheaders",
- "!/third_party/libwebrtc/gen",
- "/ipc/chromium/src",
- "/third_party/libwebrtc/",
- "/third_party/libwebrtc/third_party/abseil-cpp/",
- "/tools/profiler/public"
-]
-
-if not CONFIG["MOZ_DEBUG"]:
-
- DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
- DEFINES["NDEBUG"] = True
- DEFINES["NVALGRIND"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1":
-
- DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android":
-
- DEFINES["ANDROID"] = True
- DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
- DEFINES["HAVE_SYS_UIO_H"] = True
- DEFINES["WEBRTC_ANDROID"] = True
- DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
- DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True
- DEFINES["WEBRTC_LINUX"] = True
- DEFINES["WEBRTC_POSIX"] = True
- DEFINES["_GNU_SOURCE"] = True
- DEFINES["__STDC_CONSTANT_MACROS"] = True
- DEFINES["__STDC_FORMAT_MACROS"] = True
-
- OS_LIBS += [
- "log"
- ]
-
-if CONFIG["OS_TARGET"] == "Darwin":
-
- DEFINES["WEBRTC_MAC"] = True
- DEFINES["WEBRTC_POSIX"] = True
- DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
- DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
- DEFINES["__STDC_CONSTANT_MACROS"] = True
- DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "Linux":
-
- DEFINES["USE_AURA"] = "1"
- DEFINES["USE_GLIB"] = "1"
- DEFINES["USE_NSS_CERTS"] = "1"
- DEFINES["USE_OZONE"] = "1"
- DEFINES["USE_UDEV"] = True
- DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True
- DEFINES["WEBRTC_LINUX"] = True
- DEFINES["WEBRTC_POSIX"] = True
- DEFINES["_FILE_OFFSET_BITS"] = "64"
- DEFINES["_LARGEFILE64_SOURCE"] = True
- DEFINES["_LARGEFILE_SOURCE"] = True
- DEFINES["__STDC_CONSTANT_MACROS"] = True
- DEFINES["__STDC_FORMAT_MACROS"] = True
-
- OS_LIBS += [
- "rt"
- ]
-
-if CONFIG["OS_TARGET"] == "OpenBSD":
-
- DEFINES["USE_GLIB"] = "1"
- DEFINES["USE_OZONE"] = "1"
- DEFINES["USE_X11"] = "1"
- DEFINES["WEBRTC_BSD"] = True
- DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True
- DEFINES["WEBRTC_POSIX"] = True
- DEFINES["_FILE_OFFSET_BITS"] = "64"
- DEFINES["_LARGEFILE64_SOURCE"] = True
- DEFINES["_LARGEFILE_SOURCE"] = True
- DEFINES["__STDC_CONSTANT_MACROS"] = True
- DEFINES["__STDC_FORMAT_MACROS"] = True
-
-if CONFIG["OS_TARGET"] == "WINNT":
-
- DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
- DEFINES["NOMINMAX"] = True
- DEFINES["NTDDI_VERSION"] = "0x0A000000"
- DEFINES["PSAPI_VERSION"] = "2"
- DEFINES["RTC_ENABLE_WIN_WGC"] = True
- DEFINES["UNICODE"] = True
- DEFINES["USE_AURA"] = "1"
- DEFINES["WEBRTC_WIN"] = True
- DEFINES["WIN32"] = True
- DEFINES["WIN32_LEAN_AND_MEAN"] = True
- DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
- DEFINES["WINVER"] = "0x0A00"
- DEFINES["_ATL_NO_OPENGL"] = True
- DEFINES["_CRT_RAND_S"] = True
- DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
- DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
- DEFINES["_HAS_EXCEPTIONS"] = "0"
- DEFINES["_HAS_NODISCARD"] = True
- DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
- DEFINES["_SECURE_ATL"] = True
- DEFINES["_UNICODE"] = True
- DEFINES["_WIN32_WINNT"] = "0x0A00"
- DEFINES["_WINDOWS"] = True
- DEFINES["__STD_C"] = True
-
- OS_LIBS += [
- "crypt32",
- "iphlpapi",
- "secur32",
- "winmm"
- ]
-
-if CONFIG["TARGET_CPU"] == "aarch64":
-
- DEFINES["WEBRTC_ARCH_ARM64"] = True
- DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "arm":
-
- DEFINES["WEBRTC_ARCH_ARM"] = True
- DEFINES["WEBRTC_ARCH_ARM_V7"] = True
- DEFINES["WEBRTC_HAS_NEON"] = True
-
-if CONFIG["TARGET_CPU"] == "mips32":
-
- DEFINES["MIPS32_LE"] = True
- DEFINES["MIPS_FPU_LE"] = True
- DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "mips64":
-
- DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["TARGET_CPU"] == "x86":
-
- DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["TARGET_CPU"] == "x86_64":
-
- DEFINES["WEBRTC_ENABLE_AVX2"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
-
- DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
-
- DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
- DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
-
- DEFINES["_DEBUG"] = True
-
-if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
-
- DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
-
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
-
- DEFINES["USE_X11"] = "1"
-
-if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
-
- OS_LIBS += [
- "unwind"
- ]
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
-
- DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
-
- DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
-
- DEFINES["_GNU_SOURCE"] = True
-
-if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
-
- DEFINES["_GNU_SOURCE"] = True
-
-Library("callfactory_api_gn")
diff --git a/third_party/libwebrtc/api/candidate.cc b/third_party/libwebrtc/api/candidate.cc
index 90cb326823..865f8e5787 100644
--- a/third_party/libwebrtc/api/candidate.cc
+++ b/third_party/libwebrtc/api/candidate.cc
@@ -17,6 +17,11 @@
namespace cricket {
+const char LOCAL_PORT_TYPE[] = "local";
+const char STUN_PORT_TYPE[] = "stun";
+const char PRFLX_PORT_TYPE[] = "prflx";
+const char RELAY_PORT_TYPE[] = "relay";
+
Candidate::Candidate()
: id_(rtc::CreateRandomString(8)),
component_(0),
@@ -57,6 +62,19 @@ Candidate::Candidate(const Candidate&) = default;
Candidate::~Candidate() = default;
+bool Candidate::is_local() const {
+ return type_ == LOCAL_PORT_TYPE;
+}
+bool Candidate::is_stun() const {
+ return type_ == STUN_PORT_TYPE;
+}
+bool Candidate::is_prflx() const {
+ return type_ == PRFLX_PORT_TYPE;
+}
+bool Candidate::is_relay() const {
+ return type_ == RELAY_PORT_TYPE;
+}
+
bool Candidate::IsEquivalent(const Candidate& c) const {
// We ignore the network name, since that is just debug information, and
// the priority and the network cost, since they should be the same if the
diff --git a/third_party/libwebrtc/api/candidate.h b/third_party/libwebrtc/api/candidate.h
index 8141d8ce38..d48f4fc559 100644
--- a/third_party/libwebrtc/api/candidate.h
+++ b/third_party/libwebrtc/api/candidate.h
@@ -26,6 +26,13 @@
namespace cricket {
+// TODO(tommi): These are temporarily here, moved from `port.h` and will
+// eventually be removed once we use enums instead of strings for these values.
+RTC_EXPORT extern const char LOCAL_PORT_TYPE[];
+RTC_EXPORT extern const char STUN_PORT_TYPE[];
+RTC_EXPORT extern const char PRFLX_PORT_TYPE[];
+RTC_EXPORT extern const char RELAY_PORT_TYPE[];
+
// TURN servers are limited to 32 in accordance with
// https://w3c.github.io/webrtc-pc/#dom-rtcconfiguration-iceservers
static constexpr size_t kMaxTurnServers = 32;
@@ -73,27 +80,6 @@ class RTC_EXPORT Candidate {
uint32_t priority() const { return priority_; }
void set_priority(const uint32_t priority) { priority_ = priority; }
- // TODO(pthatcher): Remove once Chromium's jingle/glue/utils.cc
- // doesn't use it.
- // Maps old preference (which was 0.0-1.0) to match priority (which
- // is 0-2^32-1) to to match RFC 5245, section 4.1.2.1. Also see
- // https://docs.google.com/a/google.com/document/d/
- // 1iNQDiwDKMh0NQOrCqbj3DKKRT0Dn5_5UJYhmZO-t7Uc/edit
- float preference() const {
- // The preference value is clamped to two decimal precision.
- return static_cast<float>(((priority_ >> 24) * 100 / 127) / 100.0);
- }
-
- // TODO(pthatcher): Remove once Chromium's jingle/glue/utils.cc
- // doesn't use it.
- void set_preference(float preference) {
- // Limiting priority to UINT_MAX when value exceeds uint32_t max.
- // This can happen for e.g. when preference = 3.
- uint64_t prio_val = static_cast<uint64_t>(preference * 127) << 24;
- priority_ = static_cast<uint32_t>(
- std::min(prio_val, static_cast<uint64_t>(UINT_MAX)));
- }
-
// TODO(honghaiz): Change to usernameFragment or ufrag.
const std::string& username() const { return username_; }
void set_username(absl::string_view username) { Assign(username_, username); }
@@ -111,6 +97,32 @@ class RTC_EXPORT Candidate {
Assign(type_, type);
}
+ // Provide these simple checkers to abstract away dependency on the port types
+ // that are currently defined outside of Candidate. This will ease the change
+ // from the string type to an enum.
+ bool is_local() const;
+ bool is_stun() const;
+ bool is_prflx() const;
+ bool is_relay() const;
+
+ // Returns the type preference, a value between 0-126 inclusive, with 0 being
+ // the lowest preference value, as described in RFC 5245.
+ // https://datatracker.ietf.org/doc/html/rfc5245#section-4.1.2.1
+ int type_preference() const {
+ // From https://datatracker.ietf.org/doc/html/rfc5245#section-4.1.4 :
+ // It is RECOMMENDED that default candidates be chosen based on the
+ // likelihood of those candidates to work with the peer that is being
+ // contacted.
+ // I.e. it is recommended that relayed > reflexive > host.
+ if (is_local())
+ return 1; // Host.
+ if (is_stun())
+ return 2; // Reflexive.
+ if (is_relay())
+ return 3; // Relayed.
+ return 0; // Unknown, lowest preference.
+ }
+
const std::string& network_name() const { return network_name_; }
void set_network_name(absl::string_view network_name) {
Assign(network_name_, network_name);
diff --git a/third_party/libwebrtc/api/create_peerconnection_factory.cc b/third_party/libwebrtc/api/create_peerconnection_factory.cc
index 5d3aace05f..bd77f74882 100644
--- a/third_party/libwebrtc/api/create_peerconnection_factory.cc
+++ b/third_party/libwebrtc/api/create_peerconnection_factory.cc
@@ -48,8 +48,7 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
dependencies.signaling_thread = signaling_thread;
dependencies.task_queue_factory =
CreateDefaultTaskQueueFactory(field_trials.get());
- dependencies.event_log_factory = std::make_unique<RtcEventLogFactory>(
- dependencies.task_queue_factory.get());
+ dependencies.event_log_factory = std::make_unique<RtcEventLogFactory>();
dependencies.trials = std::move(field_trials);
if (network_thread) {
diff --git a/third_party/libwebrtc/api/enable_media.cc b/third_party/libwebrtc/api/enable_media.cc
index a05b1b328a..91938cc320 100644
--- a/third_party/libwebrtc/api/enable_media.cc
+++ b/third_party/libwebrtc/api/enable_media.cc
@@ -15,7 +15,7 @@
#include "api/environment/environment.h"
#include "api/peer_connection_interface.h"
-#include "call/call_factory.h"
+#include "call/create_call.h"
#include "media/engine/webrtc_media_engine.h"
#include "media/engine/webrtc_video_engine.h"
#include "media/engine/webrtc_voice_engine.h"
@@ -37,8 +37,7 @@ class MediaFactoryImpl : public MediaFactory {
~MediaFactoryImpl() override = default;
std::unique_ptr<Call> CreateCall(const CallConfig& config) override {
- CallFactory call_factory;
- return static_cast<CallFactoryInterface&>(call_factory).CreateCall(config);
+ return webrtc::CreateCall(config);
}
std::unique_ptr<MediaEngineInterface> CreateMediaEngine(
diff --git a/third_party/libwebrtc/api/environment/environment_factory.cc b/third_party/libwebrtc/api/environment/environment_factory.cc
index c0b681aa08..6f0ec40dbe 100644
--- a/third_party/libwebrtc/api/environment/environment_factory.cc
+++ b/third_party/libwebrtc/api/environment/environment_factory.cc
@@ -97,12 +97,22 @@ Environment EnvironmentFactory::CreateWithDefaults() && {
if (field_trials_ == nullptr) {
Set(std::make_unique<FieldTrialBasedConfig>());
}
+#if defined(WEBRTC_MOZILLA_BUILD)
+ // We want to use our clock, not GetRealTimeClockRaw, and we avoid
+ // building the code under third_party/libwebrtc/task_queue. To
+ // ensure we're setting up things correctly, namely providing an
+ // Environment object with a preset task_queue_factory and clock,
+ // we'll do a release assert here.
+ RTC_CHECK(clock_);
+ RTC_CHECK(task_queue_factory_);
+#else
if (clock_ == nullptr) {
Set(Clock::GetRealTimeClock());
}
if (task_queue_factory_ == nullptr) {
Set(CreateDefaultTaskQueueFactory(field_trials_));
}
+#endif
if (event_log_ == nullptr) {
Set(std::make_unique<RtcEventLogNull>());
}
diff --git a/third_party/libwebrtc/api/environment/environment_factory_gn/moz.build b/third_party/libwebrtc/api/environment/environment_factory_gn/moz.build
new file mode 100644
index 0000000000..77a2224baf
--- /dev/null
+++ b/third_party/libwebrtc/api/environment/environment_factory_gn/moz.build
@@ -0,0 +1,231 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
+ ### This moz.build was AUTOMATICALLY GENERATED from a GN config, ###
+ ### DO NOT edit it by hand. ###
+
+COMPILE_FLAGS["OS_INCLUDES"] = []
+AllowCompilerWarnings()
+
+DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
+DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
+DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
+DEFINES["WEBRTC_LIBRARY_IMPL"] = True
+DEFINES["WEBRTC_MOZILLA_BUILD"] = True
+DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+
+FINAL_LIBRARY = "webrtc"
+
+
+LOCAL_INCLUDES += [
+ "!/ipc/ipdl/_ipdlheaders",
+ "!/third_party/libwebrtc/gen",
+ "/ipc/chromium/src",
+ "/third_party/libwebrtc/",
+ "/third_party/libwebrtc/third_party/abseil-cpp/",
+ "/tools/profiler/public"
+]
+
+UNIFIED_SOURCES += [
+ "/third_party/libwebrtc/api/environment/environment_factory.cc"
+]
+
+if not CONFIG["MOZ_DEBUG"]:
+
+ DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
+ DEFINES["NDEBUG"] = True
+ DEFINES["NVALGRIND"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1":
+
+ DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
+
+if CONFIG["OS_TARGET"] == "Android":
+
+ DEFINES["ANDROID"] = True
+ DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
+ DEFINES["HAVE_SYS_UIO_H"] = True
+ DEFINES["WEBRTC_ANDROID"] = True
+ DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
+ DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True
+ DEFINES["WEBRTC_LINUX"] = True
+ DEFINES["WEBRTC_POSIX"] = True
+ DEFINES["_GNU_SOURCE"] = True
+ DEFINES["__STDC_CONSTANT_MACROS"] = True
+ DEFINES["__STDC_FORMAT_MACROS"] = True
+
+ OS_LIBS += [
+ "log"
+ ]
+
+if CONFIG["OS_TARGET"] == "Darwin":
+
+ DEFINES["WEBRTC_MAC"] = True
+ DEFINES["WEBRTC_POSIX"] = True
+ DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
+ DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
+ DEFINES["__STDC_CONSTANT_MACROS"] = True
+ DEFINES["__STDC_FORMAT_MACROS"] = True
+
+if CONFIG["OS_TARGET"] == "Linux":
+
+ DEFINES["USE_AURA"] = "1"
+ DEFINES["USE_GLIB"] = "1"
+ DEFINES["USE_NSS_CERTS"] = "1"
+ DEFINES["USE_OZONE"] = "1"
+ DEFINES["USE_UDEV"] = True
+ DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True
+ DEFINES["WEBRTC_LINUX"] = True
+ DEFINES["WEBRTC_POSIX"] = True
+ DEFINES["_FILE_OFFSET_BITS"] = "64"
+ DEFINES["_LARGEFILE64_SOURCE"] = True
+ DEFINES["_LARGEFILE_SOURCE"] = True
+ DEFINES["__STDC_CONSTANT_MACROS"] = True
+ DEFINES["__STDC_FORMAT_MACROS"] = True
+
+ OS_LIBS += [
+ "rt"
+ ]
+
+if CONFIG["OS_TARGET"] == "OpenBSD":
+
+ DEFINES["USE_GLIB"] = "1"
+ DEFINES["USE_OZONE"] = "1"
+ DEFINES["USE_X11"] = "1"
+ DEFINES["WEBRTC_BSD"] = True
+ DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True
+ DEFINES["WEBRTC_POSIX"] = True
+ DEFINES["_FILE_OFFSET_BITS"] = "64"
+ DEFINES["_LARGEFILE64_SOURCE"] = True
+ DEFINES["_LARGEFILE_SOURCE"] = True
+ DEFINES["__STDC_CONSTANT_MACROS"] = True
+ DEFINES["__STDC_FORMAT_MACROS"] = True
+
+if CONFIG["OS_TARGET"] == "WINNT":
+
+ DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
+ DEFINES["NOMINMAX"] = True
+ DEFINES["NTDDI_VERSION"] = "0x0A000000"
+ DEFINES["PSAPI_VERSION"] = "2"
+ DEFINES["RTC_ENABLE_WIN_WGC"] = True
+ DEFINES["UNICODE"] = True
+ DEFINES["USE_AURA"] = "1"
+ DEFINES["WEBRTC_WIN"] = True
+ DEFINES["WIN32"] = True
+ DEFINES["WIN32_LEAN_AND_MEAN"] = True
+ DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
+ DEFINES["WINVER"] = "0x0A00"
+ DEFINES["_ATL_NO_OPENGL"] = True
+ DEFINES["_CRT_RAND_S"] = True
+ DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
+ DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
+ DEFINES["_HAS_EXCEPTIONS"] = "0"
+ DEFINES["_HAS_NODISCARD"] = True
+ DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
+ DEFINES["_SECURE_ATL"] = True
+ DEFINES["_UNICODE"] = True
+ DEFINES["_WIN32_WINNT"] = "0x0A00"
+ DEFINES["_WINDOWS"] = True
+ DEFINES["__STD_C"] = True
+
+ OS_LIBS += [
+ "crypt32",
+ "iphlpapi",
+ "secur32",
+ "winmm"
+ ]
+
+if CONFIG["TARGET_CPU"] == "aarch64":
+
+ DEFINES["WEBRTC_ARCH_ARM64"] = True
+ DEFINES["WEBRTC_HAS_NEON"] = True
+
+if CONFIG["TARGET_CPU"] == "arm":
+
+ CXXFLAGS += [
+ "-mfpu=neon"
+ ]
+
+ DEFINES["WEBRTC_ARCH_ARM"] = True
+ DEFINES["WEBRTC_ARCH_ARM_V7"] = True
+ DEFINES["WEBRTC_HAS_NEON"] = True
+
+if CONFIG["TARGET_CPU"] == "mips32":
+
+ DEFINES["MIPS32_LE"] = True
+ DEFINES["MIPS_FPU_LE"] = True
+ DEFINES["_GNU_SOURCE"] = True
+
+if CONFIG["TARGET_CPU"] == "mips64":
+
+ DEFINES["_GNU_SOURCE"] = True
+
+if CONFIG["TARGET_CPU"] == "x86":
+
+ DEFINES["WEBRTC_ENABLE_AVX2"] = True
+
+if CONFIG["TARGET_CPU"] == "x86_64":
+
+ DEFINES["WEBRTC_ENABLE_AVX2"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
+
+ DEFINES["_DEBUG"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
+
+ DEFINES["_DEBUG"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+
+ DEFINES["_DEBUG"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
+
+ DEFINES["_DEBUG"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
+
+ DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
+
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+
+ DEFINES["USE_X11"] = "1"
+
+if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
+
+ OS_LIBS += [
+ "unwind"
+ ]
+
+if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86":
+
+ CXXFLAGS += [
+ "-msse2"
+ ]
+
+if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
+
+ DEFINES["_GNU_SOURCE"] = True
+
+if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
+
+ DEFINES["_GNU_SOURCE"] = True
+
+if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+
+ CXXFLAGS += [
+ "-msse2"
+ ]
+
+ DEFINES["_GNU_SOURCE"] = True
+
+if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+
+ DEFINES["_GNU_SOURCE"] = True
+
+Library("environment_factory_gn")
diff --git a/third_party/libwebrtc/api/fec_controller.h b/third_party/libwebrtc/api/fec_controller.h
index a9be656d6e..5c2aa3b786 100644
--- a/third_party/libwebrtc/api/fec_controller.h
+++ b/third_party/libwebrtc/api/fec_controller.h
@@ -14,6 +14,7 @@
#include <memory>
#include <vector>
+#include "api/environment/environment.h"
#include "api/video/video_frame_type.h"
#include "modules/include/module_fec_types.h"
@@ -87,8 +88,10 @@ class FecController {
class FecControllerFactoryInterface {
public:
- virtual std::unique_ptr<FecController> CreateFecController() = 0;
virtual ~FecControllerFactoryInterface() = default;
+
+ virtual std::unique_ptr<FecController> CreateFecController(
+ const Environment& env) = 0;
};
} // namespace webrtc
diff --git a/third_party/libwebrtc/api/metronome/BUILD.gn b/third_party/libwebrtc/api/metronome/BUILD.gn
index 3d3d876df0..f879d5f2fb 100644
--- a/third_party/libwebrtc/api/metronome/BUILD.gn
+++ b/third_party/libwebrtc/api/metronome/BUILD.gn
@@ -13,7 +13,7 @@ rtc_source_set("metronome") {
sources = [ "metronome.h" ]
deps = [
"../../rtc_base/system:rtc_export",
- "../task_queue",
"../units:time_delta",
]
+ absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
}
diff --git a/third_party/libwebrtc/api/metronome/metronome.h b/third_party/libwebrtc/api/metronome/metronome.h
index a312b1c862..4d50a3ecd0 100644
--- a/third_party/libwebrtc/api/metronome/metronome.h
+++ b/third_party/libwebrtc/api/metronome/metronome.h
@@ -11,7 +11,7 @@
#ifndef API_METRONOME_METRONOME_H_
#define API_METRONOME_METRONOME_H_
-#include "api/task_queue/task_queue_base.h"
+#include "absl/functional/any_invocable.h"
#include "api/units/time_delta.h"
#include "rtc_base/system/rtc_export.h"
diff --git a/third_party/libwebrtc/api/metronome/test/BUILD.gn b/third_party/libwebrtc/api/metronome/test/BUILD.gn
index f415d98a0b..94ecf9f727 100644
--- a/third_party/libwebrtc/api/metronome/test/BUILD.gn
+++ b/third_party/libwebrtc/api/metronome/test/BUILD.gn
@@ -16,15 +16,8 @@ rtc_library("fake_metronome") {
]
deps = [
"..:metronome",
- "../..:priority",
- "../..:sequence_checker",
- "../../../rtc_base:macromagic",
- "../../../rtc_base:rtc_event",
- "../../../rtc_base:rtc_task_queue",
- "../../../rtc_base/synchronization:mutex",
- "../../../rtc_base/task_utils:repeating_task",
- "../../../test:test_support",
"../../task_queue",
"../../units:time_delta",
]
+ absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
}
diff --git a/third_party/libwebrtc/api/metronome/test/fake_metronome.cc b/third_party/libwebrtc/api/metronome/test/fake_metronome.cc
index 025f7ce5a6..bd54d5b0ba 100644
--- a/third_party/libwebrtc/api/metronome/test/fake_metronome.cc
+++ b/third_party/libwebrtc/api/metronome/test/fake_metronome.cc
@@ -13,13 +13,9 @@
#include <utility>
#include <vector>
-#include "api/priority.h"
-#include "api/sequence_checker.h"
+#include "absl/functional/any_invocable.h"
#include "api/task_queue/task_queue_base.h"
-#include "api/task_queue/task_queue_factory.h"
#include "api/units/time_delta.h"
-#include "rtc_base/event.h"
-#include "rtc_base/task_utils/repeating_task.h"
namespace webrtc::test {
@@ -49,6 +45,10 @@ void ForcedTickMetronome::Tick() {
FakeMetronome::FakeMetronome(TimeDelta tick_period)
: tick_period_(tick_period) {}
+void FakeMetronome::SetTickPeriod(TimeDelta tick_period) {
+ tick_period_ = tick_period;
+}
+
void FakeMetronome::RequestCallOnNextTick(
absl::AnyInvocable<void() &&> callback) {
TaskQueueBase* current = TaskQueueBase::Current();
diff --git a/third_party/libwebrtc/api/metronome/test/fake_metronome.h b/third_party/libwebrtc/api/metronome/test/fake_metronome.h
index 73c938e9cd..9702062cf6 100644
--- a/third_party/libwebrtc/api/metronome/test/fake_metronome.h
+++ b/third_party/libwebrtc/api/metronome/test/fake_metronome.h
@@ -11,18 +11,12 @@
#ifndef API_METRONOME_TEST_FAKE_METRONOME_H_
#define API_METRONOME_TEST_FAKE_METRONOME_H_
-#include <memory>
-#include <set>
+#include <cstddef>
#include <vector>
+#include "absl/functional/any_invocable.h"
#include "api/metronome/metronome.h"
-#include "api/task_queue/task_queue_base.h"
-#include "api/task_queue/task_queue_factory.h"
#include "api/units/time_delta.h"
-#include "rtc_base/synchronization/mutex.h"
-#include "rtc_base/task_queue.h"
-#include "rtc_base/task_utils/repeating_task.h"
-#include "rtc_base/thread_annotations.h"
namespace webrtc::test {
@@ -48,19 +42,18 @@ class ForcedTickMetronome : public Metronome {
// FakeMetronome is a metronome that ticks based on a repeating task at the
// `tick_period` provided in the constructor. It is designed for use with
// simulated task queues for unit tests.
-//
-// `Stop()` must be called before destruction, as it cancels the metronome tick
-// on the proper task queue.
class FakeMetronome : public Metronome {
public:
explicit FakeMetronome(TimeDelta tick_period);
+ void SetTickPeriod(TimeDelta tick_period);
+
// Metronome implementation.
void RequestCallOnNextTick(absl::AnyInvocable<void() &&> callback) override;
TimeDelta TickPeriod() const override;
private:
- const TimeDelta tick_period_;
+ TimeDelta tick_period_;
std::vector<absl::AnyInvocable<void() &&>> callbacks_;
};
diff --git a/third_party/libwebrtc/api/peer_connection_interface.h b/third_party/libwebrtc/api/peer_connection_interface.h
index 74c4702cd2..3c225eb28a 100644
--- a/third_party/libwebrtc/api/peer_connection_interface.h
+++ b/third_party/libwebrtc/api/peer_connection_interface.h
@@ -686,7 +686,6 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
PortAllocatorConfig port_allocator_config;
// The burst interval of the pacer, see TaskQueuePacedSender constructor.
- // TODO(hbos): Deprecated, Remove once Chromium is not setting it.
absl::optional<TimeDelta> pacer_burst_interval;
//
@@ -1441,7 +1440,12 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
std::unique_ptr<FieldTrialsView> trials;
std::unique_ptr<RtpTransportControllerSendFactoryInterface>
transport_controller_send_factory;
- std::unique_ptr<Metronome> metronome;
+ // Metronome used for decoding, must be called on the worker thread.
+ std::unique_ptr<Metronome> decode_metronome;
+ // Metronome used for encoding, must be called on the worker thread.
+ // TODO(b/304158952): Consider merging into a single metronome for all codec
+ // usage.
+ std::unique_ptr<Metronome> encode_metronome;
// Media specific dependencies. Unused when `media_factory == nullptr`.
rtc::scoped_refptr<AudioDeviceModule> adm;
diff --git a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc
index 30fc6f126f..bfe272d2a8 100644
--- a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc
+++ b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.cc
@@ -31,12 +31,7 @@ absl::Nonnull<std::unique_ptr<RtcEventLog>> RtcEventLogFactory::Create(
if (env.field_trials().IsEnabled("WebRTC-RtcEventLogKillSwitch")) {
return std::make_unique<RtcEventLogNull>();
}
- RtcEventLog::EncodingType encoding_type =
- env.field_trials().IsDisabled("WebRTC-RtcEventLogNewFormat")
- ? RtcEventLog::EncodingType::Legacy
- : RtcEventLog::EncodingType::NewFormat;
- return std::make_unique<RtcEventLogImpl>(
- RtcEventLogImpl::CreateEncoder(encoding_type), &env.task_queue_factory());
+ return std::make_unique<RtcEventLogImpl>(env);
#endif
}
diff --git a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.h b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.h
index 21a670e1a7..1deb0612bf 100644
--- a/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.h
+++ b/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_factory.h
@@ -26,10 +26,9 @@ class RTC_EXPORT RtcEventLogFactory : public RtcEventLogFactoryInterface {
public:
RtcEventLogFactory() = default;
- // TODO(bugs.webrtc.org/15656): deprecate and delete constructor taking
- // task queue factory in favor of using task queue factory provided through
- // the Environment parameter in Create function.
+ [[deprecated("Use default constructor")]] //
explicit RtcEventLogFactory(TaskQueueFactory* task_queue_factory) {}
+
~RtcEventLogFactory() override = default;
absl::Nonnull<std::unique_ptr<RtcEventLog>> Create(
diff --git a/third_party/libwebrtc/api/rtp_parameters.cc b/third_party/libwebrtc/api/rtp_parameters.cc
index cf8b3ad3dc..ad0f3c9396 100644
--- a/third_party/libwebrtc/api/rtp_parameters.cc
+++ b/third_party/libwebrtc/api/rtp_parameters.cc
@@ -15,6 +15,7 @@
#include <utility>
#include "api/array_view.h"
+#include "media/base/media_constants.h"
#include "rtc_base/strings/string_builder.h"
namespace webrtc {
@@ -47,6 +48,14 @@ RtcpFeedback::~RtcpFeedback() = default;
RtpCodec::RtpCodec() = default;
RtpCodec::RtpCodec(const RtpCodec&) = default;
RtpCodec::~RtpCodec() = default;
+bool RtpCodec::IsResiliencyCodec() const {
+ return name == cricket::kRtxCodecName || name == cricket::kRedCodecName ||
+ name == cricket::kUlpfecCodecName ||
+ name == cricket::kFlexfecCodecName;
+}
+bool RtpCodec::IsMediaCodec() const {
+ return !IsResiliencyCodec() && name != cricket::kComfortNoiseCodecName;
+}
RtpCodecCapability::RtpCodecCapability() = default;
RtpCodecCapability::~RtpCodecCapability() = default;
diff --git a/third_party/libwebrtc/api/rtp_parameters.h b/third_party/libwebrtc/api/rtp_parameters.h
index 09473a6ce9..025817cf37 100644
--- a/third_party/libwebrtc/api/rtp_parameters.h
+++ b/third_party/libwebrtc/api/rtp_parameters.h
@@ -29,6 +29,8 @@
namespace webrtc {
+using CodecParameterMap = std::map<std::string, std::string>;
+
// These structures are intended to mirror those defined by:
// http://draft.ortc.org/#rtcrtpdictionaries*
// Contains everything specified as of 2017 Jan 24.
@@ -165,6 +167,8 @@ struct RTC_EXPORT RtpCodec {
parameters == o.parameters;
}
bool operator!=(const RtpCodec& o) const { return !(*this == o); }
+ bool IsResiliencyCodec() const;
+ bool IsMediaCodec() const;
};
// RtpCodecCapability is to RtpCodecParameters as RtpCapabilities is to
diff --git a/third_party/libwebrtc/api/stats/attribute.h b/third_party/libwebrtc/api/stats/attribute.h
new file mode 100644
index 0000000000..09211f469c
--- /dev/null
+++ b/third_party/libwebrtc/api/stats/attribute.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2024 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 API_STATS_ATTRIBUTE_H_
+#define API_STATS_ATTRIBUTE_H_
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "absl/types/variant.h"
+#include "api/stats/rtc_stats_member.h"
+#include "rtc_base/system/rtc_export.h"
+
+namespace webrtc {
+
+// A light-weight wrapper of an RTCStats attribute (an individual metric).
+class RTC_EXPORT Attribute {
+ public:
+ // TODO(https://crbug.com/webrtc/15164): Replace uses of RTCStatsMember<T>
+ // with absl::optional<T> and update these pointer types.
+ typedef absl::variant<const RTCStatsMember<bool>*,
+ const RTCStatsMember<int32_t>*,
+ const RTCStatsMember<uint32_t>*,
+ const RTCStatsMember<int64_t>*,
+ const RTCStatsMember<uint64_t>*,
+ const RTCStatsMember<double>*,
+ const RTCStatsMember<std::string>*,
+ const RTCStatsMember<std::vector<bool>>*,
+ const RTCStatsMember<std::vector<int32_t>>*,
+ const RTCStatsMember<std::vector<uint32_t>>*,
+ const RTCStatsMember<std::vector<int64_t>>*,
+ const RTCStatsMember<std::vector<uint64_t>>*,
+ const RTCStatsMember<std::vector<double>>*,
+ const RTCStatsMember<std::vector<std::string>>*,
+ const RTCStatsMember<std::map<std::string, uint64_t>>*,
+ const RTCStatsMember<std::map<std::string, double>>*>
+ StatVariant;
+
+ template <typename T>
+ explicit Attribute(const char* name, const RTCStatsMember<T>* attribute)
+ : name_(name), attribute_(attribute) {}
+
+ const char* name() const;
+ const StatVariant& as_variant() const;
+
+ bool has_value() const;
+ template <typename T>
+ bool holds_alternative() const {
+ return absl::holds_alternative<const RTCStatsMember<T>*>(attribute_);
+ }
+ template <typename T>
+ absl::optional<T> as_optional() const {
+ RTC_CHECK(holds_alternative<T>());
+ if (!has_value()) {
+ return absl::nullopt;
+ }
+ return absl::optional<T>(get<T>());
+ }
+ template <typename T>
+ const T& get() const {
+ RTC_CHECK(holds_alternative<T>());
+ RTC_CHECK(has_value());
+ return absl::get<const RTCStatsMember<T>*>(attribute_)->value();
+ }
+
+ bool is_sequence() const;
+ bool is_string() const;
+ std::string ToString() const;
+
+ bool operator==(const Attribute& other) const;
+ bool operator!=(const Attribute& other) const;
+
+ private:
+ const char* name_;
+ StatVariant attribute_;
+};
+
+struct RTC_EXPORT AttributeInit {
+ AttributeInit(const char* name, const Attribute::StatVariant& variant);
+
+ const char* name;
+ Attribute::StatVariant variant;
+};
+
+} // namespace webrtc
+
+#endif // API_STATS_ATTRIBUTE_H_
diff --git a/third_party/libwebrtc/api/stats/rtc_stats.h b/third_party/libwebrtc/api/stats/rtc_stats.h
index 6cc39a309f..edd293f5c9 100644
--- a/third_party/libwebrtc/api/stats/rtc_stats.h
+++ b/third_party/libwebrtc/api/stats/rtc_stats.h
@@ -20,7 +20,8 @@
#include <utility>
#include <vector>
-#include "absl/types/optional.h"
+#include "api/stats/attribute.h"
+#include "api/stats/rtc_stats_member.h"
#include "api/units/timestamp.h"
#include "rtc_base/checks.h"
#include "rtc_base/system/rtc_export.h"
@@ -28,8 +29,6 @@
namespace webrtc {
-class RTCStatsMemberInterface;
-
// Abstract base class for RTCStats-derived dictionaries, see
// https://w3c.github.io/webrtc-stats/.
//
@@ -40,8 +39,8 @@ class RTCStatsMemberInterface;
// Use the `WEBRTC_RTCSTATS_IMPL` macro when implementing subclasses, see macro
// for details.
//
-// Derived classes list their dictionary members, RTCStatsMember<T>, as public
-// fields, allowing the following:
+// Derived classes list their dictionary attributes (RTCStatsMember<T> to soon
+// be replaced by absl::optional<T>) as public fields, allowing the following:
//
// RTCFooStats foo("fooId", Timestamp::Micros(GetCurrentTime()));
// foo.bar = 42;
@@ -49,17 +48,18 @@ class RTCStatsMemberInterface;
// foo.baz->push_back("hello world");
// uint32_t x = *foo.bar;
//
-// Pointers to all the members are available with `Members`, allowing iteration:
+// Pointers to all the attributes are available with `Attributes()`, allowing
+// iteration:
//
-// for (const RTCStatsMemberInterface* member : foo.Members()) {
-// printf("%s = %s\n", member->name(), member->ValueToString().c_str());
+// for (const auto& attribute : foo.Attributes()) {
+// printf("%s = %s\n", attribute.name(), attribute.ValueToString().c_str());
// }
class RTC_EXPORT RTCStats {
public:
RTCStats(const std::string& id, Timestamp timestamp)
: id_(id), timestamp_(timestamp) {}
-
- virtual ~RTCStats() {}
+ RTCStats(const RTCStats& other);
+ virtual ~RTCStats();
virtual std::unique_ptr<RTCStats> copy() const = 0;
@@ -69,18 +69,30 @@ class RTC_EXPORT RTCStats {
// Returns the static member variable `kType` of the implementing class.
virtual const char* type() const = 0;
- // Returns a vector of pointers to all the `RTCStatsMemberInterface` members
- // of this class. This allows for iteration of members. For a given class,
- // `Members` always returns the same members in the same order.
- std::vector<const RTCStatsMemberInterface*> Members() const;
+ // Returns all attributes of this stats object, i.e. a list of its individual
+ // metrics as viewed via the Attribute wrapper.
+ std::vector<Attribute> Attributes() const;
+ template <typename T>
+ Attribute GetAttribute(const RTCStatsMember<T>& stat) const {
+ for (const auto& attribute : Attributes()) {
+ if (!attribute.holds_alternative<T>()) {
+ continue;
+ }
+ if (absl::get<const RTCStatsMember<T>*>(attribute.as_variant()) ==
+ &stat) {
+ return attribute;
+ }
+ }
+ RTC_CHECK_NOTREACHED();
+ }
// Checks if the two stats objects are of the same type and have the same
- // member values. Timestamps are not compared. These operators are exposed for
- // testing.
+ // attribute values. Timestamps are not compared. These operators are exposed
+ // for testing.
bool operator==(const RTCStats& other) const;
bool operator!=(const RTCStats& other) const;
// Creates a JSON readable string representation of the stats
- // object, listing all of its members (names and values).
+ // object, listing all of its attributes (names and values).
std::string ToJson() const;
// Downcasts the stats object to an `RTCStats` subclass `T`. DCHECKs that the
@@ -92,12 +104,8 @@ class RTC_EXPORT RTCStats {
}
protected:
- // Gets a vector of all members of this `RTCStats` object, including members
- // derived from parent classes. `additional_capacity` is how many more members
- // shall be reserved in the vector (so that subclasses can allocate a vector
- // with room for both parent and child members without it having to resize).
- virtual std::vector<const RTCStatsMemberInterface*>
- MembersOfThisObjectAndAncestors(size_t additional_capacity) const;
+ virtual std::vector<Attribute> AttributesImpl(
+ size_t additional_capacity) const;
std::string const id_;
Timestamp timestamp_;
@@ -109,9 +117,8 @@ class RTC_EXPORT RTCStats {
//
// These macros declare (in _DECL) and define (in _IMPL) the static `kType` and
// overrides methods as required by subclasses of `RTCStats`: `copy`, `type` and
-// `MembersOfThisObjectAndAncestors`. The |...| argument is a list of addresses
-// to each member defined in the implementing class. The list must have at least
-// one member.
+// `AttributesImpl`. The |...| argument is a list of addresses to each attribute
+// defined in the implementing class. The list must have at least one attribute.
//
// (Since class names need to be known to implement these methods this cannot be
// part of the base `RTCStats`. While these methods could be implemented using
@@ -144,247 +151,45 @@ class RTC_EXPORT RTCStats {
// bar("bar") {
// }
//
-#define WEBRTC_RTCSTATS_DECL() \
- protected: \
- std::vector<const webrtc::RTCStatsMemberInterface*> \
- MembersOfThisObjectAndAncestors(size_t local_var_additional_capacity) \
- const override; \
- \
- public: \
- static const char kType[]; \
- \
- std::unique_ptr<webrtc::RTCStats> copy() const override; \
- const char* type() const override
-
-#define WEBRTC_RTCSTATS_IMPL(this_class, parent_class, type_str, ...) \
- const char this_class::kType[] = type_str; \
- \
- std::unique_ptr<webrtc::RTCStats> this_class::copy() const { \
- return std::make_unique<this_class>(*this); \
- } \
- \
- const char* this_class::type() const { \
- return this_class::kType; \
- } \
- \
- std::vector<const webrtc::RTCStatsMemberInterface*> \
- this_class::MembersOfThisObjectAndAncestors( \
- size_t local_var_additional_capacity) const { \
- const webrtc::RTCStatsMemberInterface* local_var_members[] = { \
- __VA_ARGS__}; \
- size_t local_var_members_count = \
- sizeof(local_var_members) / sizeof(local_var_members[0]); \
- std::vector<const webrtc::RTCStatsMemberInterface*> \
- local_var_members_vec = parent_class::MembersOfThisObjectAndAncestors( \
- local_var_members_count + local_var_additional_capacity); \
- RTC_DCHECK_GE( \
- local_var_members_vec.capacity() - local_var_members_vec.size(), \
- local_var_members_count + local_var_additional_capacity); \
- local_var_members_vec.insert(local_var_members_vec.end(), \
- &local_var_members[0], \
- &local_var_members[local_var_members_count]); \
- return local_var_members_vec; \
- }
-
-// A version of WEBRTC_RTCSTATS_IMPL() where "..." is omitted, used to avoid a
-// compile error on windows. This is used if the stats dictionary does not
-// declare any members of its own (but perhaps its parent dictionary does).
-#define WEBRTC_RTCSTATS_IMPL_NO_MEMBERS(this_class, parent_class, type_str) \
- const char this_class::kType[] = type_str; \
- \
- std::unique_ptr<webrtc::RTCStats> this_class::copy() const { \
- return std::make_unique<this_class>(*this); \
- } \
+#define WEBRTC_RTCSTATS_DECL() \
+ protected: \
+ std::vector<webrtc::Attribute> AttributesImpl(size_t additional_capacity) \
+ const override; \
\
- const char* this_class::type() const { \
- return this_class::kType; \
- } \
+ public: \
+ static const char kType[]; \
\
- std::vector<const webrtc::RTCStatsMemberInterface*> \
- this_class::MembersOfThisObjectAndAncestors( \
- size_t local_var_additional_capacity) const { \
- return parent_class::MembersOfThisObjectAndAncestors(0); \
- }
-
-// Interface for `RTCStats` members, which have a name and a value of a type
-// defined in a subclass. Only the types listed in `Type` are supported, these
-// are implemented by `RTCStatsMember<T>`. The value of a member may be
-// undefined, the value can only be read if `is_defined`.
-class RTCStatsMemberInterface {
- public:
- // Member value types.
- enum Type {
- kBool, // bool
- kInt32, // int32_t
- kUint32, // uint32_t
- kInt64, // int64_t
- kUint64, // uint64_t
- kDouble, // double
- kString, // std::string
-
- kSequenceBool, // std::vector<bool>
- kSequenceInt32, // std::vector<int32_t>
- kSequenceUint32, // std::vector<uint32_t>
- kSequenceInt64, // std::vector<int64_t>
- kSequenceUint64, // std::vector<uint64_t>
- kSequenceDouble, // std::vector<double>
- kSequenceString, // std::vector<std::string>
-
- kMapStringUint64, // std::map<std::string, uint64_t>
- kMapStringDouble, // std::map<std::string, double>
- };
-
- virtual ~RTCStatsMemberInterface() {}
-
- const char* name() const { return name_; }
- virtual Type type() const = 0;
- virtual bool is_sequence() const = 0;
- virtual bool is_string() const = 0;
- virtual bool is_defined() const = 0;
- // Type and value comparator. The names are not compared. These operators are
- // exposed for testing.
- bool operator==(const RTCStatsMemberInterface& other) const {
- return IsEqual(other);
- }
- bool operator!=(const RTCStatsMemberInterface& other) const {
- return !(*this == other);
- }
- virtual std::string ValueToString() const = 0;
- // This is the same as ValueToString except for kInt64 and kUint64 types,
- // where the value is represented as a double instead of as an integer.
- // Since JSON stores numbers as floating point numbers, very large integers
- // cannot be accurately represented, so we prefer to display them as doubles
- // instead.
- virtual std::string ValueToJson() const = 0;
-
- template <typename T>
- const T& cast_to() const {
- RTC_DCHECK_EQ(type(), T::StaticType());
- return static_cast<const T&>(*this);
- }
-
- protected:
- explicit RTCStatsMemberInterface(const char* name) : name_(name) {}
-
- virtual bool IsEqual(const RTCStatsMemberInterface& other) const = 0;
-
- const char* const name_;
-};
-
-// Template implementation of `RTCStatsMemberInterface`.
-// The supported types are the ones described by
-// `RTCStatsMemberInterface::Type`.
-template <typename T>
-class RTCStatsMember : public RTCStatsMemberInterface {
- public:
- explicit RTCStatsMember(const char* name)
- : RTCStatsMemberInterface(name), value_() {}
- RTCStatsMember(const char* name, const T& value)
- : RTCStatsMemberInterface(name), value_(value) {}
- RTCStatsMember(const char* name, T&& value)
- : RTCStatsMemberInterface(name), value_(std::move(value)) {}
- explicit RTCStatsMember(const RTCStatsMember<T>& other)
- : RTCStatsMemberInterface(other.name_), value_(other.value_) {}
- explicit RTCStatsMember(RTCStatsMember<T>&& other)
- : RTCStatsMemberInterface(other.name_), value_(std::move(other.value_)) {}
-
- static Type StaticType();
- Type type() const override { return StaticType(); }
- bool is_sequence() const override;
- bool is_string() const override;
- bool is_defined() const override { return value_.has_value(); }
- std::string ValueToString() const override;
- std::string ValueToJson() const override;
-
- template <typename U>
- inline T ValueOrDefault(U default_value) const {
- return value_.value_or(default_value);
- }
-
- // Assignment operators.
- T& operator=(const T& value) {
- value_ = value;
- return value_.value();
- }
- T& operator=(const T&& value) {
- value_ = std::move(value);
- return value_.value();
- }
-
- // Getter methods that look the same as absl::optional<T>. Please prefer these
- // in order to unblock replacing RTCStatsMember<T> with absl::optional<T> in
- // the future (https://crbug.com/webrtc/15164).
- bool has_value() const { return value_.has_value(); }
- const T& value() const { return value_.value(); }
- T& value() { return value_.value(); }
- T& operator*() {
- RTC_DCHECK(value_);
- return *value_;
- }
- const T& operator*() const {
- RTC_DCHECK(value_);
- return *value_;
- }
- T* operator->() {
- RTC_DCHECK(value_);
- return &(*value_);
- }
- const T* operator->() const {
- RTC_DCHECK(value_);
- return &(*value_);
- }
+ std::unique_ptr<webrtc::RTCStats> copy() const override; \
+ const char* type() const override
- protected:
- bool IsEqual(const RTCStatsMemberInterface& other) const override {
- if (type() != other.type())
- return false;
- const RTCStatsMember<T>& other_t =
- static_cast<const RTCStatsMember<T>&>(other);
- return value_ == other_t.value_;
+#define WEBRTC_RTCSTATS_IMPL(this_class, parent_class, type_str, ...) \
+ const char this_class::kType[] = type_str; \
+ \
+ std::unique_ptr<webrtc::RTCStats> this_class::copy() const { \
+ return std::make_unique<this_class>(*this); \
+ } \
+ \
+ const char* this_class::type() const { \
+ return this_class::kType; \
+ } \
+ \
+ std::vector<webrtc::Attribute> this_class::AttributesImpl( \
+ size_t additional_capacity) const { \
+ webrtc::AttributeInit attribute_inits[] = {__VA_ARGS__}; \
+ size_t attribute_inits_size = \
+ sizeof(attribute_inits) / sizeof(attribute_inits[0]); \
+ std::vector<webrtc::Attribute> attributes = parent_class::AttributesImpl( \
+ attribute_inits_size + additional_capacity); \
+ for (size_t i = 0; i < attribute_inits_size; ++i) { \
+ attributes.push_back(absl::visit( \
+ [&](const auto* field) { \
+ return Attribute(attribute_inits[i].name, field); \
+ }, \
+ attribute_inits[i].variant)); \
+ } \
+ return attributes; \
}
- private:
- absl::optional<T> value_;
-};
-
-namespace rtc_stats_internal {
-
-typedef std::map<std::string, uint64_t> MapStringUint64;
-typedef std::map<std::string, double> MapStringDouble;
-
-} // namespace rtc_stats_internal
-
-#define WEBRTC_DECLARE_RTCSTATSMEMBER(T) \
- template <> \
- RTC_EXPORT RTCStatsMemberInterface::Type RTCStatsMember<T>::StaticType(); \
- template <> \
- RTC_EXPORT bool RTCStatsMember<T>::is_sequence() const; \
- template <> \
- RTC_EXPORT bool RTCStatsMember<T>::is_string() const; \
- template <> \
- RTC_EXPORT std::string RTCStatsMember<T>::ValueToString() const; \
- template <> \
- RTC_EXPORT std::string RTCStatsMember<T>::ValueToJson() const; \
- extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) \
- RTCStatsMember<T>
-
-WEBRTC_DECLARE_RTCSTATSMEMBER(bool);
-WEBRTC_DECLARE_RTCSTATSMEMBER(int32_t);
-WEBRTC_DECLARE_RTCSTATSMEMBER(uint32_t);
-WEBRTC_DECLARE_RTCSTATSMEMBER(int64_t);
-WEBRTC_DECLARE_RTCSTATSMEMBER(uint64_t);
-WEBRTC_DECLARE_RTCSTATSMEMBER(double);
-WEBRTC_DECLARE_RTCSTATSMEMBER(std::string);
-WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<bool>);
-WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<int32_t>);
-WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<uint32_t>);
-WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<int64_t>);
-WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<uint64_t>);
-WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<double>);
-WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<std::string>);
-WEBRTC_DECLARE_RTCSTATSMEMBER(rtc_stats_internal::MapStringUint64);
-WEBRTC_DECLARE_RTCSTATSMEMBER(rtc_stats_internal::MapStringDouble);
-
} // namespace webrtc
#endif // API_STATS_RTC_STATS_H_
diff --git a/third_party/libwebrtc/api/stats/rtc_stats_member.h b/third_party/libwebrtc/api/stats/rtc_stats_member.h
new file mode 100644
index 0000000000..9039569ede
--- /dev/null
+++ b/third_party/libwebrtc/api/stats/rtc_stats_member.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2023 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 API_STATS_RTC_STATS_MEMBER_H_
+#define API_STATS_RTC_STATS_MEMBER_H_
+
+#include <map>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "absl/types/optional.h"
+#include "rtc_base/checks.h"
+#include "rtc_base/system/rtc_export.h"
+#include "rtc_base/system/rtc_export_template.h"
+
+namespace webrtc {
+
+// Interface for `RTCStats` members, which have a name and a value of a type
+// defined in a subclass. Only the types listed in `Type` are supported, these
+// are implemented by `RTCStatsMember<T>`. The value of a member may be
+// undefined, the value can only be read if `is_defined`.
+class RTCStatsMemberInterface {
+ public:
+ // Member value types.
+ enum Type {
+ kBool, // bool
+ kInt32, // int32_t
+ kUint32, // uint32_t
+ kInt64, // int64_t
+ kUint64, // uint64_t
+ kDouble, // double
+ kString, // std::string
+
+ kSequenceBool, // std::vector<bool>
+ kSequenceInt32, // std::vector<int32_t>
+ kSequenceUint32, // std::vector<uint32_t>
+ kSequenceInt64, // std::vector<int64_t>
+ kSequenceUint64, // std::vector<uint64_t>
+ kSequenceDouble, // std::vector<double>
+ kSequenceString, // std::vector<std::string>
+
+ kMapStringUint64, // std::map<std::string, uint64_t>
+ kMapStringDouble, // std::map<std::string, double>
+ };
+
+ virtual ~RTCStatsMemberInterface() {}
+
+ virtual Type type() const = 0;
+ virtual bool is_sequence() const = 0;
+ virtual bool is_string() const = 0;
+ virtual bool has_value() const = 0;
+ // Type and value comparator. The names are not compared. These operators are
+ // exposed for testing.
+ bool operator==(const RTCStatsMemberInterface& other) const {
+ return IsEqual(other);
+ }
+ bool operator!=(const RTCStatsMemberInterface& other) const {
+ return !(*this == other);
+ }
+
+ virtual const RTCStatsMemberInterface* member_ptr() const { return this; }
+ template <typename T>
+ const T& cast_to() const {
+ RTC_DCHECK_EQ(type(), T::StaticType());
+ return static_cast<const T&>(*member_ptr());
+ }
+
+ protected:
+ virtual bool IsEqual(const RTCStatsMemberInterface& other) const = 0;
+};
+
+// Template implementation of `RTCStatsMemberInterface`.
+// The supported types are the ones described by
+// `RTCStatsMemberInterface::Type`.
+template <typename T>
+class RTCStatsMember : public RTCStatsMemberInterface {
+ public:
+ RTCStatsMember() {}
+ explicit RTCStatsMember(const T& value) : value_(value) {}
+
+ static Type StaticType();
+ Type type() const override { return StaticType(); }
+ bool is_sequence() const override;
+ bool is_string() const override;
+
+ template <typename U>
+ inline T value_or(U default_value) const {
+ return value_.value_or(default_value);
+ }
+ // TODO(https://crbug.com/webrtc/15164): Migrate to value_or() and delete.
+ template <typename U>
+ inline T ValueOrDefault(U default_value) const {
+ return value_or(default_value);
+ }
+
+ // Assignment operators.
+ T& operator=(const T& value) {
+ value_ = value;
+ return value_.value();
+ }
+ T& operator=(const T&& value) {
+ value_ = std::move(value);
+ return value_.value();
+ }
+
+ // Getter methods that look the same as absl::optional<T>. Please prefer these
+ // in order to unblock replacing RTCStatsMember<T> with absl::optional<T> in
+ // the future (https://crbug.com/webrtc/15164).
+ bool has_value() const override { return value_.has_value(); }
+ const T& value() const { return value_.value(); }
+ T& value() { return value_.value(); }
+ T& operator*() {
+ RTC_DCHECK(value_);
+ return *value_;
+ }
+ const T& operator*() const {
+ RTC_DCHECK(value_);
+ return *value_;
+ }
+ T* operator->() {
+ RTC_DCHECK(value_);
+ return &(*value_);
+ }
+ const T* operator->() const {
+ RTC_DCHECK(value_);
+ return &(*value_);
+ }
+
+ bool IsEqual(const RTCStatsMemberInterface& other) const override {
+ if (type() != other.type())
+ return false;
+ const RTCStatsMember<T>& other_t =
+ static_cast<const RTCStatsMember<T>&>(other);
+ return value_ == other_t.value_;
+ }
+
+ private:
+ absl::optional<T> value_;
+};
+
+namespace rtc_stats_internal {
+
+typedef std::map<std::string, uint64_t> MapStringUint64;
+typedef std::map<std::string, double> MapStringDouble;
+
+} // namespace rtc_stats_internal
+
+#define WEBRTC_DECLARE_RTCSTATSMEMBER(T) \
+ template <> \
+ RTC_EXPORT RTCStatsMemberInterface::Type RTCStatsMember<T>::StaticType(); \
+ template <> \
+ RTC_EXPORT bool RTCStatsMember<T>::is_sequence() const; \
+ template <> \
+ RTC_EXPORT bool RTCStatsMember<T>::is_string() const; \
+ extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) \
+ RTCStatsMember<T>
+
+WEBRTC_DECLARE_RTCSTATSMEMBER(bool);
+WEBRTC_DECLARE_RTCSTATSMEMBER(int32_t);
+WEBRTC_DECLARE_RTCSTATSMEMBER(uint32_t);
+WEBRTC_DECLARE_RTCSTATSMEMBER(int64_t);
+WEBRTC_DECLARE_RTCSTATSMEMBER(uint64_t);
+WEBRTC_DECLARE_RTCSTATSMEMBER(double);
+WEBRTC_DECLARE_RTCSTATSMEMBER(std::string);
+WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<bool>);
+WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<int32_t>);
+WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<uint32_t>);
+WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<int64_t>);
+WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<uint64_t>);
+WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<double>);
+WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<std::string>);
+WEBRTC_DECLARE_RTCSTATSMEMBER(rtc_stats_internal::MapStringUint64);
+WEBRTC_DECLARE_RTCSTATSMEMBER(rtc_stats_internal::MapStringDouble);
+
+} // namespace webrtc
+
+#endif // API_STATS_RTC_STATS_MEMBER_H_
diff --git a/third_party/libwebrtc/api/stats/rtcstats_objects.h b/third_party/libwebrtc/api/stats/rtcstats_objects.h
index c28b635660..351c2cbefe 100644
--- a/third_party/libwebrtc/api/stats/rtcstats_objects.h
+++ b/third_party/libwebrtc/api/stats/rtcstats_objects.h
@@ -27,9 +27,7 @@ namespace webrtc {
class RTC_EXPORT RTCCertificateStats final : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCCertificateStats(std::string id, Timestamp timestamp);
- RTCCertificateStats(const RTCCertificateStats& other);
~RTCCertificateStats() override;
RTCStatsMember<std::string> fingerprint;
@@ -42,9 +40,7 @@ class RTC_EXPORT RTCCertificateStats final : public RTCStats {
class RTC_EXPORT RTCCodecStats final : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCCodecStats(std::string id, Timestamp timestamp);
- RTCCodecStats(const RTCCodecStats& other);
~RTCCodecStats() override;
RTCStatsMember<std::string> transport_id;
@@ -59,9 +55,7 @@ class RTC_EXPORT RTCCodecStats final : public RTCStats {
class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCDataChannelStats(std::string id, Timestamp timestamp);
- RTCDataChannelStats(const RTCDataChannelStats& other);
~RTCDataChannelStats() override;
RTCStatsMember<std::string> label;
@@ -78,9 +72,7 @@ class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCIceCandidatePairStats(std::string id, Timestamp timestamp);
- RTCIceCandidatePairStats(const RTCIceCandidatePairStats& other);
~RTCIceCandidatePairStats() override;
RTCStatsMember<std::string> transport_id;
@@ -118,8 +110,6 @@ class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
-
- RTCIceCandidateStats(const RTCIceCandidateStats& other);
~RTCIceCandidateStats() override;
RTCStatsMember<std::string> transport_id;
@@ -175,9 +165,7 @@ class RTC_EXPORT RTCRemoteIceCandidateStats final
class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCPeerConnectionStats(std::string id, Timestamp timestamp);
- RTCPeerConnectionStats(const RTCPeerConnectionStats& other);
~RTCPeerConnectionStats() override;
RTCStatsMember<uint32_t> data_channels_opened;
@@ -188,8 +176,6 @@ class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats {
class RTC_EXPORT RTCRtpStreamStats : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
-
- RTCRtpStreamStats(const RTCRtpStreamStats& other);
~RTCRtpStreamStats() override;
RTCStatsMember<uint32_t> ssrc;
@@ -205,8 +191,6 @@ class RTC_EXPORT RTCRtpStreamStats : public RTCStats {
class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRtpStreamStats {
public:
WEBRTC_RTCSTATS_DECL();
-
- RTCReceivedRtpStreamStats(const RTCReceivedRtpStreamStats& other);
~RTCReceivedRtpStreamStats() override;
RTCStatsMember<double> jitter;
@@ -220,8 +204,6 @@ class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRtpStreamStats {
class RTC_EXPORT RTCSentRtpStreamStats : public RTCRtpStreamStats {
public:
WEBRTC_RTCSTATS_DECL();
-
- RTCSentRtpStreamStats(const RTCSentRtpStreamStats& other);
~RTCSentRtpStreamStats() override;
RTCStatsMember<uint64_t> packets_sent;
@@ -236,9 +218,7 @@ class RTC_EXPORT RTCInboundRtpStreamStats final
: public RTCReceivedRtpStreamStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCInboundRtpStreamStats(std::string id, Timestamp timestamp);
- RTCInboundRtpStreamStats(const RTCInboundRtpStreamStats& other);
~RTCInboundRtpStreamStats() override;
RTCStatsMember<std::string> playout_id;
@@ -341,9 +321,7 @@ class RTC_EXPORT RTCOutboundRtpStreamStats final
: public RTCSentRtpStreamStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCOutboundRtpStreamStats(std::string id, Timestamp timestamp);
- RTCOutboundRtpStreamStats(const RTCOutboundRtpStreamStats& other);
~RTCOutboundRtpStreamStats() override;
RTCStatsMember<std::string> media_source_id;
@@ -393,9 +371,7 @@ class RTC_EXPORT RTCRemoteInboundRtpStreamStats final
: public RTCReceivedRtpStreamStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCRemoteInboundRtpStreamStats(std::string id, Timestamp timestamp);
- RTCRemoteInboundRtpStreamStats(const RTCRemoteInboundRtpStreamStats& other);
~RTCRemoteInboundRtpStreamStats() override;
RTCStatsMember<std::string> local_id;
@@ -410,9 +386,7 @@ class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final
: public RTCSentRtpStreamStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCRemoteOutboundRtpStreamStats(std::string id, Timestamp timestamp);
- RTCRemoteOutboundRtpStreamStats(const RTCRemoteOutboundRtpStreamStats& other);
~RTCRemoteOutboundRtpStreamStats() override;
RTCStatsMember<std::string> local_id;
@@ -427,8 +401,6 @@ class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final
class RTC_EXPORT RTCMediaSourceStats : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
-
- RTCMediaSourceStats(const RTCMediaSourceStats& other);
~RTCMediaSourceStats() override;
RTCStatsMember<std::string> track_identifier;
@@ -442,9 +414,7 @@ class RTC_EXPORT RTCMediaSourceStats : public RTCStats {
class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCAudioSourceStats(std::string id, Timestamp timestamp);
- RTCAudioSourceStats(const RTCAudioSourceStats& other);
~RTCAudioSourceStats() override;
RTCStatsMember<double> audio_level;
@@ -458,9 +428,7 @@ class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats {
class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCVideoSourceStats(std::string id, Timestamp timestamp);
- RTCVideoSourceStats(const RTCVideoSourceStats& other);
~RTCVideoSourceStats() override;
RTCStatsMember<uint32_t> width;
@@ -473,9 +441,7 @@ class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats {
class RTC_EXPORT RTCTransportStats final : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCTransportStats(std::string id, Timestamp timestamp);
- RTCTransportStats(const RTCTransportStats& other);
~RTCTransportStats() override;
RTCStatsMember<uint64_t> bytes_sent;
@@ -501,9 +467,7 @@ class RTC_EXPORT RTCTransportStats final : public RTCStats {
class RTC_EXPORT RTCAudioPlayoutStats final : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
-
RTCAudioPlayoutStats(const std::string& id, Timestamp timestamp);
- RTCAudioPlayoutStats(const RTCAudioPlayoutStats& other);
~RTCAudioPlayoutStats() override;
RTCStatsMember<std::string> kind;
diff --git a/third_party/libwebrtc/api/task_queue/BUILD.gn b/third_party/libwebrtc/api/task_queue/BUILD.gn
index 9b2f747e78..c24c22a1f6 100644
--- a/third_party/libwebrtc/api/task_queue/BUILD.gn
+++ b/third_party/libwebrtc/api/task_queue/BUILD.gn
@@ -88,6 +88,10 @@ rtc_library("task_queue_test") {
}
rtc_library("default_task_queue_factory") {
+# Mozilla - disable this entire target to avoid inclusion of code we want
+# to avoid. Better here than trying to wack-a-mole for places that list
+# it as a dependency.
+if (!build_with_mozilla) {
visibility = [ "*" ]
if (!is_ios && !is_android) {
# Internally webrtc shouldn't rely on any specific TaskQueue implementation
@@ -119,13 +123,14 @@ rtc_library("default_task_queue_factory") {
} else if (is_mac || is_ios) {
sources += [ "default_task_queue_factory_gcd.cc" ]
deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
- } else if (is_win && current_os != "winuwp") {
+ } else if (is_win && current_os != "winuwp" && !build_with_chromium) {
sources += [ "default_task_queue_factory_win.cc" ]
deps += [ "../../rtc_base:rtc_task_queue_win" ]
} else {
sources += [ "default_task_queue_factory_stdlib.cc" ]
deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
}
+} # of if (!build_with_mozilla) {
}
rtc_library("pending_task_safety_flag") {
diff --git a/third_party/libwebrtc/api/task_queue/default_task_queue_factory_gn/moz.build b/third_party/libwebrtc/api/task_queue/default_task_queue_factory_gn/moz.build
new file mode 100644
index 0000000000..0911b84473
--- /dev/null
+++ b/third_party/libwebrtc/api/task_queue/default_task_queue_factory_gn/moz.build
@@ -0,0 +1,198 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
+ ### This moz.build was AUTOMATICALLY GENERATED from a GN config, ###
+ ### DO NOT edit it by hand. ###
+
+COMPILE_FLAGS["OS_INCLUDES"] = []
+AllowCompilerWarnings()
+
+DEFINES["ABSL_ALLOCATOR_NOTHROW"] = "1"
+DEFINES["RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY"] = True
+DEFINES["RTC_ENABLE_VP9"] = True
+DEFINES["WEBRTC_ENABLE_PROTOBUF"] = "0"
+DEFINES["WEBRTC_LIBRARY_IMPL"] = True
+DEFINES["WEBRTC_MOZILLA_BUILD"] = True
+DEFINES["WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS"] = "0"
+DEFINES["WEBRTC_STRICT_FIELD_TRIALS"] = "0"
+
+FINAL_LIBRARY = "webrtc"
+
+
+LOCAL_INCLUDES += [
+ "!/ipc/ipdl/_ipdlheaders",
+ "!/third_party/libwebrtc/gen",
+ "/ipc/chromium/src",
+ "/third_party/libwebrtc/",
+ "/third_party/libwebrtc/third_party/abseil-cpp/",
+ "/tools/profiler/public"
+]
+
+if not CONFIG["MOZ_DEBUG"]:
+
+ DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
+ DEFINES["NDEBUG"] = True
+ DEFINES["NVALGRIND"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1":
+
+ DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
+
+if CONFIG["OS_TARGET"] == "Android":
+
+ DEFINES["ANDROID"] = True
+ DEFINES["ANDROID_NDK_VERSION_ROLL"] = "r22_1"
+ DEFINES["HAVE_SYS_UIO_H"] = True
+ DEFINES["WEBRTC_ANDROID"] = True
+ DEFINES["WEBRTC_ANDROID_OPENSLES"] = True
+ DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True
+ DEFINES["WEBRTC_LINUX"] = True
+ DEFINES["WEBRTC_POSIX"] = True
+ DEFINES["_GNU_SOURCE"] = True
+ DEFINES["__STDC_CONSTANT_MACROS"] = True
+ DEFINES["__STDC_FORMAT_MACROS"] = True
+
+if CONFIG["OS_TARGET"] == "Darwin":
+
+ DEFINES["WEBRTC_MAC"] = True
+ DEFINES["WEBRTC_POSIX"] = True
+ DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
+ DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
+ DEFINES["__STDC_CONSTANT_MACROS"] = True
+ DEFINES["__STDC_FORMAT_MACROS"] = True
+
+if CONFIG["OS_TARGET"] == "Linux":
+
+ DEFINES["USE_AURA"] = "1"
+ DEFINES["USE_GLIB"] = "1"
+ DEFINES["USE_NSS_CERTS"] = "1"
+ DEFINES["USE_OZONE"] = "1"
+ DEFINES["USE_UDEV"] = True
+ DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True
+ DEFINES["WEBRTC_LINUX"] = True
+ DEFINES["WEBRTC_POSIX"] = True
+ DEFINES["_FILE_OFFSET_BITS"] = "64"
+ DEFINES["_LARGEFILE64_SOURCE"] = True
+ DEFINES["_LARGEFILE_SOURCE"] = True
+ DEFINES["__STDC_CONSTANT_MACROS"] = True
+ DEFINES["__STDC_FORMAT_MACROS"] = True
+
+if CONFIG["OS_TARGET"] == "OpenBSD":
+
+ DEFINES["USE_GLIB"] = "1"
+ DEFINES["USE_OZONE"] = "1"
+ DEFINES["USE_X11"] = "1"
+ DEFINES["WEBRTC_BSD"] = True
+ DEFINES["WEBRTC_ENABLE_LIBEVENT"] = True
+ DEFINES["WEBRTC_POSIX"] = True
+ DEFINES["_FILE_OFFSET_BITS"] = "64"
+ DEFINES["_LARGEFILE64_SOURCE"] = True
+ DEFINES["_LARGEFILE_SOURCE"] = True
+ DEFINES["__STDC_CONSTANT_MACROS"] = True
+ DEFINES["__STDC_FORMAT_MACROS"] = True
+
+if CONFIG["OS_TARGET"] == "WINNT":
+
+ DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
+ DEFINES["NOMINMAX"] = True
+ DEFINES["NTDDI_VERSION"] = "0x0A000000"
+ DEFINES["PSAPI_VERSION"] = "2"
+ DEFINES["RTC_ENABLE_WIN_WGC"] = True
+ DEFINES["UNICODE"] = True
+ DEFINES["USE_AURA"] = "1"
+ DEFINES["WEBRTC_WIN"] = True
+ DEFINES["WIN32"] = True
+ DEFINES["WIN32_LEAN_AND_MEAN"] = True
+ DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
+ DEFINES["WINVER"] = "0x0A00"
+ DEFINES["_ATL_NO_OPENGL"] = True
+ DEFINES["_CRT_RAND_S"] = True
+ DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
+ DEFINES["_ENABLE_EXTENDED_ALIGNED_STORAGE"] = True
+ DEFINES["_HAS_EXCEPTIONS"] = "0"
+ DEFINES["_HAS_NODISCARD"] = True
+ DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
+ DEFINES["_SECURE_ATL"] = True
+ DEFINES["_UNICODE"] = True
+ DEFINES["_WIN32_WINNT"] = "0x0A00"
+ DEFINES["_WINDOWS"] = True
+ DEFINES["__STD_C"] = True
+
+if CONFIG["TARGET_CPU"] == "aarch64":
+
+ DEFINES["WEBRTC_ARCH_ARM64"] = True
+ DEFINES["WEBRTC_HAS_NEON"] = True
+
+if CONFIG["TARGET_CPU"] == "arm":
+
+ DEFINES["WEBRTC_ARCH_ARM"] = True
+ DEFINES["WEBRTC_ARCH_ARM_V7"] = True
+ DEFINES["WEBRTC_HAS_NEON"] = True
+
+if CONFIG["TARGET_CPU"] == "mips32":
+
+ DEFINES["MIPS32_LE"] = True
+ DEFINES["MIPS_FPU_LE"] = True
+ DEFINES["_GNU_SOURCE"] = True
+
+if CONFIG["TARGET_CPU"] == "mips64":
+
+ DEFINES["_GNU_SOURCE"] = True
+
+if CONFIG["TARGET_CPU"] == "x86":
+
+ DEFINES["WEBRTC_ENABLE_AVX2"] = True
+
+if CONFIG["TARGET_CPU"] == "x86_64":
+
+ DEFINES["WEBRTC_ENABLE_AVX2"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Android":
+
+ DEFINES["_DEBUG"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Darwin":
+
+ DEFINES["_DEBUG"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+
+ DEFINES["_DEBUG"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "OpenBSD":
+
+ DEFINES["_DEBUG"] = True
+
+if CONFIG["MOZ_DEBUG"] == "1" and CONFIG["OS_TARGET"] == "WINNT":
+
+ DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
+
+if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+
+ DEFINES["USE_X11"] = "1"
+
+if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm":
+
+ OS_LIBS += [
+ "unwind"
+ ]
+
+if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64":
+
+ DEFINES["_GNU_SOURCE"] = True
+
+if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "arm":
+
+ DEFINES["_GNU_SOURCE"] = True
+
+if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86":
+
+ DEFINES["_GNU_SOURCE"] = True
+
+if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "x86_64":
+
+ DEFINES["_GNU_SOURCE"] = True
+
+Library("default_task_queue_factory_gn")
diff --git a/third_party/libwebrtc/api/test/create_network_emulation_manager.cc b/third_party/libwebrtc/api/test/create_network_emulation_manager.cc
index f5d5a1bc88..14a7a6a171 100644
--- a/third_party/libwebrtc/api/test/create_network_emulation_manager.cc
+++ b/third_party/libwebrtc/api/test/create_network_emulation_manager.cc
@@ -13,15 +13,17 @@
#include <memory>
+#include "api/field_trials_view.h"
#include "test/network/network_emulation_manager.h"
namespace webrtc {
std::unique_ptr<NetworkEmulationManager> CreateNetworkEmulationManager(
TimeMode time_mode,
- EmulatedNetworkStatsGatheringMode stats_gathering_mode) {
+ EmulatedNetworkStatsGatheringMode stats_gathering_mode,
+ const FieldTrialsView* field_trials) {
return std::make_unique<test::NetworkEmulationManagerImpl>(
- time_mode, stats_gathering_mode);
+ time_mode, stats_gathering_mode, field_trials);
}
} // namespace webrtc
diff --git a/third_party/libwebrtc/api/test/create_network_emulation_manager.h b/third_party/libwebrtc/api/test/create_network_emulation_manager.h
index 941b2b1c52..2f2dfeda28 100644
--- a/third_party/libwebrtc/api/test/create_network_emulation_manager.h
+++ b/third_party/libwebrtc/api/test/create_network_emulation_manager.h
@@ -13,6 +13,7 @@
#include <memory>
+#include "api/field_trials_view.h"
#include "api/test/network_emulation_manager.h"
namespace webrtc {
@@ -21,7 +22,8 @@ namespace webrtc {
std::unique_ptr<NetworkEmulationManager> CreateNetworkEmulationManager(
TimeMode time_mode = TimeMode::kRealTime,
EmulatedNetworkStatsGatheringMode stats_gathering_mode =
- EmulatedNetworkStatsGatheringMode::kDefault);
+ EmulatedNetworkStatsGatheringMode::kDefault,
+ const FieldTrialsView* field_trials = nullptr);
} // namespace webrtc
diff --git a/third_party/libwebrtc/api/test/create_time_controller.cc b/third_party/libwebrtc/api/test/create_time_controller.cc
index 7523e05208..cbf1f09aa1 100644
--- a/third_party/libwebrtc/api/test/create_time_controller.cc
+++ b/third_party/libwebrtc/api/test/create_time_controller.cc
@@ -16,10 +16,10 @@
#include "absl/base/nullability.h"
#include "api/enable_media_with_defaults.h"
#include "api/environment/environment.h"
+#include "api/environment/environment_factory.h"
#include "api/peer_connection_interface.h"
#include "call/call.h"
-#include "call/rtp_transport_config.h"
-#include "call/rtp_transport_controller_send_factory_interface.h"
+#include "call/call_config.h"
#include "pc/media_factory.h"
#include "rtc_base/checks.h"
#include "system_wrappers/include/clock.h"
@@ -49,9 +49,12 @@ void EnableMediaWithDefaultsAndTimeController(
: clock_(clock), media_factory_(std::move(media_factory)) {}
std::unique_ptr<Call> CreateCall(const CallConfig& config) override {
- return Call::Create(config, clock_,
- config.rtp_transport_controller_send_factory->Create(
- config.ExtractTransportConfig(), clock_));
+ EnvironmentFactory env_factory(config.env);
+ env_factory.Set(clock_);
+
+ CallConfig config_with_custom_clock = config;
+ config_with_custom_clock.env = env_factory.Create();
+ return media_factory_->CreateCall(config_with_custom_clock);
}
std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine(
diff --git a/third_party/libwebrtc/api/test/pclf/BUILD.gn b/third_party/libwebrtc/api/test/pclf/BUILD.gn
index 372ff51f49..4f62984e83 100644
--- a/third_party/libwebrtc/api/test/pclf/BUILD.gn
+++ b/third_party/libwebrtc/api/test/pclf/BUILD.gn
@@ -20,7 +20,6 @@ rtc_source_set("media_configuration") {
"../..:array_view",
"../..:audio_options_api",
"../..:audio_quality_analyzer_api",
- "../..:callfactory_api",
"../..:fec_controller_api",
"../..:frame_generator_api",
"../..:function_view",
diff --git a/third_party/libwebrtc/api/test/pclf/media_configuration.h b/third_party/libwebrtc/api/test/pclf/media_configuration.h
index 5c3440c293..ad29e17e7d 100644
--- a/third_party/libwebrtc/api/test/pclf/media_configuration.h
+++ b/third_party/libwebrtc/api/test/pclf/media_configuration.h
@@ -26,7 +26,6 @@
#include "api/array_view.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_options.h"
-#include "api/call/call_factory_interface.h"
#include "api/fec_controller.h"
#include "api/function_view.h"
#include "api/media_stream_interface.h"
diff --git a/third_party/libwebrtc/api/test/pclf/media_quality_test_params.h b/third_party/libwebrtc/api/test/pclf/media_quality_test_params.h
index aad04c3eb6..8a3a13a33b 100644
--- a/third_party/libwebrtc/api/test/pclf/media_quality_test_params.h
+++ b/third_party/libwebrtc/api/test/pclf/media_quality_test_params.h
@@ -136,6 +136,7 @@ struct Params {
// provided into VideoEncoder::SetRates(...).
double video_encoder_bitrate_multiplier = 1.0;
+ PeerConnectionFactoryInterface::Options peer_connection_factory_options;
PeerConnectionInterface::RTCConfiguration rtc_configuration;
PeerConnectionInterface::RTCOfferAnswerOptions rtc_offer_answer_options;
BitrateSettings bitrate_settings;
diff --git a/third_party/libwebrtc/api/test/pclf/peer_configurer.cc b/third_party/libwebrtc/api/test/pclf/peer_configurer.cc
index 5e385452b1..ac0d02818f 100644
--- a/third_party/libwebrtc/api/test/pclf/peer_configurer.cc
+++ b/third_party/libwebrtc/api/test/pclf/peer_configurer.cc
@@ -205,6 +205,11 @@ PeerConfigurer* PeerConfigurer::SetAecDumpPath(absl::string_view path) {
params_->aec_dump_path = std::string(path);
return this;
}
+PeerConfigurer* PeerConfigurer::SetPCFOptions(
+ PeerConnectionFactoryInterface::Options options) {
+ params_->peer_connection_factory_options = std::move(options);
+ return this;
+}
PeerConfigurer* PeerConfigurer::SetRTCConfiguration(
PeerConnectionInterface::RTCConfiguration configuration) {
params_->rtc_configuration = std::move(configuration);
diff --git a/third_party/libwebrtc/api/test/pclf/peer_configurer.h b/third_party/libwebrtc/api/test/pclf/peer_configurer.h
index c0faf8573a..1c6fb4c0e6 100644
--- a/third_party/libwebrtc/api/test/pclf/peer_configurer.h
+++ b/third_party/libwebrtc/api/test/pclf/peer_configurer.h
@@ -158,6 +158,8 @@ class PeerConfigurer {
// If is set, an AEC dump will be saved in that location and it will be
// available for further analysis.
PeerConfigurer* SetAecDumpPath(absl::string_view path);
+ PeerConfigurer* SetPCFOptions(
+ PeerConnectionFactoryInterface::Options options);
PeerConfigurer* SetRTCConfiguration(
PeerConnectionInterface::RTCConfiguration configuration);
PeerConfigurer* SetRTCOfferAnswerOptions(
diff --git a/third_party/libwebrtc/api/test/peerconnection_quality_test_fixture.h b/third_party/libwebrtc/api/test/peerconnection_quality_test_fixture.h
index 034e13ff3b..7e19eb1629 100644
--- a/third_party/libwebrtc/api/test/peerconnection_quality_test_fixture.h
+++ b/third_party/libwebrtc/api/test/peerconnection_quality_test_fixture.h
@@ -26,7 +26,6 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/audio_mixer.h"
-#include "api/call/call_factory_interface.h"
#include "api/fec_controller.h"
#include "api/function_view.h"
#include "api/media_stream_interface.h"
diff --git a/third_party/libwebrtc/api/test/video_quality_test_fixture.h b/third_party/libwebrtc/api/test/video_quality_test_fixture.h
index b45faef286..cbe547b60d 100644
--- a/third_party/libwebrtc/api/test/video_quality_test_fixture.h
+++ b/third_party/libwebrtc/api/test/video_quality_test_fixture.h
@@ -61,7 +61,7 @@ class VideoQualityTestFixtureInterface {
bool automatic_scaling = false;
std::string clip_path; // "Generator" to generate frames instead.
size_t capture_device_index = 0;
- SdpVideoFormat::Parameters sdp_params;
+ CodecParameterMap sdp_params;
double encoder_overshoot_factor = 0.0;
} video[2];
struct Audio {
diff --git a/third_party/libwebrtc/api/transport/rtp/dependency_descriptor.h b/third_party/libwebrtc/api/transport/rtp/dependency_descriptor.h
index 0db600918e..f546a0aa3f 100644
--- a/third_party/libwebrtc/api/transport/rtp/dependency_descriptor.h
+++ b/third_party/libwebrtc/api/transport/rtp/dependency_descriptor.h
@@ -78,6 +78,27 @@ struct FrameDependencyStructure {
std::vector<FrameDependencyTemplate> templates;
};
+class DependencyDescriptorMandatory {
+ public:
+ void set_frame_number(int frame_number) { frame_number_ = frame_number; }
+ int frame_number() const { return frame_number_; }
+
+ void set_template_id(int template_id) { template_id_ = template_id; }
+ int template_id() const { return template_id_; }
+
+ void set_first_packet_in_frame(bool first) { first_packet_in_frame_ = first; }
+ bool first_packet_in_frame() const { return first_packet_in_frame_; }
+
+ void set_last_packet_in_frame(bool last) { last_packet_in_frame_ = last; }
+ bool last_packet_in_frame() const { return last_packet_in_frame_; }
+
+ private:
+ int frame_number_;
+ int template_id_;
+ bool first_packet_in_frame_;
+ bool last_packet_in_frame_;
+};
+
struct DependencyDescriptor {
static constexpr int kMaxSpatialIds = 4;
static constexpr int kMaxTemporalIds = 8;
diff --git a/third_party/libwebrtc/api/transport/stun.cc b/third_party/libwebrtc/api/transport/stun.cc
index 7ef6852260..ca90515952 100644
--- a/third_party/libwebrtc/api/transport/stun.cc
+++ b/third_party/libwebrtc/api/transport/stun.cc
@@ -587,7 +587,7 @@ bool StunMessage::AddFingerprint() {
bool StunMessage::Read(ByteBufferReader* buf) {
// Keep a copy of the buffer data around for later verification.
- buffer_.assign(buf->Data(), buf->Length());
+ buffer_.assign(reinterpret_cast<const char*>(buf->Data()), buf->Length());
if (!buf->ReadUInt16(&type_)) {
return false;
@@ -603,8 +603,8 @@ bool StunMessage::Read(ByteBufferReader* buf) {
return false;
}
- std::string magic_cookie;
- if (!buf->ReadString(&magic_cookie, kStunMagicCookieLength)) {
+ absl::string_view magic_cookie;
+ if (!buf->ReadStringView(&magic_cookie, kStunMagicCookieLength)) {
return false;
}
@@ -814,7 +814,7 @@ void StunAttribute::ConsumePadding(ByteBufferReader* buf) const {
void StunAttribute::WritePadding(ByteBufferWriter* buf) const {
int remainder = length_ % 4;
if (remainder > 0) {
- char zeroes[4] = {0};
+ uint8_t zeroes[4] = {0};
buf->WriteBytes(zeroes, 4 - remainder);
}
}
@@ -949,12 +949,12 @@ bool StunAddressAttribute::Write(ByteBufferWriter* buf) const {
switch (address_.family()) {
case AF_INET: {
in_addr v4addr = address_.ipaddr().ipv4_address();
- buf->WriteBytes(reinterpret_cast<char*>(&v4addr), sizeof(v4addr));
+ buf->WriteBytes(reinterpret_cast<uint8_t*>(&v4addr), sizeof(v4addr));
break;
}
case AF_INET6: {
in6_addr v6addr = address_.ipaddr().ipv6_address();
- buf->WriteBytes(reinterpret_cast<char*>(&v6addr), sizeof(v6addr));
+ buf->WriteBytes(reinterpret_cast<uint8_t*>(&v6addr), sizeof(v6addr));
break;
}
}
@@ -1039,12 +1039,14 @@ bool StunXorAddressAttribute::Write(ByteBufferWriter* buf) const {
switch (xored_ip.family()) {
case AF_INET: {
in_addr v4addr = xored_ip.ipv4_address();
- buf->WriteBytes(reinterpret_cast<const char*>(&v4addr), sizeof(v4addr));
+ buf->WriteBytes(reinterpret_cast<const uint8_t*>(&v4addr),
+ sizeof(v4addr));
break;
}
case AF_INET6: {
in6_addr v6addr = xored_ip.ipv6_address();
- buf->WriteBytes(reinterpret_cast<const char*>(&v6addr), sizeof(v6addr));
+ buf->WriteBytes(reinterpret_cast<const uint8_t*>(&v6addr),
+ sizeof(v6addr));
break;
}
}
@@ -1170,7 +1172,7 @@ bool StunByteStringAttribute::Write(ByteBufferWriter* buf) const {
if (!LengthValid(type(), length())) {
return false;
}
- buf->WriteBytes(reinterpret_cast<const char*>(bytes_), length());
+ buf->WriteBytes(bytes_, length());
WritePadding(buf);
return true;
}
diff --git a/third_party/libwebrtc/api/video_codecs/BUILD.gn b/third_party/libwebrtc/api/video_codecs/BUILD.gn
index 94c9cc8b87..3865f4fee7 100644
--- a/third_party/libwebrtc/api/video_codecs/BUILD.gn
+++ b/third_party/libwebrtc/api/video_codecs/BUILD.gn
@@ -83,6 +83,7 @@ rtc_library("video_codecs_api") {
"..:fec_controller_api",
"..:scoped_refptr",
"../../api:array_view",
+ "../../api:rtp_parameters",
"../../modules/video_coding:codec_globals_headers",
"../../rtc_base:checks",
"../../rtc_base:logging",
diff --git a/third_party/libwebrtc/api/video_codecs/av1_profile.cc b/third_party/libwebrtc/api/video_codecs/av1_profile.cc
index eefe166d80..59d7b13e51 100644
--- a/third_party/libwebrtc/api/video_codecs/av1_profile.cc
+++ b/third_party/libwebrtc/api/video_codecs/av1_profile.cc
@@ -50,7 +50,7 @@ absl::optional<AV1Profile> StringToAV1Profile(absl::string_view str) {
}
absl::optional<AV1Profile> ParseSdpForAV1Profile(
- const SdpVideoFormat::Parameters& params) {
+ const CodecParameterMap& params) {
const auto profile_it = params.find(kAV1FmtpProfile);
if (profile_it == params.end())
return AV1Profile::kProfile0;
@@ -58,8 +58,8 @@ absl::optional<AV1Profile> ParseSdpForAV1Profile(
return StringToAV1Profile(profile_str);
}
-bool AV1IsSameProfile(const SdpVideoFormat::Parameters& params1,
- const SdpVideoFormat::Parameters& params2) {
+bool AV1IsSameProfile(const CodecParameterMap& params1,
+ const CodecParameterMap& params2) {
const absl::optional<AV1Profile> profile = ParseSdpForAV1Profile(params1);
const absl::optional<AV1Profile> other_profile =
ParseSdpForAV1Profile(params2);
diff --git a/third_party/libwebrtc/api/video_codecs/av1_profile.h b/third_party/libwebrtc/api/video_codecs/av1_profile.h
index 2254d5ecd3..bc9767631c 100644
--- a/third_party/libwebrtc/api/video_codecs/av1_profile.h
+++ b/third_party/libwebrtc/api/video_codecs/av1_profile.h
@@ -45,12 +45,12 @@ absl::optional<AV1Profile> StringToAV1Profile(absl::string_view profile);
// specified and an empty value if the profile key is present but contains an
// invalid value.
RTC_EXPORT absl::optional<AV1Profile> ParseSdpForAV1Profile(
- const SdpVideoFormat::Parameters& params);
+ const CodecParameterMap& params);
// Returns true if the parameters have the same AV1 profile or neither contains
// an AV1 profile, otherwise false.
-bool AV1IsSameProfile(const SdpVideoFormat::Parameters& params1,
- const SdpVideoFormat::Parameters& params2);
+bool AV1IsSameProfile(const CodecParameterMap& params1,
+ const CodecParameterMap& params2);
} // namespace webrtc
diff --git a/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc b/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc
index 5844ca0e32..9bd9c9e4ab 100644
--- a/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc
+++ b/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc
@@ -178,7 +178,7 @@ absl::optional<H264Level> H264SupportedLevel(int max_frame_pixel_count,
}
absl::optional<H264ProfileLevelId> ParseSdpForH264ProfileLevelId(
- const SdpVideoFormat::Parameters& params) {
+ const CodecParameterMap& params) {
// TODO(magjed): The default should really be kProfileBaseline and kLevel1
// according to the spec: https://tools.ietf.org/html/rfc6184#section-8.1. In
// order to not break backwards compatibility with older versions of WebRTC
@@ -243,8 +243,8 @@ absl::optional<std::string> H264ProfileLevelIdToString(
return {str};
}
-bool H264IsSameProfile(const SdpVideoFormat::Parameters& params1,
- const SdpVideoFormat::Parameters& params2) {
+bool H264IsSameProfile(const CodecParameterMap& params1,
+ const CodecParameterMap& params2) {
const absl::optional<H264ProfileLevelId> profile_level_id =
ParseSdpForH264ProfileLevelId(params1);
const absl::optional<H264ProfileLevelId> other_profile_level_id =
diff --git a/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.h b/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.h
index 4b46ad329d..37709fae64 100644
--- a/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.h
+++ b/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.h
@@ -67,7 +67,7 @@ absl::optional<H264ProfileLevelId> ParseH264ProfileLevelId(const char* str);
// returned if the profile-level-id key is missing. Nothing will be returned if
// the key is present but the string is invalid.
RTC_EXPORT absl::optional<H264ProfileLevelId> ParseSdpForH264ProfileLevelId(
- const SdpVideoFormat::Parameters& params);
+ const CodecParameterMap& params);
// Given that a decoder supports up to a given frame size (in pixels) at up to a
// given number of frames per second, return the highest H.264 level where it
@@ -84,8 +84,8 @@ RTC_EXPORT absl::optional<std::string> H264ProfileLevelIdToString(
// Returns true if the parameters have the same H264 profile (Baseline, High,
// etc).
-RTC_EXPORT bool H264IsSameProfile(const SdpVideoFormat::Parameters& params1,
- const SdpVideoFormat::Parameters& params2);
+RTC_EXPORT bool H264IsSameProfile(const CodecParameterMap& params1,
+ const CodecParameterMap& params2);
} // namespace webrtc
diff --git a/third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.cc b/third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.cc
index f5b376e287..f4dcebb25a 100644
--- a/third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.cc
+++ b/third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.cc
@@ -1,248 +1,248 @@
-/*
- * Copyright (c) 2023 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.
- */
-
-#include "api/video_codecs/h265_profile_tier_level.h"
-
-#include <string>
-
-#include "rtc_base/string_to_number.h"
-
-namespace webrtc {
-
-namespace {
-
-const char kH265FmtpProfile[] = "profile-id";
-const char kH265FmtpTier[] = "tier-flag";
-const char kH265FmtpLevel[] = "level-id";
-
-} // anonymous namespace
-
-// Annex A of https://www.itu.int/rec/T-REC-H.265 (08/21), section A.3.
-absl::optional<H265Profile> StringToH265Profile(const std::string& profile) {
- absl::optional<int> i = rtc::StringToNumber<int>(profile);
- if (!i.has_value()) {
- return absl::nullopt;
- }
-
- switch (i.value()) {
- case 1:
- return H265Profile::kProfileMain;
- case 2:
- return H265Profile::kProfileMain10;
- case 3:
- return H265Profile::kProfileMainStill;
- case 4:
- return H265Profile::kProfileRangeExtensions;
- case 5:
- return H265Profile::kProfileHighThroughput;
- case 6:
- return H265Profile::kProfileMultiviewMain;
- case 7:
- return H265Profile::kProfileScalableMain;
- case 8:
- return H265Profile::kProfile3dMain;
- case 9:
- return H265Profile::kProfileScreenContentCoding;
- case 10:
- return H265Profile::kProfileScalableRangeExtensions;
- case 11:
- return H265Profile::kProfileHighThroughputScreenContentCoding;
- default:
- return absl::nullopt;
- }
-}
-
-// Annex A of https://www.itu.int/rec/T-REC-H.265 (08/21), section A.4,
-// tiers and levels.
-absl::optional<H265Tier> StringToH265Tier(const std::string& tier) {
- absl::optional<int> i = rtc::StringToNumber<int>(tier);
- if (!i.has_value()) {
- return absl::nullopt;
- }
-
- switch (i.value()) {
- case 0:
- return H265Tier::kTier0;
- case 1:
- return H265Tier::kTier1;
- default:
- return absl::nullopt;
- }
-}
-
-absl::optional<H265Level> StringToH265Level(const std::string& level) {
- const absl::optional<int> i = rtc::StringToNumber<int>(level);
- if (!i.has_value())
- return absl::nullopt;
-
- switch (i.value()) {
- case 30:
- return H265Level::kLevel1;
- case 60:
- return H265Level::kLevel2;
- case 63:
- return H265Level::kLevel2_1;
- case 90:
- return H265Level::kLevel3;
- case 93:
- return H265Level::kLevel3_1;
- case 120:
- return H265Level::kLevel4;
- case 123:
- return H265Level::kLevel4_1;
- case 150:
- return H265Level::kLevel5;
- case 153:
- return H265Level::kLevel5_1;
- case 156:
- return H265Level::kLevel5_2;
- case 180:
- return H265Level::kLevel6;
- case 183:
- return H265Level::kLevel6_1;
- case 186:
- return H265Level::kLevel6_2;
- default:
- return absl::nullopt;
- }
-}
-
-std::string H265ProfileToString(H265Profile profile) {
- switch (profile) {
- case H265Profile::kProfileMain:
- return "1";
- case H265Profile::kProfileMain10:
- return "2";
- case H265Profile::kProfileMainStill:
- return "3";
- case H265Profile::kProfileRangeExtensions:
- return "4";
- case H265Profile::kProfileHighThroughput:
- return "5";
- case H265Profile::kProfileMultiviewMain:
- return "6";
- case H265Profile::kProfileScalableMain:
- return "7";
- case H265Profile::kProfile3dMain:
- return "8";
- case H265Profile::kProfileScreenContentCoding:
- return "9";
- case H265Profile::kProfileScalableRangeExtensions:
- return "10";
- case H265Profile::kProfileHighThroughputScreenContentCoding:
- return "11";
- }
-}
-
-std::string H265TierToString(H265Tier tier) {
- switch (tier) {
- case H265Tier::kTier0:
- return "0";
- case H265Tier::kTier1:
- return "1";
- }
-}
-
-std::string H265LevelToString(H265Level level) {
- switch (level) {
- case H265Level::kLevel1:
- return "30";
- case H265Level::kLevel2:
- return "60";
- case H265Level::kLevel2_1:
- return "63";
- case H265Level::kLevel3:
- return "90";
- case H265Level::kLevel3_1:
- return "93";
- case H265Level::kLevel4:
- return "120";
- case H265Level::kLevel4_1:
- return "123";
- case H265Level::kLevel5:
- return "150";
- case H265Level::kLevel5_1:
- return "153";
- case H265Level::kLevel5_2:
- return "156";
- case H265Level::kLevel6:
- return "180";
- case H265Level::kLevel6_1:
- return "183";
- case H265Level::kLevel6_2:
- return "186";
- }
-}
-
-absl::optional<H265ProfileTierLevel> ParseSdpForH265ProfileTierLevel(
- const SdpVideoFormat::Parameters& params) {
- static const H265ProfileTierLevel kDefaultProfileTierLevel(
- H265Profile::kProfileMain, H265Tier::kTier0, H265Level::kLevel3_1);
- bool profile_tier_level_specified = false;
-
- absl::optional<H265Profile> profile;
- const auto profile_it = params.find(kH265FmtpProfile);
- if (profile_it != params.end()) {
- profile_tier_level_specified = true;
- const std::string& profile_str = profile_it->second;
- profile = StringToH265Profile(profile_str);
- if (!profile) {
- return absl::nullopt;
- }
- } else {
- profile = H265Profile::kProfileMain;
- }
- absl::optional<H265Tier> tier;
- const auto tier_it = params.find(kH265FmtpTier);
- if (tier_it != params.end()) {
- profile_tier_level_specified = true;
- const std::string& tier_str = tier_it->second;
- tier = StringToH265Tier(tier_str);
- if (!tier) {
- return absl::nullopt;
- }
- } else {
- tier = H265Tier::kTier0;
- }
- absl::optional<H265Level> level;
- const auto level_it = params.find(kH265FmtpLevel);
- if (level_it != params.end()) {
- profile_tier_level_specified = true;
- const std::string& level_str = level_it->second;
- level = StringToH265Level(level_str);
- if (!level) {
- return absl::nullopt;
- }
- } else {
- level = H265Level::kLevel3_1;
- }
-
- // Spec Table A.9, level 1 to level 3.1 does not allow high tiers.
- if (level <= H265Level::kLevel3_1 && tier == H265Tier::kTier1) {
- return absl::nullopt;
- }
-
- return !profile_tier_level_specified
- ? kDefaultProfileTierLevel
- : H265ProfileTierLevel(profile.value(), tier.value(),
- level.value());
-}
-
-bool H265IsSameProfileTierLevel(const SdpVideoFormat::Parameters& params1,
- const SdpVideoFormat::Parameters& params2) {
- const absl::optional<H265ProfileTierLevel> ptl1 =
- ParseSdpForH265ProfileTierLevel(params1);
- const absl::optional<H265ProfileTierLevel> ptl2 =
- ParseSdpForH265ProfileTierLevel(params2);
- return ptl1 && ptl2 && ptl1->profile == ptl2->profile &&
- ptl1->tier == ptl2->tier && ptl1->level == ptl2->level;
-}
-
-} // namespace webrtc
+/*
+ * Copyright (c) 2023 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.
+ */
+
+#include "api/video_codecs/h265_profile_tier_level.h"
+
+#include <string>
+
+#include "rtc_base/string_to_number.h"
+
+namespace webrtc {
+
+namespace {
+
+const char kH265FmtpProfile[] = "profile-id";
+const char kH265FmtpTier[] = "tier-flag";
+const char kH265FmtpLevel[] = "level-id";
+
+} // anonymous namespace
+
+// Annex A of https://www.itu.int/rec/T-REC-H.265 (08/21), section A.3.
+absl::optional<H265Profile> StringToH265Profile(const std::string& profile) {
+ absl::optional<int> i = rtc::StringToNumber<int>(profile);
+ if (!i.has_value()) {
+ return absl::nullopt;
+ }
+
+ switch (i.value()) {
+ case 1:
+ return H265Profile::kProfileMain;
+ case 2:
+ return H265Profile::kProfileMain10;
+ case 3:
+ return H265Profile::kProfileMainStill;
+ case 4:
+ return H265Profile::kProfileRangeExtensions;
+ case 5:
+ return H265Profile::kProfileHighThroughput;
+ case 6:
+ return H265Profile::kProfileMultiviewMain;
+ case 7:
+ return H265Profile::kProfileScalableMain;
+ case 8:
+ return H265Profile::kProfile3dMain;
+ case 9:
+ return H265Profile::kProfileScreenContentCoding;
+ case 10:
+ return H265Profile::kProfileScalableRangeExtensions;
+ case 11:
+ return H265Profile::kProfileHighThroughputScreenContentCoding;
+ default:
+ return absl::nullopt;
+ }
+}
+
+// Annex A of https://www.itu.int/rec/T-REC-H.265 (08/21), section A.4,
+// tiers and levels.
+absl::optional<H265Tier> StringToH265Tier(const std::string& tier) {
+ absl::optional<int> i = rtc::StringToNumber<int>(tier);
+ if (!i.has_value()) {
+ return absl::nullopt;
+ }
+
+ switch (i.value()) {
+ case 0:
+ return H265Tier::kTier0;
+ case 1:
+ return H265Tier::kTier1;
+ default:
+ return absl::nullopt;
+ }
+}
+
+absl::optional<H265Level> StringToH265Level(const std::string& level) {
+ const absl::optional<int> i = rtc::StringToNumber<int>(level);
+ if (!i.has_value())
+ return absl::nullopt;
+
+ switch (i.value()) {
+ case 30:
+ return H265Level::kLevel1;
+ case 60:
+ return H265Level::kLevel2;
+ case 63:
+ return H265Level::kLevel2_1;
+ case 90:
+ return H265Level::kLevel3;
+ case 93:
+ return H265Level::kLevel3_1;
+ case 120:
+ return H265Level::kLevel4;
+ case 123:
+ return H265Level::kLevel4_1;
+ case 150:
+ return H265Level::kLevel5;
+ case 153:
+ return H265Level::kLevel5_1;
+ case 156:
+ return H265Level::kLevel5_2;
+ case 180:
+ return H265Level::kLevel6;
+ case 183:
+ return H265Level::kLevel6_1;
+ case 186:
+ return H265Level::kLevel6_2;
+ default:
+ return absl::nullopt;
+ }
+}
+
+std::string H265ProfileToString(H265Profile profile) {
+ switch (profile) {
+ case H265Profile::kProfileMain:
+ return "1";
+ case H265Profile::kProfileMain10:
+ return "2";
+ case H265Profile::kProfileMainStill:
+ return "3";
+ case H265Profile::kProfileRangeExtensions:
+ return "4";
+ case H265Profile::kProfileHighThroughput:
+ return "5";
+ case H265Profile::kProfileMultiviewMain:
+ return "6";
+ case H265Profile::kProfileScalableMain:
+ return "7";
+ case H265Profile::kProfile3dMain:
+ return "8";
+ case H265Profile::kProfileScreenContentCoding:
+ return "9";
+ case H265Profile::kProfileScalableRangeExtensions:
+ return "10";
+ case H265Profile::kProfileHighThroughputScreenContentCoding:
+ return "11";
+ }
+}
+
+std::string H265TierToString(H265Tier tier) {
+ switch (tier) {
+ case H265Tier::kTier0:
+ return "0";
+ case H265Tier::kTier1:
+ return "1";
+ }
+}
+
+std::string H265LevelToString(H265Level level) {
+ switch (level) {
+ case H265Level::kLevel1:
+ return "30";
+ case H265Level::kLevel2:
+ return "60";
+ case H265Level::kLevel2_1:
+ return "63";
+ case H265Level::kLevel3:
+ return "90";
+ case H265Level::kLevel3_1:
+ return "93";
+ case H265Level::kLevel4:
+ return "120";
+ case H265Level::kLevel4_1:
+ return "123";
+ case H265Level::kLevel5:
+ return "150";
+ case H265Level::kLevel5_1:
+ return "153";
+ case H265Level::kLevel5_2:
+ return "156";
+ case H265Level::kLevel6:
+ return "180";
+ case H265Level::kLevel6_1:
+ return "183";
+ case H265Level::kLevel6_2:
+ return "186";
+ }
+}
+
+absl::optional<H265ProfileTierLevel> ParseSdpForH265ProfileTierLevel(
+ const CodecParameterMap& params) {
+ static const H265ProfileTierLevel kDefaultProfileTierLevel(
+ H265Profile::kProfileMain, H265Tier::kTier0, H265Level::kLevel3_1);
+ bool profile_tier_level_specified = false;
+
+ absl::optional<H265Profile> profile;
+ const auto profile_it = params.find(kH265FmtpProfile);
+ if (profile_it != params.end()) {
+ profile_tier_level_specified = true;
+ const std::string& profile_str = profile_it->second;
+ profile = StringToH265Profile(profile_str);
+ if (!profile) {
+ return absl::nullopt;
+ }
+ } else {
+ profile = H265Profile::kProfileMain;
+ }
+ absl::optional<H265Tier> tier;
+ const auto tier_it = params.find(kH265FmtpTier);
+ if (tier_it != params.end()) {
+ profile_tier_level_specified = true;
+ const std::string& tier_str = tier_it->second;
+ tier = StringToH265Tier(tier_str);
+ if (!tier) {
+ return absl::nullopt;
+ }
+ } else {
+ tier = H265Tier::kTier0;
+ }
+ absl::optional<H265Level> level;
+ const auto level_it = params.find(kH265FmtpLevel);
+ if (level_it != params.end()) {
+ profile_tier_level_specified = true;
+ const std::string& level_str = level_it->second;
+ level = StringToH265Level(level_str);
+ if (!level) {
+ return absl::nullopt;
+ }
+ } else {
+ level = H265Level::kLevel3_1;
+ }
+
+ // Spec Table A.9, level 1 to level 3.1 does not allow high tiers.
+ if (level <= H265Level::kLevel3_1 && tier == H265Tier::kTier1) {
+ return absl::nullopt;
+ }
+
+ return !profile_tier_level_specified
+ ? kDefaultProfileTierLevel
+ : H265ProfileTierLevel(profile.value(), tier.value(),
+ level.value());
+}
+
+bool H265IsSameProfileTierLevel(const CodecParameterMap& params1,
+ const CodecParameterMap& params2) {
+ const absl::optional<H265ProfileTierLevel> ptl1 =
+ ParseSdpForH265ProfileTierLevel(params1);
+ const absl::optional<H265ProfileTierLevel> ptl2 =
+ ParseSdpForH265ProfileTierLevel(params2);
+ return ptl1 && ptl2 && ptl1->profile == ptl2->profile &&
+ ptl1->tier == ptl2->tier && ptl1->level == ptl2->level;
+}
+
+} // namespace webrtc
diff --git a/third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.h b/third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.h
index 3056d2b623..efbdf287ed 100644
--- a/third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.h
+++ b/third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.h
@@ -1,109 +1,109 @@
-/*
- * Copyright (c) 2023 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 API_VIDEO_CODECS_H265_PROFILE_TIER_LEVEL_H_
-#define API_VIDEO_CODECS_H265_PROFILE_TIER_LEVEL_H_
-
-#include <string>
-
-#include "absl/types/optional.h"
-#include "api/video_codecs/sdp_video_format.h"
-#include "rtc_base/system/rtc_export.h"
-
-namespace webrtc {
-
-// Profiles can be found at:
-// https://www.itu.int/rec/T-REC-H.265
-// The enum values match the number specified in the SDP.
-enum class H265Profile {
- kProfileMain = 1,
- kProfileMain10 = 2,
- kProfileMainStill = 3,
- kProfileRangeExtensions = 4,
- kProfileHighThroughput = 5,
- kProfileMultiviewMain = 6,
- kProfileScalableMain = 7,
- kProfile3dMain = 8,
- kProfileScreenContentCoding = 9,
- kProfileScalableRangeExtensions = 10,
- kProfileHighThroughputScreenContentCoding = 11,
-};
-
-// Tiers can be found at https://www.itu.int/rec/T-REC-H.265
-enum class H265Tier {
- kTier0,
- kTier1,
-};
-
-// All values are equal to 30 times the level number.
-enum class H265Level {
- kLevel1 = 30,
- kLevel2 = 60,
- kLevel2_1 = 63,
- kLevel3 = 90,
- kLevel3_1 = 93,
- kLevel4 = 120,
- kLevel4_1 = 123,
- kLevel5 = 150,
- kLevel5_1 = 153,
- kLevel5_2 = 156,
- kLevel6 = 180,
- kLevel6_1 = 183,
- kLevel6_2 = 186,
-};
-
-struct H265ProfileTierLevel {
- constexpr H265ProfileTierLevel(H265Profile profile,
- H265Tier tier,
- H265Level level)
- : profile(profile), tier(tier), level(level) {}
- H265Profile profile;
- H265Tier tier;
- H265Level level;
-};
-
-// Helper function to convert H265Profile to std::string.
-RTC_EXPORT std::string H265ProfileToString(H265Profile profile);
-
-// Helper function to convert H265Tier to std::string.
-RTC_EXPORT std::string H265TierToString(H265Tier tier);
-
-// Helper function to convert H265Level to std::string.
-RTC_EXPORT std::string H265LevelToString(H265Level level);
-
-// Helper function to get H265Profile from profile string.
-RTC_EXPORT absl::optional<H265Profile> StringToH265Profile(
- const std::string& profile);
-
-// Helper function to get H265Tier from tier string.
-RTC_EXPORT absl::optional<H265Tier> StringToH265Tier(const std::string& tier);
-
-// Helper function to get H265Level from level string.
-RTC_EXPORT absl::optional<H265Level> StringToH265Level(
- const std::string& level);
-
-// Parses an SDP key-value map of format parameters to retrive an H265
-// profile/tier/level. Returns an H265ProfileTierlevel by setting its
-// members. profile defaults to `kProfileMain` if no profile-id is specified.
-// tier defaults to "kTier0" if no tier-flag is specified.
-// level defaults to "kLevel3_1" if no level-id is specified.
-// Returns empty value if any of the profile/tier/level key is present but
-// contains an invalid value.
-RTC_EXPORT absl::optional<H265ProfileTierLevel> ParseSdpForH265ProfileTierLevel(
- const SdpVideoFormat::Parameters& params);
-
-// Returns true if the parameters have the same H265 profile or neither contains
-// an H265 profile, otherwise false.
-bool H265IsSameProfileTierLevel(const SdpVideoFormat::Parameters& params1,
- const SdpVideoFormat::Parameters& params2);
-
-} // namespace webrtc
-
-#endif // API_VIDEO_CODECS_H265_PROFILE_TIER_LEVEL_H_
+/*
+ * Copyright (c) 2023 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 API_VIDEO_CODECS_H265_PROFILE_TIER_LEVEL_H_
+#define API_VIDEO_CODECS_H265_PROFILE_TIER_LEVEL_H_
+
+#include <string>
+
+#include "absl/types/optional.h"
+#include "api/video_codecs/sdp_video_format.h"
+#include "rtc_base/system/rtc_export.h"
+
+namespace webrtc {
+
+// Profiles can be found at:
+// https://www.itu.int/rec/T-REC-H.265
+// The enum values match the number specified in the SDP.
+enum class H265Profile {
+ kProfileMain = 1,
+ kProfileMain10 = 2,
+ kProfileMainStill = 3,
+ kProfileRangeExtensions = 4,
+ kProfileHighThroughput = 5,
+ kProfileMultiviewMain = 6,
+ kProfileScalableMain = 7,
+ kProfile3dMain = 8,
+ kProfileScreenContentCoding = 9,
+ kProfileScalableRangeExtensions = 10,
+ kProfileHighThroughputScreenContentCoding = 11,
+};
+
+// Tiers can be found at https://www.itu.int/rec/T-REC-H.265
+enum class H265Tier {
+ kTier0,
+ kTier1,
+};
+
+// All values are equal to 30 times the level number.
+enum class H265Level {
+ kLevel1 = 30,
+ kLevel2 = 60,
+ kLevel2_1 = 63,
+ kLevel3 = 90,
+ kLevel3_1 = 93,
+ kLevel4 = 120,
+ kLevel4_1 = 123,
+ kLevel5 = 150,
+ kLevel5_1 = 153,
+ kLevel5_2 = 156,
+ kLevel6 = 180,
+ kLevel6_1 = 183,
+ kLevel6_2 = 186,
+};
+
+struct H265ProfileTierLevel {
+ constexpr H265ProfileTierLevel(H265Profile profile,
+ H265Tier tier,
+ H265Level level)
+ : profile(profile), tier(tier), level(level) {}
+ H265Profile profile;
+ H265Tier tier;
+ H265Level level;
+};
+
+// Helper function to convert H265Profile to std::string.
+RTC_EXPORT std::string H265ProfileToString(H265Profile profile);
+
+// Helper function to convert H265Tier to std::string.
+RTC_EXPORT std::string H265TierToString(H265Tier tier);
+
+// Helper function to convert H265Level to std::string.
+RTC_EXPORT std::string H265LevelToString(H265Level level);
+
+// Helper function to get H265Profile from profile string.
+RTC_EXPORT absl::optional<H265Profile> StringToH265Profile(
+ const std::string& profile);
+
+// Helper function to get H265Tier from tier string.
+RTC_EXPORT absl::optional<H265Tier> StringToH265Tier(const std::string& tier);
+
+// Helper function to get H265Level from level string.
+RTC_EXPORT absl::optional<H265Level> StringToH265Level(
+ const std::string& level);
+
+// Parses an SDP key-value map of format parameters to retrive an H265
+// profile/tier/level. Returns an H265ProfileTierlevel by setting its
+// members. profile defaults to `kProfileMain` if no profile-id is specified.
+// tier defaults to "kTier0" if no tier-flag is specified.
+// level defaults to "kLevel3_1" if no level-id is specified.
+// Returns empty value if any of the profile/tier/level key is present but
+// contains an invalid value.
+RTC_EXPORT absl::optional<H265ProfileTierLevel> ParseSdpForH265ProfileTierLevel(
+ const CodecParameterMap& params);
+
+// Returns true if the parameters have the same H265 profile or neither contains
+// an H265 profile, otherwise false.
+RTC_EXPORT bool H265IsSameProfileTierLevel(const CodecParameterMap& params1,
+ const CodecParameterMap& params2);
+
+} // namespace webrtc
+
+#endif // API_VIDEO_CODECS_H265_PROFILE_TIER_LEVEL_H_
diff --git a/third_party/libwebrtc/api/video_codecs/sdp_video_format.cc b/third_party/libwebrtc/api/video_codecs/sdp_video_format.cc
index 51ae18cd78..0f313e84a9 100644
--- a/third_party/libwebrtc/api/video_codecs/sdp_video_format.cc
+++ b/third_party/libwebrtc/api/video_codecs/sdp_video_format.cc
@@ -28,8 +28,7 @@ namespace webrtc {
namespace {
-std::string H264GetPacketizationModeOrDefault(
- const SdpVideoFormat::Parameters& params) {
+std::string H264GetPacketizationModeOrDefault(const CodecParameterMap& params) {
constexpr char kH264FmtpPacketizationMode[] = "packetization-mode";
const auto it = params.find(kH264FmtpPacketizationMode);
if (it != params.end()) {
@@ -40,8 +39,8 @@ std::string H264GetPacketizationModeOrDefault(
return "0";
}
-bool H264IsSamePacketizationMode(const SdpVideoFormat::Parameters& left,
- const SdpVideoFormat::Parameters& right) {
+bool H264IsSamePacketizationMode(const CodecParameterMap& left,
+ const CodecParameterMap& right) {
return H264GetPacketizationModeOrDefault(left) ==
H264GetPacketizationModeOrDefault(right);
}
@@ -77,12 +76,12 @@ bool IsSameCodecSpecific(const SdpVideoFormat& format1,
SdpVideoFormat::SdpVideoFormat(const std::string& name) : name(name) {}
SdpVideoFormat::SdpVideoFormat(const std::string& name,
- const Parameters& parameters)
+ const CodecParameterMap& parameters)
: name(name), parameters(parameters) {}
SdpVideoFormat::SdpVideoFormat(
const std::string& name,
- const Parameters& parameters,
+ const CodecParameterMap& parameters,
const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>&
scalability_modes)
: name(name),
diff --git a/third_party/libwebrtc/api/video_codecs/sdp_video_format.h b/third_party/libwebrtc/api/video_codecs/sdp_video_format.h
index faaa66c241..af9537b5a3 100644
--- a/third_party/libwebrtc/api/video_codecs/sdp_video_format.h
+++ b/third_party/libwebrtc/api/video_codecs/sdp_video_format.h
@@ -17,6 +17,7 @@
#include "absl/container/inlined_vector.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
+#include "api/rtp_parameters.h"
#include "api/video_codecs/scalability_mode.h"
#include "rtc_base/system/rtc_export.h"
@@ -25,13 +26,14 @@ namespace webrtc {
// SDP specification for a single video codec.
// NOTE: This class is still under development and may change without notice.
struct RTC_EXPORT SdpVideoFormat {
- using Parameters = std::map<std::string, std::string>;
+ using Parameters [[deprecated(("Use webrtc::CodecParameterMap"))]] =
+ std::map<std::string, std::string>;
explicit SdpVideoFormat(const std::string& name);
- SdpVideoFormat(const std::string& name, const Parameters& parameters);
+ SdpVideoFormat(const std::string& name, const CodecParameterMap& parameters);
SdpVideoFormat(
const std::string& name,
- const Parameters& parameters,
+ const CodecParameterMap& parameters,
const absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>&
scalability_modes);
SdpVideoFormat(const SdpVideoFormat&);
@@ -58,7 +60,7 @@ struct RTC_EXPORT SdpVideoFormat {
}
std::string name;
- Parameters parameters;
+ CodecParameterMap parameters;
absl::InlinedVector<ScalabilityMode, kScalabilityModeCount> scalability_modes;
};
diff --git a/third_party/libwebrtc/api/video_codecs/test/h264_profile_level_id_unittest.cc b/third_party/libwebrtc/api/video_codecs/test/h264_profile_level_id_unittest.cc
index 47098d2682..404d3e2cb3 100644
--- a/third_party/libwebrtc/api/video_codecs/test/h264_profile_level_id_unittest.cc
+++ b/third_party/libwebrtc/api/video_codecs/test/h264_profile_level_id_unittest.cc
@@ -145,7 +145,7 @@ TEST(H264ProfileLevelId, TestToStringInvalid) {
TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdEmpty) {
const absl::optional<H264ProfileLevelId> profile_level_id =
- ParseSdpForH264ProfileLevelId(SdpVideoFormat::Parameters());
+ ParseSdpForH264ProfileLevelId(CodecParameterMap());
EXPECT_TRUE(profile_level_id);
EXPECT_EQ(H264Profile::kProfileConstrainedBaseline,
profile_level_id->profile);
@@ -153,7 +153,7 @@ TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdEmpty) {
}
TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdConstrainedHigh) {
- SdpVideoFormat::Parameters params;
+ CodecParameterMap params;
params["profile-level-id"] = "640c2a";
const absl::optional<H264ProfileLevelId> profile_level_id =
ParseSdpForH264ProfileLevelId(params);
@@ -163,7 +163,7 @@ TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdConstrainedHigh) {
}
TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdInvalid) {
- SdpVideoFormat::Parameters params;
+ CodecParameterMap params;
params["profile-level-id"] = "foobar";
EXPECT_FALSE(ParseSdpForH264ProfileLevelId(params));
}
diff --git a/third_party/libwebrtc/api/video_codecs/test/h265_profile_tier_level_unittest.cc b/third_party/libwebrtc/api/video_codecs/test/h265_profile_tier_level_unittest.cc
index a9fdf966a5..85c0f09cd0 100644
--- a/third_party/libwebrtc/api/video_codecs/test/h265_profile_tier_level_unittest.cc
+++ b/third_party/libwebrtc/api/video_codecs/test/h265_profile_tier_level_unittest.cc
@@ -1,248 +1,248 @@
-/*
- * Copyright (c) 2023 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.
- */
-
-#include "api/video_codecs/h265_profile_tier_level.h"
-
-#include <string>
-
-#include "absl/types/optional.h"
-#include "test/gtest.h"
-
-namespace webrtc {
-
-TEST(H265ProfileTierLevel, TestLevelToString) {
- EXPECT_EQ(H265LevelToString(H265Level::kLevel1), "30");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel2), "60");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel2_1), "63");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel3), "90");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel3_1), "93");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel4), "120");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel4_1), "123");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel5), "150");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel5_1), "153");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel5_2), "156");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel6), "180");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel6_1), "183");
- EXPECT_EQ(H265LevelToString(H265Level::kLevel6_2), "186");
-}
-
-TEST(H265ProfileTierLevel, TestProfileToString) {
- EXPECT_EQ(H265ProfileToString(H265Profile::kProfileMain), "1");
- EXPECT_EQ(H265ProfileToString(H265Profile::kProfileMain10), "2");
- EXPECT_EQ(H265ProfileToString(H265Profile::kProfileMainStill), "3");
- EXPECT_EQ(H265ProfileToString(H265Profile::kProfileRangeExtensions), "4");
- EXPECT_EQ(H265ProfileToString(H265Profile::kProfileHighThroughput), "5");
- EXPECT_EQ(H265ProfileToString(H265Profile::kProfileMultiviewMain), "6");
- EXPECT_EQ(H265ProfileToString(H265Profile::kProfileScalableMain), "7");
- EXPECT_EQ(H265ProfileToString(H265Profile::kProfile3dMain), "8");
- EXPECT_EQ(H265ProfileToString(H265Profile::kProfileScreenContentCoding), "9");
- EXPECT_EQ(H265ProfileToString(H265Profile::kProfileScalableRangeExtensions),
- "10");
- EXPECT_EQ(H265ProfileToString(
- H265Profile::kProfileHighThroughputScreenContentCoding),
- "11");
-}
-
-TEST(H265ProfileTierLevel, TestTierToString) {
- EXPECT_EQ(H265TierToString(H265Tier::kTier0), "0");
- EXPECT_EQ(H265TierToString(H265Tier::kTier1), "1");
-}
-
-TEST(H265ProfileTierLevel, TestStringToProfile) {
- // Invalid profiles.
- EXPECT_FALSE(StringToH265Profile("0"));
- EXPECT_FALSE(StringToH265Profile("12"));
-
- // Malformed profiles
- EXPECT_FALSE(StringToH265Profile(""));
- EXPECT_FALSE(StringToH265Profile(" 1"));
- EXPECT_FALSE(StringToH265Profile("12x"));
- EXPECT_FALSE(StringToH265Profile("x12"));
- EXPECT_FALSE(StringToH265Profile("gggg"));
-
- // Valid profiles.
- EXPECT_EQ(StringToH265Profile("1"), H265Profile::kProfileMain);
- EXPECT_EQ(StringToH265Profile("2"), H265Profile::kProfileMain10);
- EXPECT_EQ(StringToH265Profile("4"), H265Profile::kProfileRangeExtensions);
-}
-
-TEST(H265ProfileTierLevel, TestStringToLevel) {
- // Invalid levels.
- EXPECT_FALSE(StringToH265Level("0"));
- EXPECT_FALSE(StringToH265Level("200"));
-
- // Malformed levels.
- EXPECT_FALSE(StringToH265Level(""));
- EXPECT_FALSE(StringToH265Level(" 30"));
- EXPECT_FALSE(StringToH265Level("30x"));
- EXPECT_FALSE(StringToH265Level("x30"));
- EXPECT_FALSE(StringToH265Level("ggggg"));
-
- // Valid levels.
- EXPECT_EQ(StringToH265Level("30"), H265Level::kLevel1);
- EXPECT_EQ(StringToH265Level("93"), H265Level::kLevel3_1);
- EXPECT_EQ(StringToH265Level("183"), H265Level::kLevel6_1);
-}
-
-TEST(H265ProfileTierLevel, TestStringToTier) {
- // Invalid tiers.
- EXPECT_FALSE(StringToH265Tier("4"));
- EXPECT_FALSE(StringToH265Tier("-1"));
-
- // Malformed tiers.
- EXPECT_FALSE(StringToH265Tier(""));
- EXPECT_FALSE(StringToH265Tier(" 1"));
- EXPECT_FALSE(StringToH265Tier("t1"));
-
- // Valid tiers.
- EXPECT_EQ(StringToH265Tier("0"), H265Tier::kTier0);
- EXPECT_EQ(StringToH265Tier("1"), H265Tier::kTier1);
-}
-
-TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelAllEmpty) {
- const absl::optional<H265ProfileTierLevel> profile_tier_level =
- ParseSdpForH265ProfileTierLevel(SdpVideoFormat::Parameters());
- EXPECT_TRUE(profile_tier_level);
- EXPECT_EQ(H265Profile::kProfileMain, profile_tier_level->profile);
- EXPECT_EQ(H265Level::kLevel3_1, profile_tier_level->level);
- EXPECT_EQ(H265Tier::kTier0, profile_tier_level->tier);
-}
-
-TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelPartialEmpty) {
- SdpVideoFormat::Parameters params;
- params["profile-id"] = "1";
- params["tier-flag"] = "0";
- absl::optional<H265ProfileTierLevel> profile_tier_level =
- ParseSdpForH265ProfileTierLevel(params);
- EXPECT_TRUE(profile_tier_level);
- EXPECT_EQ(H265Profile::kProfileMain, profile_tier_level->profile);
- EXPECT_EQ(H265Level::kLevel3_1, profile_tier_level->level);
- EXPECT_EQ(H265Tier::kTier0, profile_tier_level->tier);
-
- params.clear();
- params["profile-id"] = "2";
- profile_tier_level = ParseSdpForH265ProfileTierLevel(params);
- EXPECT_TRUE(profile_tier_level);
- EXPECT_EQ(H265Profile::kProfileMain10, profile_tier_level->profile);
- EXPECT_EQ(H265Level::kLevel3_1, profile_tier_level->level);
- EXPECT_EQ(H265Tier::kTier0, profile_tier_level->tier);
-
- params.clear();
- params["level-id"] = "180";
- profile_tier_level = ParseSdpForH265ProfileTierLevel(params);
- EXPECT_TRUE(profile_tier_level);
- EXPECT_EQ(H265Profile::kProfileMain, profile_tier_level->profile);
- EXPECT_EQ(H265Level::kLevel6, profile_tier_level->level);
- EXPECT_EQ(H265Tier::kTier0, profile_tier_level->tier);
-}
-
-TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelInvalid) {
- SdpVideoFormat::Parameters params;
-
- // Invalid profile-tier-level combination.
- params["profile-id"] = "1";
- params["tier-flag"] = "1";
- params["level-id"] = "93";
- absl::optional<H265ProfileTierLevel> profile_tier_level =
- ParseSdpForH265ProfileTierLevel(params);
- EXPECT_FALSE(profile_tier_level);
- params.clear();
- params["profile-id"] = "1";
- params["tier-flag"] = "4";
- params["level-id"] = "180";
- profile_tier_level = ParseSdpForH265ProfileTierLevel(params);
- EXPECT_FALSE(profile_tier_level);
-
- // Valid profile-tier-level combination.
- params.clear();
- params["profile-id"] = "1";
- params["tier-flag"] = "0";
- params["level-id"] = "153";
- profile_tier_level = ParseSdpForH265ProfileTierLevel(params);
- EXPECT_TRUE(profile_tier_level);
-}
-
-TEST(H265ProfileTierLevel, TestToStringRoundTrip) {
- SdpVideoFormat::Parameters params;
- params["profile-id"] = "1";
- params["tier-flag"] = "0";
- params["level-id"] = "93";
- absl::optional<H265ProfileTierLevel> profile_tier_level =
- ParseSdpForH265ProfileTierLevel(params);
- EXPECT_TRUE(profile_tier_level);
- EXPECT_EQ("1", H265ProfileToString(profile_tier_level->profile));
- EXPECT_EQ("0", H265TierToString(profile_tier_level->tier));
- EXPECT_EQ("93", H265LevelToString(profile_tier_level->level));
-
- params.clear();
- params["profile-id"] = "2";
- params["tier-flag"] = "1";
- params["level-id"] = "180";
- profile_tier_level = ParseSdpForH265ProfileTierLevel(params);
- EXPECT_TRUE(profile_tier_level);
- EXPECT_EQ("2", H265ProfileToString(profile_tier_level->profile));
- EXPECT_EQ("1", H265TierToString(profile_tier_level->tier));
- EXPECT_EQ("180", H265LevelToString(profile_tier_level->level));
-}
-
-TEST(H265ProfileTierLevel, TestProfileTierLevelCompare) {
- SdpVideoFormat::Parameters params1;
- SdpVideoFormat::Parameters params2;
-
- // None of profile-id/tier-flag/level-id is specified,
- EXPECT_TRUE(H265IsSameProfileTierLevel(params1, params2));
-
- // Same non-empty PTL
- params1["profile-id"] = "1";
- params1["tier-flag"] = "0";
- params1["level-id"] = "120";
- params2["profile-id"] = "1";
- params2["tier-flag"] = "0";
- params2["level-id"] = "120";
- EXPECT_TRUE(H265IsSameProfileTierLevel(params1, params2));
-
- // Different profiles.
- params1.clear();
- params2.clear();
- params1["profile-id"] = "1";
- params2["profile-id"] = "2";
- EXPECT_FALSE(H265IsSameProfileTierLevel(params1, params2));
-
- // Different levels.
- params1.clear();
- params2.clear();
- params1["profile-id"] = "1";
- params2["profile-id"] = "1";
- params1["level-id"] = "93";
- params2["level-id"] = "183";
- EXPECT_FALSE(H265IsSameProfileTierLevel(params1, params2));
-
- // Different tiers.
- params1.clear();
- params2.clear();
- params1["profile-id"] = "1";
- params2["profile-id"] = "1";
- params1["level-id"] = "93";
- params2["level-id"] = "93";
- params1["tier-flag"] = "0";
- params2["tier-flag"] = "1";
- EXPECT_FALSE(H265IsSameProfileTierLevel(params1, params2));
-
- // One of the SdpVideoFormat::Parameters is invalid.
- params1.clear();
- params2.clear();
- params1["profile-id"] = "1";
- params2["profile-id"] = "1";
- params1["tier-flag"] = "0";
- params2["tier-flag"] = "4";
- EXPECT_FALSE(H265IsSameProfileTierLevel(params1, params2));
-}
-
-} // namespace webrtc
+/*
+ * Copyright (c) 2023 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.
+ */
+
+#include "api/video_codecs/h265_profile_tier_level.h"
+
+#include <string>
+
+#include "absl/types/optional.h"
+#include "test/gtest.h"
+
+namespace webrtc {
+
+TEST(H265ProfileTierLevel, TestLevelToString) {
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel1), "30");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel2), "60");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel2_1), "63");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel3), "90");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel3_1), "93");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel4), "120");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel4_1), "123");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel5), "150");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel5_1), "153");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel5_2), "156");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel6), "180");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel6_1), "183");
+ EXPECT_EQ(H265LevelToString(H265Level::kLevel6_2), "186");
+}
+
+TEST(H265ProfileTierLevel, TestProfileToString) {
+ EXPECT_EQ(H265ProfileToString(H265Profile::kProfileMain), "1");
+ EXPECT_EQ(H265ProfileToString(H265Profile::kProfileMain10), "2");
+ EXPECT_EQ(H265ProfileToString(H265Profile::kProfileMainStill), "3");
+ EXPECT_EQ(H265ProfileToString(H265Profile::kProfileRangeExtensions), "4");
+ EXPECT_EQ(H265ProfileToString(H265Profile::kProfileHighThroughput), "5");
+ EXPECT_EQ(H265ProfileToString(H265Profile::kProfileMultiviewMain), "6");
+ EXPECT_EQ(H265ProfileToString(H265Profile::kProfileScalableMain), "7");
+ EXPECT_EQ(H265ProfileToString(H265Profile::kProfile3dMain), "8");
+ EXPECT_EQ(H265ProfileToString(H265Profile::kProfileScreenContentCoding), "9");
+ EXPECT_EQ(H265ProfileToString(H265Profile::kProfileScalableRangeExtensions),
+ "10");
+ EXPECT_EQ(H265ProfileToString(
+ H265Profile::kProfileHighThroughputScreenContentCoding),
+ "11");
+}
+
+TEST(H265ProfileTierLevel, TestTierToString) {
+ EXPECT_EQ(H265TierToString(H265Tier::kTier0), "0");
+ EXPECT_EQ(H265TierToString(H265Tier::kTier1), "1");
+}
+
+TEST(H265ProfileTierLevel, TestStringToProfile) {
+ // Invalid profiles.
+ EXPECT_FALSE(StringToH265Profile("0"));
+ EXPECT_FALSE(StringToH265Profile("12"));
+
+ // Malformed profiles
+ EXPECT_FALSE(StringToH265Profile(""));
+ EXPECT_FALSE(StringToH265Profile(" 1"));
+ EXPECT_FALSE(StringToH265Profile("12x"));
+ EXPECT_FALSE(StringToH265Profile("x12"));
+ EXPECT_FALSE(StringToH265Profile("gggg"));
+
+ // Valid profiles.
+ EXPECT_EQ(StringToH265Profile("1"), H265Profile::kProfileMain);
+ EXPECT_EQ(StringToH265Profile("2"), H265Profile::kProfileMain10);
+ EXPECT_EQ(StringToH265Profile("4"), H265Profile::kProfileRangeExtensions);
+}
+
+TEST(H265ProfileTierLevel, TestStringToLevel) {
+ // Invalid levels.
+ EXPECT_FALSE(StringToH265Level("0"));
+ EXPECT_FALSE(StringToH265Level("200"));
+
+ // Malformed levels.
+ EXPECT_FALSE(StringToH265Level(""));
+ EXPECT_FALSE(StringToH265Level(" 30"));
+ EXPECT_FALSE(StringToH265Level("30x"));
+ EXPECT_FALSE(StringToH265Level("x30"));
+ EXPECT_FALSE(StringToH265Level("ggggg"));
+
+ // Valid levels.
+ EXPECT_EQ(StringToH265Level("30"), H265Level::kLevel1);
+ EXPECT_EQ(StringToH265Level("93"), H265Level::kLevel3_1);
+ EXPECT_EQ(StringToH265Level("183"), H265Level::kLevel6_1);
+}
+
+TEST(H265ProfileTierLevel, TestStringToTier) {
+ // Invalid tiers.
+ EXPECT_FALSE(StringToH265Tier("4"));
+ EXPECT_FALSE(StringToH265Tier("-1"));
+
+ // Malformed tiers.
+ EXPECT_FALSE(StringToH265Tier(""));
+ EXPECT_FALSE(StringToH265Tier(" 1"));
+ EXPECT_FALSE(StringToH265Tier("t1"));
+
+ // Valid tiers.
+ EXPECT_EQ(StringToH265Tier("0"), H265Tier::kTier0);
+ EXPECT_EQ(StringToH265Tier("1"), H265Tier::kTier1);
+}
+
+TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelAllEmpty) {
+ const absl::optional<H265ProfileTierLevel> profile_tier_level =
+ ParseSdpForH265ProfileTierLevel(CodecParameterMap());
+ EXPECT_TRUE(profile_tier_level);
+ EXPECT_EQ(H265Profile::kProfileMain, profile_tier_level->profile);
+ EXPECT_EQ(H265Level::kLevel3_1, profile_tier_level->level);
+ EXPECT_EQ(H265Tier::kTier0, profile_tier_level->tier);
+}
+
+TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelPartialEmpty) {
+ CodecParameterMap params;
+ params["profile-id"] = "1";
+ params["tier-flag"] = "0";
+ absl::optional<H265ProfileTierLevel> profile_tier_level =
+ ParseSdpForH265ProfileTierLevel(params);
+ EXPECT_TRUE(profile_tier_level);
+ EXPECT_EQ(H265Profile::kProfileMain, profile_tier_level->profile);
+ EXPECT_EQ(H265Level::kLevel3_1, profile_tier_level->level);
+ EXPECT_EQ(H265Tier::kTier0, profile_tier_level->tier);
+
+ params.clear();
+ params["profile-id"] = "2";
+ profile_tier_level = ParseSdpForH265ProfileTierLevel(params);
+ EXPECT_TRUE(profile_tier_level);
+ EXPECT_EQ(H265Profile::kProfileMain10, profile_tier_level->profile);
+ EXPECT_EQ(H265Level::kLevel3_1, profile_tier_level->level);
+ EXPECT_EQ(H265Tier::kTier0, profile_tier_level->tier);
+
+ params.clear();
+ params["level-id"] = "180";
+ profile_tier_level = ParseSdpForH265ProfileTierLevel(params);
+ EXPECT_TRUE(profile_tier_level);
+ EXPECT_EQ(H265Profile::kProfileMain, profile_tier_level->profile);
+ EXPECT_EQ(H265Level::kLevel6, profile_tier_level->level);
+ EXPECT_EQ(H265Tier::kTier0, profile_tier_level->tier);
+}
+
+TEST(H265ProfileTierLevel, TestParseSdpProfileTierLevelInvalid) {
+ CodecParameterMap params;
+
+ // Invalid profile-tier-level combination.
+ params["profile-id"] = "1";
+ params["tier-flag"] = "1";
+ params["level-id"] = "93";
+ absl::optional<H265ProfileTierLevel> profile_tier_level =
+ ParseSdpForH265ProfileTierLevel(params);
+ EXPECT_FALSE(profile_tier_level);
+ params.clear();
+ params["profile-id"] = "1";
+ params["tier-flag"] = "4";
+ params["level-id"] = "180";
+ profile_tier_level = ParseSdpForH265ProfileTierLevel(params);
+ EXPECT_FALSE(profile_tier_level);
+
+ // Valid profile-tier-level combination.
+ params.clear();
+ params["profile-id"] = "1";
+ params["tier-flag"] = "0";
+ params["level-id"] = "153";
+ profile_tier_level = ParseSdpForH265ProfileTierLevel(params);
+ EXPECT_TRUE(profile_tier_level);
+}
+
+TEST(H265ProfileTierLevel, TestToStringRoundTrip) {
+ CodecParameterMap params;
+ params["profile-id"] = "1";
+ params["tier-flag"] = "0";
+ params["level-id"] = "93";
+ absl::optional<H265ProfileTierLevel> profile_tier_level =
+ ParseSdpForH265ProfileTierLevel(params);
+ EXPECT_TRUE(profile_tier_level);
+ EXPECT_EQ("1", H265ProfileToString(profile_tier_level->profile));
+ EXPECT_EQ("0", H265TierToString(profile_tier_level->tier));
+ EXPECT_EQ("93", H265LevelToString(profile_tier_level->level));
+
+ params.clear();
+ params["profile-id"] = "2";
+ params["tier-flag"] = "1";
+ params["level-id"] = "180";
+ profile_tier_level = ParseSdpForH265ProfileTierLevel(params);
+ EXPECT_TRUE(profile_tier_level);
+ EXPECT_EQ("2", H265ProfileToString(profile_tier_level->profile));
+ EXPECT_EQ("1", H265TierToString(profile_tier_level->tier));
+ EXPECT_EQ("180", H265LevelToString(profile_tier_level->level));
+}
+
+TEST(H265ProfileTierLevel, TestProfileTierLevelCompare) {
+ CodecParameterMap params1;
+ CodecParameterMap params2;
+
+ // None of profile-id/tier-flag/level-id is specified,
+ EXPECT_TRUE(H265IsSameProfileTierLevel(params1, params2));
+
+ // Same non-empty PTL
+ params1["profile-id"] = "1";
+ params1["tier-flag"] = "0";
+ params1["level-id"] = "120";
+ params2["profile-id"] = "1";
+ params2["tier-flag"] = "0";
+ params2["level-id"] = "120";
+ EXPECT_TRUE(H265IsSameProfileTierLevel(params1, params2));
+
+ // Different profiles.
+ params1.clear();
+ params2.clear();
+ params1["profile-id"] = "1";
+ params2["profile-id"] = "2";
+ EXPECT_FALSE(H265IsSameProfileTierLevel(params1, params2));
+
+ // Different levels.
+ params1.clear();
+ params2.clear();
+ params1["profile-id"] = "1";
+ params2["profile-id"] = "1";
+ params1["level-id"] = "93";
+ params2["level-id"] = "183";
+ EXPECT_FALSE(H265IsSameProfileTierLevel(params1, params2));
+
+ // Different tiers.
+ params1.clear();
+ params2.clear();
+ params1["profile-id"] = "1";
+ params2["profile-id"] = "1";
+ params1["level-id"] = "93";
+ params2["level-id"] = "93";
+ params1["tier-flag"] = "0";
+ params2["tier-flag"] = "1";
+ EXPECT_FALSE(H265IsSameProfileTierLevel(params1, params2));
+
+ // One of the CodecParameterMap is invalid.
+ params1.clear();
+ params2.clear();
+ params1["profile-id"] = "1";
+ params2["profile-id"] = "1";
+ params1["tier-flag"] = "0";
+ params2["tier-flag"] = "4";
+ EXPECT_FALSE(H265IsSameProfileTierLevel(params1, params2));
+}
+
+} // namespace webrtc
diff --git a/third_party/libwebrtc/api/video_codecs/test/sdp_video_format_unittest.cc b/third_party/libwebrtc/api/video_codecs/test/sdp_video_format_unittest.cc
index 797a9a2e72..26e50d6945 100644
--- a/third_party/libwebrtc/api/video_codecs/test/sdp_video_format_unittest.cc
+++ b/third_party/libwebrtc/api/video_codecs/test/sdp_video_format_unittest.cc
@@ -18,7 +18,7 @@
namespace webrtc {
typedef SdpVideoFormat Sdp;
-typedef SdpVideoFormat::Parameters Params;
+typedef CodecParameterMap Params;
TEST(SdpVideoFormatTest, SameCodecNameNoParameters) {
EXPECT_TRUE(Sdp("H264").IsSameCodec(Sdp("h264")));
diff --git a/third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libaom_av1_adapter.h b/third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libaom_av1_adapter.h
index 417df1e192..0f801ad3c7 100644
--- a/third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libaom_av1_adapter.h
+++ b/third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libaom_av1_adapter.h
@@ -24,8 +24,7 @@ struct LibaomAv1EncoderTemplateAdapter {
static std::vector<SdpVideoFormat> SupportedFormats() {
absl::InlinedVector<ScalabilityMode, kScalabilityModeCount>
scalability_modes = LibaomAv1EncoderSupportedScalabilityModes();
- return {
- SdpVideoFormat("AV1", SdpVideoFormat::Parameters(), scalability_modes)};
+ return {SdpVideoFormat("AV1", CodecParameterMap(), scalability_modes)};
}
static std::unique_ptr<VideoEncoder> CreateEncoder(
diff --git a/third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter.h b/third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter.h
index 0f0a9bacd5..c60aa04795 100644
--- a/third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter.h
+++ b/third_party/libwebrtc/api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter.h
@@ -28,8 +28,7 @@ struct LibvpxVp8EncoderTemplateAdapter {
scalability_modes.push_back(scalability_mode);
}
- return {
- SdpVideoFormat("VP8", SdpVideoFormat::Parameters(), scalability_modes)};
+ return {SdpVideoFormat("VP8", CodecParameterMap(), scalability_modes)};
}
static std::unique_ptr<VideoEncoder> CreateEncoder(
diff --git a/third_party/libwebrtc/api/video_codecs/vp9_profile.cc b/third_party/libwebrtc/api/video_codecs/vp9_profile.cc
index 7e627cc080..ccd3937296 100644
--- a/third_party/libwebrtc/api/video_codecs/vp9_profile.cc
+++ b/third_party/libwebrtc/api/video_codecs/vp9_profile.cc
@@ -54,7 +54,7 @@ absl::optional<VP9Profile> StringToVP9Profile(const std::string& str) {
}
absl::optional<VP9Profile> ParseSdpForVP9Profile(
- const SdpVideoFormat::Parameters& params) {
+ const CodecParameterMap& params) {
const auto profile_it = params.find(kVP9FmtpProfileId);
if (profile_it == params.end())
return VP9Profile::kProfile0;
@@ -62,8 +62,8 @@ absl::optional<VP9Profile> ParseSdpForVP9Profile(
return StringToVP9Profile(profile_str);
}
-bool VP9IsSameProfile(const SdpVideoFormat::Parameters& params1,
- const SdpVideoFormat::Parameters& params2) {
+bool VP9IsSameProfile(const CodecParameterMap& params1,
+ const CodecParameterMap& params2) {
const absl::optional<VP9Profile> profile = ParseSdpForVP9Profile(params1);
const absl::optional<VP9Profile> other_profile =
ParseSdpForVP9Profile(params2);
diff --git a/third_party/libwebrtc/api/video_codecs/vp9_profile.h b/third_party/libwebrtc/api/video_codecs/vp9_profile.h
index b570bc3bb6..27f84cbecc 100644
--- a/third_party/libwebrtc/api/video_codecs/vp9_profile.h
+++ b/third_party/libwebrtc/api/video_codecs/vp9_profile.h
@@ -42,12 +42,12 @@ absl::optional<VP9Profile> StringToVP9Profile(const std::string& str);
// profile key is missing. Nothing will be returned if the key is present but
// the string is invalid.
RTC_EXPORT absl::optional<VP9Profile> ParseSdpForVP9Profile(
- const SdpVideoFormat::Parameters& params);
+ const CodecParameterMap& params);
// Returns true if the parameters have the same VP9 profile, or neither contains
// VP9 profile.
-bool VP9IsSameProfile(const SdpVideoFormat::Parameters& params1,
- const SdpVideoFormat::Parameters& params2);
+bool VP9IsSameProfile(const CodecParameterMap& params1,
+ const CodecParameterMap& params2);
} // namespace webrtc