diff --git a/third_party/libwebrtc/README.moz-ff-commit b/third_party/libwebrtc/README.moz-ff-commit index bc7497475177..e4851689f927 100644 --- a/third_party/libwebrtc/README.moz-ff-commit +++ b/third_party/libwebrtc/README.moz-ff-commit @@ -8508,3 +8508,6 @@ f1384afda04 # MOZ_LIBWEBRTC_SRC=/home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src MOZ_LIBWEBRTC_COMMIT=mjfdev bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh # base of lastest vendoring dc8fc722048 +# MOZ_LIBWEBRTC_SRC=/home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src MOZ_LIBWEBRTC_COMMIT=mjfdev bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh +# base of lastest vendoring +d0321c5e5ab diff --git a/third_party/libwebrtc/README.mozilla b/third_party/libwebrtc/README.mozilla index 670fd2d559ea..62ea2773abd6 100644 --- a/third_party/libwebrtc/README.mozilla +++ b/third_party/libwebrtc/README.mozilla @@ -5678,3 +5678,5 @@ libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwe libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-06-08T00:38:14.086550. # python3 vendor-libwebrtc.py --from-local /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src --commit mjfdev libwebrtc libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-06-08T00:39:02.686688. +# python3 vendor-libwebrtc.py --from-local /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src --commit mjfdev libwebrtc +libwebrtc updated from /home/mfroman/git-checkouts/trial-webrtc-builds/moz-libwebrtc-checkout/src commit mjfdev on 2022-06-08T00:53:14.131533. diff --git a/third_party/libwebrtc/api/rtp_parameters.cc b/third_party/libwebrtc/api/rtp_parameters.cc index f1ef51d99463..2a119cf35147 100644 --- a/third_party/libwebrtc/api/rtp_parameters.cc +++ b/third_party/libwebrtc/api/rtp_parameters.cc @@ -114,7 +114,6 @@ std::string RtpExtension::ToString() const { constexpr char RtpExtension::kEncryptHeaderExtensionsUri[]; constexpr char RtpExtension::kAudioLevelUri[]; -constexpr char RtpExtension::kCsrcAudioLevelUri[]; constexpr char RtpExtension::kTimestampOffsetUri[]; constexpr char RtpExtension::kAbsSendTimeUri[]; constexpr char RtpExtension::kAbsoluteCaptureTimeUri[]; @@ -132,6 +131,7 @@ constexpr char RtpExtension::kMidUri[]; constexpr char RtpExtension::kRidUri[]; constexpr char RtpExtension::kRepairedRidUri[]; constexpr char RtpExtension::kVideoFrameTrackingIdUri[]; +constexpr char RtpExtension::kCsrcAudioLevelsUri[]; constexpr int RtpExtension::kMinId; constexpr int RtpExtension::kMaxId; @@ -141,14 +141,14 @@ constexpr int RtpExtension::kOneByteHeaderExtensionMaxValueSize; bool RtpExtension::IsSupportedForAudio(absl::string_view uri) { return uri == webrtc::RtpExtension::kAudioLevelUri || - uri == webrtc::RtpExtension::kCsrcAudioLevelUri; uri == webrtc::RtpExtension::kAbsSendTimeUri || uri == webrtc::RtpExtension::kAbsoluteCaptureTimeUri || uri == webrtc::RtpExtension::kTransportSequenceNumberUri || uri == webrtc::RtpExtension::kTransportSequenceNumberV2Uri || uri == webrtc::RtpExtension::kMidUri || uri == webrtc::RtpExtension::kRidUri || - uri == webrtc::RtpExtension::kRepairedRidUri; + uri == webrtc::RtpExtension::kRepairedRidUri || + uri == webrtc::RtpExtension::kCsrcAudioLevelsUri; } bool RtpExtension::IsSupportedForVideo(absl::string_view uri) { diff --git a/third_party/libwebrtc/audio/audio_send_stream.cc b/third_party/libwebrtc/audio/audio_send_stream.cc index a41d06edbb9f..b3d555293b7a 100644 --- a/third_party/libwebrtc/audio/audio_send_stream.cc +++ b/third_party/libwebrtc/audio/audio_send_stream.cc @@ -272,7 +272,7 @@ void AudioSendStream::ConfigureStream( rtp_rtcp_module_->DeregisterSendRtpHeaderExtension( kRtpExtensionAbsoluteSendTime); if (new_ids.abs_send_time) { - rtp_rtcp_module_->RegisterRtpHeaderExtension(AbsoluteSendTime::kUri, + rtp_rtcp_module_->RegisterRtpHeaderExtension(AbsoluteSendTime::Uri(), new_ids.abs_send_time); } } @@ -290,7 +290,7 @@ void AudioSendStream::ConfigureStream( if (!allocate_audio_without_feedback_ && new_ids.transport_sequence_number != 0) { rtp_rtcp_module_->RegisterRtpHeaderExtension( - TransportSequenceNumber::kUri, new_ids.transport_sequence_number); + TransportSequenceNumber::Uri(), new_ids.transport_sequence_number); // Probing in application limited region is only used in combination with // send side congestion control, wich depends on feedback packets which // requires transport sequence numbers to be enabled. @@ -308,7 +308,7 @@ void AudioSendStream::ConfigureStream( if ((first_time || new_ids.mid != old_ids.mid || new_config.rtp.mid != old_config.rtp.mid) && new_ids.mid != 0 && !new_config.rtp.mid.empty()) { - rtp_rtcp_module_->RegisterRtpHeaderExtension(RtpMid::kUri, new_ids.mid); + rtp_rtcp_module_->RegisterRtpHeaderExtension(RtpMid::Uri(), new_ids.mid); rtp_rtcp_module_->SetMid(new_config.rtp.mid); } @@ -318,12 +318,12 @@ void AudioSendStream::ConfigureStream( new_config.rtp.rid != old_config.rtp.rid)) { if (new_ids.rid != 0 || new_ids.repaired_rid != 0) { if (new_config.rtp.rid.empty()) { - rtp_rtcp_module_->DeregisterSendRtpHeaderExtension(RtpStreamId::kUri); + rtp_rtcp_module_->DeregisterSendRtpHeaderExtension(RtpStreamId::Uri()); } else if (new_ids.repaired_rid != 0) { - rtp_rtcp_module_->RegisterRtpHeaderExtension(RtpStreamId::kUri, + rtp_rtcp_module_->RegisterRtpHeaderExtension(RtpStreamId::Uri(), new_ids.repaired_rid); } else { - rtp_rtcp_module_->RegisterRtpHeaderExtension(RtpStreamId::kUri, + rtp_rtcp_module_->RegisterRtpHeaderExtension(RtpStreamId::Uri(), new_ids.rid); } } @@ -335,7 +335,7 @@ void AudioSendStream::ConfigureStream( kRtpExtensionAbsoluteCaptureTime); if (new_ids.abs_capture_time) { rtp_rtcp_module_->RegisterRtpHeaderExtension( - AbsoluteCaptureTimeExtension::kUri, new_ids.abs_capture_time); + AbsoluteCaptureTimeExtension::Uri(), new_ids.abs_capture_time); } } diff --git a/third_party/libwebrtc/audio/audio_send_stream_unittest.cc b/third_party/libwebrtc/audio/audio_send_stream_unittest.cc index 58db5254fe7d..6ac5f4e8edcd 100644 --- a/third_party/libwebrtc/audio/audio_send_stream_unittest.cc +++ b/third_party/libwebrtc/audio/audio_send_stream_unittest.cc @@ -233,7 +233,7 @@ struct ConfigHelper { .WillRepeatedly(Return(&bandwidth_observer_)); if (audio_bwe_enabled) { EXPECT_CALL(rtp_rtcp_, - RegisterRtpHeaderExtension(TransportSequenceNumber::kUri, + RegisterRtpHeaderExtension(TransportSequenceNumber::Uri(), kTransportSequenceNumberId)) .Times(1); EXPECT_CALL(*channel_send_, @@ -802,7 +802,7 @@ TEST(AudioSendStreamTest, ReconfigureTransportCcResetsFirst) { ConfigHelper::AddBweToConfig(&new_config); EXPECT_CALL(*helper.rtp_rtcp(), - RegisterRtpHeaderExtension(TransportSequenceNumber::kUri, + RegisterRtpHeaderExtension(TransportSequenceNumber::Uri(), kTransportSequenceNumberId)) .Times(1); { diff --git a/third_party/libwebrtc/audio/channel_send.cc b/third_party/libwebrtc/audio/channel_send.cc index 34b5bb9c6557..3ab6c9a7301f 100644 --- a/third_party/libwebrtc/audio/channel_send.cc +++ b/third_party/libwebrtc/audio/channel_send.cc @@ -738,9 +738,9 @@ void ChannelSend::SetSendAudioLevelIndicationStatus(bool enable, int id) { RTC_DCHECK_RUN_ON(&worker_thread_checker_); _includeAudioLevelIndication = enable; if (enable) { - rtp_rtcp_->RegisterRtpHeaderExtension(webrtc::AudioLevel::kUri, id); + rtp_rtcp_->RegisterRtpHeaderExtension(webrtc::AudioLevel::Uri(), id); } else { - rtp_rtcp_->DeregisterSendRtpHeaderExtension(webrtc::AudioLevel::kUri); + rtp_rtcp_->DeregisterSendRtpHeaderExtension(webrtc::AudioLevel::Uri()); } } diff --git a/third_party/libwebrtc/call/flexfec_receive_stream_unittest.cc b/third_party/libwebrtc/call/flexfec_receive_stream_unittest.cc index 312fe0c90738..9885971a8bde 100644 --- a/third_party/libwebrtc/call/flexfec_receive_stream_unittest.cc +++ b/third_party/libwebrtc/call/flexfec_receive_stream_unittest.cc @@ -66,7 +66,7 @@ TEST(FlexfecReceiveStreamConfigTest, IsCompleteAndEnabled) { config.rtp.local_ssrc = 18374743; config.rtcp_mode = RtcpMode::kCompound; config.rtp.transport_cc = true; - config.rtp.extensions.emplace_back(TransportSequenceNumber::kUri, 7); + config.rtp.extensions.emplace_back(TransportSequenceNumber::Uri(), 7); EXPECT_FALSE(config.IsCompleteAndEnabled()); config.payload_type = 123; diff --git a/third_party/libwebrtc/call/rtp_video_sender_unittest.cc b/third_party/libwebrtc/call/rtp_video_sender_unittest.cc index e58ee3c5c04a..29ae31107e34 100644 --- a/third_party/libwebrtc/call/rtp_video_sender_unittest.cc +++ b/third_party/libwebrtc/call/rtp_video_sender_unittest.cc @@ -103,7 +103,7 @@ VideoSendStream::Config CreateVideoSendStreamConfig( config.rtp.nack.rtp_history_ms = 1000; config.rtp.extensions.emplace_back(RtpExtension::kTransportSequenceNumberUri, kTransportsSequenceExtensionId); - config.rtp.extensions.emplace_back(RtpDependencyDescriptorExtension::kUri, + config.rtp.extensions.emplace_back(RtpDependencyDescriptorExtension::Uri(), kDependencyDescriptorExtensionId); config.rtp.extmap_allow_mixed = true; return config; diff --git a/third_party/libwebrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h b/third_party/libwebrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h index a746d8a07642..3c2fa3d66f82 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h +++ b/third_party/libwebrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h @@ -15,6 +15,7 @@ #include +#include "absl/strings/string_view.h" #include "api/array_view.h" #include "api/rtp_parameters.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" @@ -35,7 +36,7 @@ class RtpHeaderExtensionMap { template bool Register(int id) { - return Register(id, Extension::kId, Extension::kUri); + return Register(id, Extension::kId, Extension::Uri()); } bool RegisterByType(int id, RTPExtensionType type); bool RegisterByUri(int id, absl::string_view uri); @@ -64,7 +65,7 @@ class RtpHeaderExtensionMap { } private: - bool Register(int id, RTPExtensionType type, const char* uri); + bool Register(int id, RTPExtensionType type, absl::string_view uri); uint8_t ids_[kRtpExtensionNumberOfExtensions]; bool extmap_allow_mixed_; diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/flexfec_sender.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/flexfec_sender.cc index f1fe71d19846..071829f1c0eb 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/flexfec_sender.cc +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/flexfec_sender.cc @@ -47,13 +47,13 @@ RtpHeaderExtensionMap RegisterSupportedExtensions( const std::vector& rtp_header_extensions) { RtpHeaderExtensionMap map; for (const auto& extension : rtp_header_extensions) { - if (extension.uri == TransportSequenceNumber::kUri) { + if (extension.uri == TransportSequenceNumber::Uri()) { map.Register(extension.id); - } else if (extension.uri == AbsoluteSendTime::kUri) { + } else if (extension.uri == AbsoluteSendTime::Uri()) { map.Register(extension.id); - } else if (extension.uri == TransmissionOffset::kUri) { + } else if (extension.uri == TransmissionOffset::Uri()) { map.Register(extension.id); - } else if (extension.uri == RtpMid::kUri) { + } else if (extension.uri == RtpMid::Uri()) { map.Register(extension.id); } else { RTC_LOG(LS_INFO) diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_dependency_descriptor_extension.h b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_dependency_descriptor_extension.h index de16eeab2a36..5a89fae9cb58 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_dependency_descriptor_extension.h +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_dependency_descriptor_extension.h @@ -13,7 +13,10 @@ #include #include +#include "absl/base/attributes.h" +#include "absl/strings/string_view.h" #include "api/array_view.h" +#include "api/rtp_parameters.h" #include "api/transport/rtp/dependency_descriptor.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" @@ -25,10 +28,12 @@ namespace webrtc { class RtpDependencyDescriptorExtension { public: static constexpr RTPExtensionType kId = kRtpExtensionGenericFrameDescriptor02; - // TODO(bugs.webrtc.org/10342): Use uri from the spec when there is one. - static constexpr char kUri[] = + static constexpr ABSL_DEPRECATED("Use Uri()") char kUri[] = "https://aomediacodec.github.io/av1-rtp-spec/" "#dependency-descriptor-rtp-header-extension"; + static constexpr absl::string_view Uri() { + return RtpExtension::kDependencyDescriptorUri; + } static bool Parse(rtc::ArrayView data, const FrameDependencyStructure* structure, diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_generic_frame_descriptor_extension.h b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_generic_frame_descriptor_extension.h index ac7afb489b66..f260a48df7ee 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_generic_frame_descriptor_extension.h +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_generic_frame_descriptor_extension.h @@ -13,7 +13,10 @@ #include #include +#include "absl/base/attributes.h" +#include "absl/strings/string_view.h" #include "api/array_view.h" +#include "api/rtp_parameters.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h" @@ -23,9 +26,12 @@ class RtpGenericFrameDescriptorExtension00 { public: using value_type = RtpGenericFrameDescriptor; static constexpr RTPExtensionType kId = kRtpExtensionGenericFrameDescriptor00; - static constexpr char kUri[] = + static constexpr ABSL_DEPRECATED("Use Uri()") char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/" "generic-frame-descriptor-00"; + static constexpr absl::string_view Uri() { + return RtpExtension::kGenericFrameDescriptorUri00; + } static constexpr int kMaxSizeBytes = 16; static bool Parse(rtc::ArrayView data, diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc index ddd579344ff5..541e570ed882 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc @@ -10,6 +10,7 @@ #include "modules/rtp_rtcp/include/rtp_header_extension_map.h" +#include "absl/strings/string_view.h" #include "modules/rtp_rtcp/source/rtp_dependency_descriptor_extension.h" #include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor_extension.h" #include "modules/rtp_rtcp/source/rtp_header_extensions.h" @@ -23,12 +24,12 @@ namespace { struct ExtensionInfo { RTPExtensionType type; - const char* uri; + absl::string_view uri; }; template constexpr ExtensionInfo CreateExtensionInfo() { - return {Extension::kId, Extension::kUri}; + return {Extension::kId, Extension::Uri()}; } constexpr ExtensionInfo kExtensions[] = { @@ -135,7 +136,7 @@ void RtpHeaderExtensionMap::Deregister(absl::string_view uri) { bool RtpHeaderExtensionMap::Register(int id, RTPExtensionType type, - const char* uri) { + absl::string_view uri) { RTC_DCHECK_GT(type, kRtpExtensionNone); RTC_DCHECK_LT(type, kRtpExtensionNumberOfExtensions); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map_unittest.cc index f5bb1bb324a8..91bb2527732a 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map_unittest.cc +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extension_map_unittest.cc @@ -31,7 +31,7 @@ TEST(RtpHeaderExtensionTest, RegisterByType) { TEST(RtpHeaderExtensionTest, RegisterByUri) { RtpHeaderExtensionMap map; - EXPECT_TRUE(map.RegisterByUri(3, TransmissionOffset::kUri)); + EXPECT_TRUE(map.RegisterByUri(3, TransmissionOffset::Uri())); EXPECT_TRUE(map.IsRegistered(TransmissionOffset::kId)); EXPECT_EQ(3, map.GetId(TransmissionOffset::kId)); @@ -49,8 +49,8 @@ TEST(RtpHeaderExtensionTest, RegisterWithTrait) { } TEST(RtpHeaderExtensionTest, RegisterDuringContruction) { - const std::vector config = {{TransmissionOffset::kUri, 1}, - {AbsoluteSendTime::kUri, 3}}; + const std::vector config = {{TransmissionOffset::Uri(), 1}, + {AbsoluteSendTime::Uri(), 3}}; const RtpHeaderExtensionMap map(config); EXPECT_EQ(1, map.GetId(TransmissionOffset::kId)); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extensions.h b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extensions.h index 478eb947fc02..55d282ff8b38 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extensions.h +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_header_extensions.h @@ -16,8 +16,11 @@ #include #include +#include "absl/base/attributes.h" +#include "absl/strings/string_view.h" #include "api/array_view.h" #include "api/rtp_headers.h" +#include "api/rtp_parameters.h" #include "api/video/color_space.h" #include "api/video/video_content_type.h" #include "api/video/video_rotation.h" @@ -31,8 +34,11 @@ class AbsoluteSendTime { using value_type = uint32_t; static constexpr RTPExtensionType kId = kRtpExtensionAbsoluteSendTime; static constexpr uint8_t kValueSizeBytes = 3; - static constexpr const char kUri[] = + static constexpr ABSL_DEPRECATED("Use Uri()") const char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"; + static constexpr absl::string_view Uri() { + return RtpExtension::kAbsSendTimeUri; + } static bool Parse(rtc::ArrayView data, uint32_t* time_24bits); static size_t ValueSize(uint32_t time_24bits) { return kValueSizeBytes; } @@ -50,8 +56,11 @@ class AbsoluteCaptureTimeExtension { static constexpr uint8_t kValueSizeBytes = 16; static constexpr uint8_t kValueSizeBytesWithoutEstimatedCaptureClockOffset = 8; - static constexpr const char kUri[] = + static constexpr ABSL_DEPRECATED("Use Uri()") const char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time"; + static constexpr absl::string_view Uri() { + return RtpExtension::kAbsoluteCaptureTimeUri; + } static bool Parse(rtc::ArrayView data, AbsoluteCaptureTime* extension); @@ -64,8 +73,11 @@ class AudioLevel { public: static constexpr RTPExtensionType kId = kRtpExtensionAudioLevel; static constexpr uint8_t kValueSizeBytes = 1; - static constexpr const char kUri[] = - "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; + static constexpr ABSL_DEPRECATED("Use Uri()") const + char kUri[] = "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; + static constexpr absl::string_view Uri() { + return RtpExtension::kAudioLevelUri; + } static bool Parse(rtc::ArrayView data, bool* voice_activity, @@ -83,8 +95,11 @@ class CsrcAudioLevel { public: static constexpr RTPExtensionType kId = kRtpExtensionCsrcAudioLevel; static constexpr uint8_t kMaxValueSizeBytes = 15; - static constexpr const char kUri[] = - "urn:ietf:params:rtp-hdrext:csrc-audio-level"; + static constexpr ABSL_DEPRECATED("Use Uri()") const + char kUri[] = "urn:ietf:params:rtp-hdrext:csrc-audio-level"; + static constexpr absl::string_view Uri() { + return RtpExtension::kCsrcAudioLevelsUri; + } static bool Parse(rtc::ArrayView data, std::vector* csrc_audio_levels); @@ -99,7 +114,11 @@ class TransmissionOffset { using value_type = int32_t; static constexpr RTPExtensionType kId = kRtpExtensionTransmissionTimeOffset; static constexpr uint8_t kValueSizeBytes = 3; - static constexpr const char kUri[] = "urn:ietf:params:rtp-hdrext:toffset"; + static constexpr ABSL_DEPRECATED("Use Uri()") const + char kUri[] = "urn:ietf:params:rtp-hdrext:toffset"; + static constexpr absl::string_view Uri() { + return RtpExtension::kTimestampOffsetUri; + } static bool Parse(rtc::ArrayView data, int32_t* rtp_time); static size_t ValueSize(int32_t rtp_time) { return kValueSizeBytes; } @@ -111,9 +130,13 @@ class TransportSequenceNumber { using value_type = uint16_t; static constexpr RTPExtensionType kId = kRtpExtensionTransportSequenceNumber; static constexpr uint8_t kValueSizeBytes = 2; - static constexpr const char kUri[] = + static constexpr ABSL_DEPRECATED("Use Uri()") const char kUri[] = "http://www.ietf.org/id/" "draft-holmer-rmcat-transport-wide-cc-extensions-01"; + static constexpr absl::string_view Uri() { + return RtpExtension::kTransportSequenceNumberUri; + } + static bool Parse(rtc::ArrayView data, uint16_t* transport_sequence_number); static size_t ValueSize(uint16_t /*transport_sequence_number*/) { @@ -129,8 +152,12 @@ class TransportSequenceNumberV2 { kRtpExtensionTransportSequenceNumber02; static constexpr uint8_t kValueSizeBytes = 4; static constexpr uint8_t kValueSizeBytesWithoutFeedbackRequest = 2; - static constexpr const char kUri[] = + static constexpr ABSL_DEPRECATED("Use Uri()") const char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/transport-wide-cc-02"; + static constexpr absl::string_view Uri() { + return RtpExtension::kTransportSequenceNumberV2Uri; + } + static bool Parse(rtc::ArrayView data, uint16_t* transport_sequence_number, absl::optional* feedback_request); @@ -153,7 +180,11 @@ class VideoOrientation { using value_type = VideoRotation; static constexpr RTPExtensionType kId = kRtpExtensionVideoRotation; static constexpr uint8_t kValueSizeBytes = 1; - static constexpr const char kUri[] = "urn:3gpp:video-orientation"; + static constexpr ABSL_DEPRECATED("Use Uri()") const + char kUri[] = "urn:3gpp:video-orientation"; + static constexpr absl::string_view Uri() { + return RtpExtension::kVideoRotationUri; + } static bool Parse(rtc::ArrayView data, VideoRotation* value); static size_t ValueSize(VideoRotation) { return kValueSizeBytes; } @@ -168,8 +199,11 @@ class PlayoutDelayLimits { using value_type = VideoPlayoutDelay; static constexpr RTPExtensionType kId = kRtpExtensionPlayoutDelay; static constexpr uint8_t kValueSizeBytes = 3; - static constexpr const char kUri[] = + static constexpr ABSL_DEPRECATED("Use Uri()") const char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"; + static constexpr absl::string_view Uri() { + return RtpExtension::kPlayoutDelayUri; + } // Playout delay in milliseconds. A playout delay limit (min or max) // has 12 bits allocated. This allows a range of 0-4095 values which @@ -190,8 +224,11 @@ class VideoContentTypeExtension { using value_type = VideoContentType; static constexpr RTPExtensionType kId = kRtpExtensionVideoContentType; static constexpr uint8_t kValueSizeBytes = 1; - static constexpr const char kUri[] = + static constexpr ABSL_DEPRECATED("Use Uri()") const char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/video-content-type"; + static constexpr absl::string_view Uri() { + return RtpExtension::kVideoContentTypeUri; + } static bool Parse(rtc::ArrayView data, VideoContentType* content_type); @@ -205,8 +242,11 @@ class VideoTimingExtension { using value_type = VideoSendTiming; static constexpr RTPExtensionType kId = kRtpExtensionVideoTiming; static constexpr uint8_t kValueSizeBytes = 13; - static constexpr const char kUri[] = - "http://www.webrtc.org/experiments/rtp-hdrext/video-timing"; + static constexpr ABSL_DEPRECATED("Use Uri()") const + char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/video-timing"; + static constexpr absl::string_view Uri() { + return RtpExtension::kVideoTimingUri; + } // Offsets of the fields in the RTP header extension, counting from the first // byte after the one-byte header. @@ -239,8 +279,11 @@ class ColorSpaceExtension { static constexpr RTPExtensionType kId = kRtpExtensionColorSpace; static constexpr uint8_t kValueSizeBytes = 28; static constexpr uint8_t kValueSizeBytesWithoutHdrMetadata = 4; - static constexpr const char kUri[] = - "http://www.webrtc.org/experiments/rtp-hdrext/color-space"; + static constexpr ABSL_DEPRECATED("Use Uri()") const + char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/color-space"; + static constexpr absl::string_view Uri() { + return RtpExtension::kColorSpaceUri; + } static bool Parse(rtc::ArrayView data, ColorSpace* color_space); @@ -303,21 +346,27 @@ class BaseRtpStringExtension { class RtpStreamId : public BaseRtpStringExtension { public: static constexpr RTPExtensionType kId = kRtpExtensionRtpStreamId; - static constexpr const char kUri[] = - "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"; + static constexpr ABSL_DEPRECATED("Use Uri()") const + char kUri[] = "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"; + static constexpr absl::string_view Uri() { return RtpExtension::kRidUri; } }; class RepairedRtpStreamId : public BaseRtpStringExtension { public: static constexpr RTPExtensionType kId = kRtpExtensionRepairedRtpStreamId; - static constexpr const char kUri[] = - "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"; + static constexpr ABSL_DEPRECATED("Use Uri()") const + char kUri[] = "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"; + static constexpr absl::string_view Uri() { + return RtpExtension::kRepairedRidUri; + } }; class RtpMid : public BaseRtpStringExtension { public: static constexpr RTPExtensionType kId = kRtpExtensionMid; - static constexpr const char kUri[] = "urn:ietf:params:rtp-hdrext:sdes:mid"; + static constexpr ABSL_DEPRECATED("Use Uri()") const + char kUri[] = "urn:ietf:params:rtp-hdrext:sdes:mid"; + static constexpr absl::string_view Uri() { return RtpExtension::kMidUri; } }; class InbandComfortNoiseExtension { @@ -328,6 +377,7 @@ class InbandComfortNoiseExtension { static constexpr uint8_t kValueSizeBytes = 1; static constexpr const char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/inband-cn"; + static constexpr absl::string_view Uri() { return kUri; } static bool Parse(rtc::ArrayView data, absl::optional* level); @@ -343,8 +393,12 @@ class VideoFrameTrackingIdExtension { using value_type = uint16_t; static constexpr RTPExtensionType kId = kRtpExtensionVideoFrameTrackingId; static constexpr uint8_t kValueSizeBytes = 2; - static constexpr const char kUri[] = + static constexpr ABSL_DEPRECATED("Use Uri()") const char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/video-frame-tracking-id"; + static constexpr absl::string_view Uri() { + return RtpExtension::kVideoFrameTrackingIdUri; + } + static bool Parse(rtc::ArrayView data, uint16_t* video_frame_tracking_id); static size_t ValueSize(uint16_t /*video_frame_tracking_id*/) { diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc index 6d6008534582..21bf37c0c351 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc @@ -886,7 +886,7 @@ struct UncopyableValue { }; struct UncopyableExtension { static constexpr RTPExtensionType kId = kRtpExtensionGenericFrameDescriptor02; - static constexpr char kUri[] = "uri"; + static constexpr absl::string_view Uri() { return "uri"; } static size_t ValueSize(const UncopyableValue& value) { return 1; } static bool Write(rtc::ArrayView data, @@ -899,7 +899,6 @@ struct UncopyableExtension { } }; constexpr RTPExtensionType UncopyableExtension::kId; -constexpr char UncopyableExtension::kUri[]; TEST(RtpPacketTest, SetUncopyableExtension) { RtpPacket::ExtensionManager extensions; diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc index 599264e7c5df..8592e42173ed 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc @@ -957,7 +957,7 @@ TEST_P(RtpRtcpImpl2Test, PaddingTimestampMatchesMedia) { } TEST_P(RtpRtcpImpl2Test, AssignsTransportSequenceNumber) { - sender_.RegisterHeaderExtension(TransportSequenceNumber::kUri, + sender_.RegisterHeaderExtension(TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId); EXPECT_TRUE(SendFrame(&sender_, sender_video_.get(), kBaseLayerTid)); @@ -974,7 +974,7 @@ TEST_P(RtpRtcpImpl2Test, AssignsTransportSequenceNumber) { } TEST_P(RtpRtcpImpl2Test, AssignsAbsoluteSendTime) { - sender_.RegisterHeaderExtension(AbsoluteSendTime::kUri, + sender_.RegisterHeaderExtension(AbsoluteSendTime::Uri(), kAbsoluteSendTimeExtensionId); EXPECT_TRUE(SendFrame(&sender_, sender_video_.get(), kBaseLayerTid)); @@ -982,7 +982,7 @@ TEST_P(RtpRtcpImpl2Test, AssignsAbsoluteSendTime) { } TEST_P(RtpRtcpImpl2Test, AssignsTransmissionTimeOffset) { - sender_.RegisterHeaderExtension(TransmissionOffset::kUri, + sender_.RegisterHeaderExtension(TransmissionOffset::Uri(), kTransmissionOffsetExtensionId); constexpr TimeDelta kOffset = TimeDelta::Millis(100); @@ -998,7 +998,7 @@ TEST_P(RtpRtcpImpl2Test, AssignsTransmissionTimeOffset) { } TEST_P(RtpRtcpImpl2Test, PropagatesSentPacketInfo) { - sender_.RegisterHeaderExtension(TransportSequenceNumber::kUri, + sender_.RegisterHeaderExtension(TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId); int64_t now_ms = time_controller_.GetClock()->TimeInMilliseconds(); EXPECT_TRUE(SendFrame(&sender_, sender_video_.get(), kBaseLayerTid)); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc index 0221800ea8ac..baa392281bc8 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_audio_unittest.cc @@ -106,7 +106,7 @@ TEST_F(RtpSenderAudioTest, SendAudio) { TEST_F(RtpSenderAudioTest, SendAudioWithAudioLevelExtension) { EXPECT_EQ(0, rtp_sender_audio_->SetAudioLevel(kAudioLevel)); - rtp_module_->RegisterRtpHeaderExtension(AudioLevel::kUri, + rtp_module_->RegisterRtpHeaderExtension(AudioLevel::Uri(), kAudioLevelExtensionId); const char payload_name[] = "PAYLOAD_NAME"; @@ -149,7 +149,7 @@ TEST_F(RtpSenderAudioTest, SendAudioWithoutAbsoluteCaptureTime) { } TEST_F(RtpSenderAudioTest, SendAudioWithAbsoluteCaptureTime) { - rtp_module_->RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::kUri, + rtp_module_->RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::Uri(), kAbsoluteCaptureTimeExtensionId); constexpr uint32_t kAbsoluteCaptureTimestampMs = 521; const char payload_name[] = "audio"; @@ -185,7 +185,7 @@ TEST_F(RtpSenderAudioTest, rtp_sender_audio_ = std::make_unique(&fake_clock_, rtp_module_->RtpSender()); - rtp_module_->RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::kUri, + rtp_module_->RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::Uri(), kAbsoluteCaptureTimeExtensionId); constexpr uint32_t kAbsoluteCaptureTimestampMs = 521; const char payload_name[] = "audio"; diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_egress_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_egress_unittest.cc index d95a639e2155..0f2a218ae4c4 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_egress_unittest.cc +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_egress_unittest.cc @@ -212,7 +212,7 @@ TEST_P(RtpSenderEgressTest, TransportFeedbackObserverGetsCorrectByteCount) { const uint16_t kTransportSequenceNumber = 17; header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); const size_t expected_bytes = GetParam().with_overhead ? kPayloadSize + kRtpOverheadBytesPerPacket @@ -266,7 +266,7 @@ TEST_P(RtpSenderEgressTest, std::unique_ptr sender = CreateRtpSenderEgress(); header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); std::unique_ptr packet = BuildRtpPacket(); sender->SendPacket(packet.get(), PacedPacketInfo()); EXPECT_TRUE(transport_.last_packet()->options.included_in_feedback); @@ -278,7 +278,7 @@ TEST_P( std::unique_ptr sender = CreateRtpSenderEgress(); header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); std::unique_ptr packet = BuildRtpPacket(); sender->SendPacket(packet.get(), PacedPacketInfo()); EXPECT_TRUE(transport_.last_packet()->options.included_in_allocation); @@ -342,7 +342,7 @@ TEST_P(RtpSenderEgressTest, OnSendSideDelayUpdated) { TEST_P(RtpSenderEgressTest, WritesPacerExitToTimingExtension) { std::unique_ptr sender = CreateRtpSenderEgress(); header_extensions_.RegisterByUri(kVideoTimingExtensionId, - VideoTimingExtension::kUri); + VideoTimingExtension::Uri()); std::unique_ptr packet = BuildRtpPacket(); packet->SetExtension(VideoSendTiming{}); @@ -364,7 +364,7 @@ TEST_P(RtpSenderEgressTest, WritesNetwork2ToTimingExtension) { rtp_config.populate_network2_timestamp = true; auto sender = std::make_unique(rtp_config, &packet_history_); header_extensions_.RegisterByUri(kVideoTimingExtensionId, - VideoTimingExtension::kUri); + VideoTimingExtension::Uri()); const uint16_t kPacerExitMs = 1234u; std::unique_ptr packet = BuildRtpPacket(); @@ -388,7 +388,7 @@ TEST_P(RtpSenderEgressTest, WritesNetwork2ToTimingExtension) { TEST_P(RtpSenderEgressTest, OnSendPacketUpdated) { std::unique_ptr sender = CreateRtpSenderEgress(); header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); const uint16_t kTransportSequenceNumber = 1; EXPECT_CALL(send_packet_observer_, @@ -402,7 +402,7 @@ TEST_P(RtpSenderEgressTest, OnSendPacketUpdated) { TEST_P(RtpSenderEgressTest, OnSendPacketNotUpdatedForRetransmits) { std::unique_ptr sender = CreateRtpSenderEgress(); header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); const uint16_t kTransportSequenceNumber = 1; EXPECT_CALL(send_packet_observer_, OnSendPacket).Times(0); @@ -748,11 +748,11 @@ TEST_P(RtpSenderEgressTest, UpdatesDataCounters) { TEST_P(RtpSenderEgressTest, SendPacketUpdatesExtensions) { header_extensions_.RegisterByUri(kVideoTimingExtensionId, - VideoTimingExtension::kUri); + VideoTimingExtension::Uri()); header_extensions_.RegisterByUri(kAbsoluteSendTimeExtensionId, - AbsoluteSendTime::kUri); + AbsoluteSendTime::Uri()); header_extensions_.RegisterByUri(kTransmissionOffsetExtensionId, - TransmissionOffset::kUri); + TransmissionOffset::Uri()); std::unique_ptr sender = CreateRtpSenderEgress(); std::unique_ptr packet = BuildRtpPacket(); @@ -779,7 +779,7 @@ TEST_P(RtpSenderEgressTest, SendPacketSetsPacketOptions) { const uint16_t kPacketId = 42; std::unique_ptr sender = CreateRtpSenderEgress(); header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); std::unique_ptr packet = BuildRtpPacket(); packet->SetExtension(kPacketId); @@ -816,7 +816,7 @@ TEST_P(RtpSenderEgressTest, SendPacketUpdatesStats) { auto sender = std::make_unique(config, &packet_history_); header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); const int64_t capture_time_ms = clock_->TimeInMilliseconds(); @@ -871,7 +871,7 @@ TEST_P(RtpSenderEgressTest, SendPacketUpdatesStats) { TEST_P(RtpSenderEgressTest, TransportFeedbackObserverWithRetransmission) { const uint16_t kTransportSequenceNumber = 17; header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); std::unique_ptr retransmission = BuildRtpPacket(); retransmission->set_packet_type(RtpPacketMediaType::kRetransmission); retransmission->SetExtension( @@ -893,7 +893,7 @@ TEST_P(RtpSenderEgressTest, TransportFeedbackObserverWithRetransmission) { TEST_P(RtpSenderEgressTest, TransportFeedbackObserverWithRtxRetransmission) { const uint16_t kTransportSequenceNumber = 17; header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); std::unique_ptr rtx_retransmission = BuildRtpPacket(); rtx_retransmission->SetSsrc(kRtxSsrc); @@ -917,7 +917,7 @@ TEST_P(RtpSenderEgressTest, TransportFeedbackObserverWithRtxRetransmission) { TEST_P(RtpSenderEgressTest, TransportFeedbackObserverPadding) { const uint16_t kTransportSequenceNumber = 17; header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); std::unique_ptr padding = BuildRtpPacket(); padding->SetPadding(224); padding->set_packet_type(RtpPacketMediaType::kPadding); @@ -935,7 +935,7 @@ TEST_P(RtpSenderEgressTest, TransportFeedbackObserverPadding) { TEST_P(RtpSenderEgressTest, TransportFeedbackObserverRtxPadding) { const uint16_t kTransportSequenceNumber = 17; header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); std::unique_ptr rtx_padding = BuildRtpPacket(); rtx_padding->SetPadding(224); @@ -955,7 +955,7 @@ TEST_P(RtpSenderEgressTest, TransportFeedbackObserverRtxPadding) { TEST_P(RtpSenderEgressTest, TransportFeedbackObserverFec) { const uint16_t kTransportSequenceNumber = 17; header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId, - TransportSequenceNumber::kUri); + TransportSequenceNumber::Uri()); std::unique_ptr fec_packet = BuildRtpPacket(); fec_packet->SetSsrc(kFlexFecSsrc); diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc index 2724cec8ffb9..21c32b377c32 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc @@ -267,15 +267,16 @@ class RtpSenderTest : public ::testing::Test { // Enable sending of the MID header extension for both the primary SSRC and // the RTX SSRC. void EnableMidSending(const std::string& mid) { - rtp_sender_->RegisterRtpHeaderExtension(RtpMid::kUri, kMidExtensionId); + rtp_sender_->RegisterRtpHeaderExtension(RtpMid::Uri(), kMidExtensionId); rtp_sender_->SetMid(mid); } // Enable sending of the RSID header extension for the primary SSRC and the // RRSID header extension for the RTX SSRC. void EnableRidSending(const std::string& rid) { - rtp_sender_->RegisterRtpHeaderExtension(RtpStreamId::kUri, kRidExtensionId); - rtp_sender_->RegisterRtpHeaderExtension(RepairedRtpStreamId::kUri, + rtp_sender_->RegisterRtpHeaderExtension(RtpStreamId::Uri(), + kRidExtensionId); + rtp_sender_->RegisterRtpHeaderExtension(RepairedRtpStreamId::Uri(), kRepairedRidExtensionId); rtp_sender_->SetRid(rid); } @@ -297,15 +298,15 @@ TEST_F(RtpSenderTest, AllocatePacketSetCsrc) { TEST_F(RtpSenderTest, AllocatePacketReserveExtensions) { // Configure rtp_sender with extensions. ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - TransmissionOffset::kUri, kTransmissionTimeOffsetExtensionId)); + TransmissionOffset::Uri(), kTransmissionTimeOffsetExtensionId)); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - AbsoluteSendTime::kUri, kAbsoluteSendTimeExtensionId)); - ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension(AudioLevel::kUri, + AbsoluteSendTime::Uri(), kAbsoluteSendTimeExtensionId)); + ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension(AudioLevel::Uri(), kAudioLevelExtensionId)); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - TransportSequenceNumber::kUri, kTransportSequenceNumberExtensionId)); + TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId)); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - VideoOrientation::kUri, kVideoRotationExtensionId)); + VideoOrientation::Uri(), kVideoRotationExtensionId)); auto packet = rtp_sender_->AllocatePacket(); @@ -444,7 +445,7 @@ TEST_F(RtpSenderTest, NoPaddingAsFirstPacketWithoutBweExtensions) { TEST_F(RtpSenderTest, AllowPaddingAsFirstPacketOnRtxWithTransportCc) { ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - TransportSequenceNumber::kUri, kTransportSequenceNumberExtensionId)); + TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId)); // Padding can't be sent as first packet on media SSRC since we don't know // what payload type to assign. @@ -465,7 +466,7 @@ TEST_F(RtpSenderTest, AllowPaddingAsFirstPacketOnRtxWithTransportCc) { TEST_F(RtpSenderTest, AllowPaddingAsFirstPacketOnRtxWithAbsSendTime) { ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - AbsoluteSendTime::kUri, kAbsoluteSendTimeExtensionId)); + AbsoluteSendTime::Uri(), kAbsoluteSendTimeExtensionId)); // Padding can't be sent as first packet on media SSRC since we don't know // what payload type to assign. @@ -518,7 +519,7 @@ TEST_F(RtpSenderTest, UpdatesTimestampsOnPlainRtxPadding) { TEST_F(RtpSenderTest, KeepsTimestampsOnPayloadPadding) { ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - TransportSequenceNumber::kUri, kTransportSequenceNumberExtensionId)); + TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId)); EnableRtx(); // Timestamps as set based on capture time in RtpSenderTest. const int64_t start_time = clock_->TimeInMilliseconds(); @@ -892,7 +893,7 @@ TEST_F(RtpSenderTest, OnOverheadChanged) { // Base RTP overhead is 12B. EXPECT_EQ(rtp_sender_->ExpectedPerPacketOverhead(), 12u); - rtp_sender_->RegisterRtpHeaderExtension(TransmissionOffset::kUri, + rtp_sender_->RegisterRtpHeaderExtension(TransmissionOffset::Uri(), kTransmissionTimeOffsetExtensionId); // TransmissionTimeOffset extension has a size of 3B, but with the addition @@ -908,8 +909,8 @@ TEST_F(RtpSenderTest, CountMidOnlyUntilAcked) { // Base RTP overhead is 12B. EXPECT_EQ(rtp_sender_->ExpectedPerPacketOverhead(), 12u); - rtp_sender_->RegisterRtpHeaderExtension(RtpMid::kUri, kMidExtensionId); - rtp_sender_->RegisterRtpHeaderExtension(RtpStreamId::kUri, kRidExtensionId); + rtp_sender_->RegisterRtpHeaderExtension(RtpMid::Uri(), kMidExtensionId); + rtp_sender_->RegisterRtpHeaderExtension(RtpStreamId::Uri(), kRidExtensionId); // Counted only if set. EXPECT_EQ(rtp_sender_->ExpectedPerPacketOverhead(), 12u); @@ -931,15 +932,16 @@ TEST_F(RtpSenderTest, DontCountVolatileExtensionsIntoOverhead) { // Base RTP overhead is 12B. EXPECT_EQ(rtp_sender_->ExpectedPerPacketOverhead(), 12u); - rtp_sender_->RegisterRtpHeaderExtension(InbandComfortNoiseExtension::kUri, 1); - rtp_sender_->RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::kUri, + rtp_sender_->RegisterRtpHeaderExtension(InbandComfortNoiseExtension::Uri(), + 1); + rtp_sender_->RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::Uri(), 2); - rtp_sender_->RegisterRtpHeaderExtension(VideoOrientation::kUri, 3); - rtp_sender_->RegisterRtpHeaderExtension(PlayoutDelayLimits::kUri, 4); - rtp_sender_->RegisterRtpHeaderExtension(VideoContentTypeExtension::kUri, 5); - rtp_sender_->RegisterRtpHeaderExtension(VideoTimingExtension::kUri, 6); - rtp_sender_->RegisterRtpHeaderExtension(RepairedRtpStreamId::kUri, 7); - rtp_sender_->RegisterRtpHeaderExtension(ColorSpaceExtension::kUri, 8); + rtp_sender_->RegisterRtpHeaderExtension(VideoOrientation::Uri(), 3); + rtp_sender_->RegisterRtpHeaderExtension(PlayoutDelayLimits::Uri(), 4); + rtp_sender_->RegisterRtpHeaderExtension(VideoContentTypeExtension::Uri(), 5); + rtp_sender_->RegisterRtpHeaderExtension(VideoTimingExtension::Uri(), 6); + rtp_sender_->RegisterRtpHeaderExtension(RepairedRtpStreamId::Uri(), 7); + rtp_sender_->RegisterRtpHeaderExtension(ColorSpaceExtension::Uri(), 8); // Still only 12B counted since can't count on above being sent. EXPECT_EQ(rtp_sender_->ExpectedPerPacketOverhead(), 12u); @@ -1006,11 +1008,11 @@ TEST_F(RtpSenderTest, GeneratedPaddingHasBweExtensions) { EnableRtx(); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - TransmissionOffset::kUri, kTransmissionTimeOffsetExtensionId)); + TransmissionOffset::Uri(), kTransmissionTimeOffsetExtensionId)); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - AbsoluteSendTime::kUri, kAbsoluteSendTimeExtensionId)); + AbsoluteSendTime::Uri(), kAbsoluteSendTimeExtensionId)); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - TransportSequenceNumber::kUri, kTransportSequenceNumberExtensionId)); + TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId)); // Put a packet in the history, in order to facilitate payload padding. std::unique_ptr packet = @@ -1053,7 +1055,7 @@ TEST_F(RtpSenderTest, GeneratePaddingResendsOldPacketsWithRtx) { RtpPacketHistory::StorageMode::kStoreAndCull, 1); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - TransportSequenceNumber::kUri, kTransportSequenceNumberExtensionId)); + TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId)); const size_t kPayloadPacketSize = kMinPaddingSize; std::unique_ptr packet = @@ -1103,7 +1105,7 @@ TEST_F(RtpSenderTest, LimitsPayloadPaddingSize) { RtpPacketHistory::StorageMode::kStoreAndCull, 1); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - TransportSequenceNumber::kUri, kTransportSequenceNumberExtensionId)); + TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId)); // Send a dummy video packet so it ends up in the packet history. const size_t kPayloadPacketSize = 1234u; @@ -1139,11 +1141,11 @@ TEST_F(RtpSenderTest, GeneratePaddingCreatesPurePaddingWithoutRtx) { packet_history_->SetStorePacketsStatus( RtpPacketHistory::StorageMode::kStoreAndCull, 1); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - TransmissionOffset::kUri, kTransmissionTimeOffsetExtensionId)); + TransmissionOffset::Uri(), kTransmissionTimeOffsetExtensionId)); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - AbsoluteSendTime::kUri, kAbsoluteSendTimeExtensionId)); + AbsoluteSendTime::Uri(), kAbsoluteSendTimeExtensionId)); ASSERT_TRUE(rtp_sender_->RegisterRtpHeaderExtension( - TransportSequenceNumber::kUri, kTransportSequenceNumberExtensionId)); + TransportSequenceNumber::Uri(), kTransportSequenceNumberExtensionId)); const size_t kPayloadPacketSize = 1234; // Send a dummy video packet so it ends up in the packet history. Since we @@ -1188,8 +1190,8 @@ TEST_F(RtpSenderTest, SupportsPadding) { bool kSendingMediaStats[] = {true, false}; bool kEnableRedundantPayloads[] = {true, false}; absl::string_view kBweExtensionUris[] = { - TransportSequenceNumber::kUri, TransportSequenceNumberV2::kUri, - AbsoluteSendTime::kUri, TransmissionOffset::kUri}; + TransportSequenceNumber::Uri(), TransportSequenceNumberV2::Uri(), + AbsoluteSendTime::Uri(), TransmissionOffset::Uri()}; const int kExtensionsId = 7; for (bool sending_media : kSendingMediaStats) { diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc index 3e803fff1f50..ffdd0d8f6c46 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_sender_video_unittest.cc @@ -207,7 +207,7 @@ class RtpSenderVideoTest : public ::testing::TestWithParam { TEST_P(RtpSenderVideoTest, KeyFrameHasCVO) { uint8_t kFrame[kMaxPacketLength]; - rtp_module_->RegisterRtpHeaderExtension(VideoOrientation::kUri, + rtp_module_->RegisterRtpHeaderExtension(VideoOrientation::Uri(), kVideoRotationExtensionId); RTPVideoHeader hdr; @@ -227,7 +227,7 @@ TEST_P(RtpSenderVideoTest, TimingFrameHasPacketizationTimstampSet) { const int64_t kPacketizationTimeMs = 100; const int64_t kEncodeStartDeltaMs = 10; const int64_t kEncodeFinishDeltaMs = 50; - rtp_module_->RegisterRtpHeaderExtension(VideoTimingExtension::kUri, + rtp_module_->RegisterRtpHeaderExtension(VideoTimingExtension::Uri(), kVideoTimingExtensionId); const int64_t kCaptureTimestamp = fake_clock_.TimeInMilliseconds(); @@ -252,7 +252,7 @@ TEST_P(RtpSenderVideoTest, TimingFrameHasPacketizationTimstampSet) { TEST_P(RtpSenderVideoTest, DeltaFrameHasCVOWhenChanged) { uint8_t kFrame[kMaxPacketLength]; - rtp_module_->RegisterRtpHeaderExtension(VideoOrientation::kUri, + rtp_module_->RegisterRtpHeaderExtension(VideoOrientation::Uri(), kVideoRotationExtensionId); RTPVideoHeader hdr; @@ -276,7 +276,7 @@ TEST_P(RtpSenderVideoTest, DeltaFrameHasCVOWhenChanged) { TEST_P(RtpSenderVideoTest, DeltaFrameHasCVOWhenNonZero) { uint8_t kFrame[kMaxPacketLength]; - rtp_module_->RegisterRtpHeaderExtension(VideoOrientation::kUri, + rtp_module_->RegisterRtpHeaderExtension(VideoOrientation::Uri(), kVideoRotationExtensionId); RTPVideoHeader hdr; @@ -508,7 +508,7 @@ TEST_P(RtpSenderVideoTest, SendsDependencyDescriptorWhenVideoStructureIsSet) { const int64_t kFrameId = 100000; uint8_t kFrame[100]; rtp_module_->RegisterRtpHeaderExtension( - RtpDependencyDescriptorExtension::kUri, kDependencyDescriptorId); + RtpDependencyDescriptorExtension::Uri(), kDependencyDescriptorId); FrameDependencyStructure video_structure; video_structure.num_decode_targets = 2; video_structure.templates = { @@ -577,7 +577,7 @@ TEST_P(RtpSenderVideoTest, const int64_t kFrameId = 100000; uint8_t kFrame[100]; rtp_module_->RegisterRtpHeaderExtension( - RtpDependencyDescriptorExtension::kUri, kDependencyDescriptorId); + RtpDependencyDescriptorExtension::Uri(), kDependencyDescriptorId); rtp_module_->SetExtmapAllowMixed(false); FrameDependencyStructure video_structure; video_structure.num_decode_targets = 2; @@ -630,7 +630,7 @@ TEST_P(RtpSenderVideoTest, PropagatesChainDiffsIntoDependencyDescriptor) { const int64_t kFrameId = 100000; uint8_t kFrame[100]; rtp_module_->RegisterRtpHeaderExtension( - RtpDependencyDescriptorExtension::kUri, kDependencyDescriptorId); + RtpDependencyDescriptorExtension::Uri(), kDependencyDescriptorId); FrameDependencyStructure video_structure; video_structure.num_decode_targets = 2; video_structure.num_chains = 1; @@ -664,7 +664,7 @@ TEST_P(RtpSenderVideoTest, const int64_t kFrameId = 100000; uint8_t kFrame[100]; rtp_module_->RegisterRtpHeaderExtension( - RtpDependencyDescriptorExtension::kUri, kDependencyDescriptorId); + RtpDependencyDescriptorExtension::Uri(), kDependencyDescriptorId); FrameDependencyStructure video_structure; video_structure.num_decode_targets = 2; video_structure.num_chains = 1; @@ -698,7 +698,7 @@ TEST_P(RtpSenderVideoTest, const int64_t kFrameId = 100000; uint8_t kFrame[100]; rtp_module_->RegisterRtpHeaderExtension( - RtpDependencyDescriptorExtension::kUri, kDependencyDescriptorId); + RtpDependencyDescriptorExtension::Uri(), kDependencyDescriptorId); FrameDependencyStructure video_structure1; video_structure1.num_decode_targets = 2; video_structure1.templates = { @@ -773,7 +773,7 @@ TEST_P(RtpSenderVideoTest, uint8_t kFrame[kFrameSize] = {1, 2, 3, 4}; rtp_module_->RegisterRtpHeaderExtension( - RtpDependencyDescriptorExtension::kUri, kDependencyDescriptorId); + RtpDependencyDescriptorExtension::Uri(), kDependencyDescriptorId); rtc::scoped_refptr encryptor( new rtc::RefCountedObject>); ON_CALL(*encryptor, GetMaxCiphertextByteSize).WillByDefault(ReturnArg<1>()); @@ -815,7 +815,7 @@ TEST_P(RtpSenderVideoTest, PopulateGenericFrameDescriptor) { const int64_t kFrameId = 100000; uint8_t kFrame[100]; rtp_module_->RegisterRtpHeaderExtension( - RtpGenericFrameDescriptorExtension00::kUri, kGenericDescriptorId); + RtpGenericFrameDescriptorExtension00::Uri(), kGenericDescriptorId); RTPVideoHeader hdr; RTPVideoHeader::GenericDescriptorInfo& generic = hdr.generic.emplace(); @@ -847,7 +847,7 @@ void RtpSenderVideoTest:: uint8_t kFrame[kFrameSize]; rtp_module_->RegisterRtpHeaderExtension( - RtpGenericFrameDescriptorExtension00::kUri, kGenericDescriptorId); + RtpGenericFrameDescriptorExtension00::Uri(), kGenericDescriptorId); RTPVideoHeader hdr; hdr.codec = kVideoCodecVP8; @@ -882,7 +882,7 @@ TEST_P(RtpSenderVideoTest, VideoLayersAllocationWithResolutionSentOnKeyFrames) { const size_t kFrameSize = 100; uint8_t kFrame[kFrameSize]; rtp_module_->RegisterRtpHeaderExtension( - RtpVideoLayersAllocationExtension::kUri, + RtpVideoLayersAllocationExtension::Uri(), kVideoLayersAllocationExtensionId); VideoLayersAllocation allocation; @@ -919,7 +919,7 @@ TEST_P(RtpSenderVideoTest, const size_t kFrameSize = 100; uint8_t kFrame[kFrameSize]; rtp_module_->RegisterRtpHeaderExtension( - RtpVideoLayersAllocationExtension::kUri, + RtpVideoLayersAllocationExtension::Uri(), kVideoLayersAllocationExtensionId); VideoLayersAllocation allocation; @@ -967,7 +967,7 @@ TEST_P(RtpSenderVideoTest, const size_t kFrameSize = 100; uint8_t kFrame[kFrameSize]; rtp_module_->RegisterRtpHeaderExtension( - RtpVideoLayersAllocationExtension::kUri, + RtpVideoLayersAllocationExtension::Uri(), kVideoLayersAllocationExtensionId); VideoLayersAllocation allocation; @@ -1012,7 +1012,7 @@ TEST_P(RtpSenderVideoTest, VideoLayersAllocationSentOnDeltaFramesOnlyOnUpdate) { const size_t kFrameSize = 100; uint8_t kFrame[kFrameSize]; rtp_module_->RegisterRtpHeaderExtension( - RtpVideoLayersAllocationExtension::kUri, + RtpVideoLayersAllocationExtension::Uri(), kVideoLayersAllocationExtensionId); VideoLayersAllocation allocation; @@ -1054,7 +1054,7 @@ TEST_P(RtpSenderVideoTest, VideoLayersAllocationNotSentOnHigherTemporalLayers) { const size_t kFrameSize = 100; uint8_t kFrame[kFrameSize]; rtp_module_->RegisterRtpHeaderExtension( - RtpVideoLayersAllocationExtension::kUri, + RtpVideoLayersAllocationExtension::Uri(), kVideoLayersAllocationExtensionId); VideoLayersAllocation allocation; @@ -1089,7 +1089,7 @@ TEST_P(RtpSenderVideoTest, VideoLayersAllocationNotSentOnHigherTemporalLayers) { TEST_P(RtpSenderVideoTest, AbsoluteCaptureTime) { constexpr int64_t kAbsoluteCaptureTimestampMs = 12345678; uint8_t kFrame[kMaxPacketLength]; - rtp_module_->RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::kUri, + rtp_module_->RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::Uri(), kAbsoluteCaptureTimeExtensionId); RTPVideoHeader hdr; @@ -1127,7 +1127,7 @@ TEST_P(RtpSenderVideoTest, AbsoluteCaptureTimeWithCaptureClockOffset) { constexpr int64_t kAbsoluteCaptureTimestampMs = 12345678; uint8_t kFrame[kMaxPacketLength]; - rtp_module_->RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::kUri, + rtp_module_->RegisterRtpHeaderExtension(AbsoluteCaptureTimeExtension::Uri(), kAbsoluteCaptureTimeExtensionId); RTPVideoHeader hdr; @@ -1162,7 +1162,7 @@ TEST_P(RtpSenderVideoTest, PopulatesPlayoutDelay) { // Single packet frames. constexpr size_t kPacketSize = 123; uint8_t kFrame[kPacketSize]; - rtp_module_->RegisterRtpHeaderExtension(PlayoutDelayLimits::kUri, + rtp_module_->RegisterRtpHeaderExtension(PlayoutDelayLimits::Uri(), kPlayoutDelayExtensionId); const VideoPlayoutDelay kExpectedDelay = {10, 20}; diff --git a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_video_layers_allocation_extension.h b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_video_layers_allocation_extension.h index ff8ea2a7a2bf..a6986349da68 100644 --- a/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_video_layers_allocation_extension.h +++ b/third_party/libwebrtc/modules/rtp_rtcp/source/rtp_video_layers_allocation_extension.h @@ -11,6 +11,9 @@ #ifndef MODULES_RTP_RTCP_SOURCE_RTP_VIDEO_LAYERS_ALLOCATION_EXTENSION_H_ #define MODULES_RTP_RTCP_SOURCE_RTP_VIDEO_LAYERS_ALLOCATION_EXTENSION_H_ +#include "absl/base/attributes.h" +#include "absl/strings/string_view.h" +#include "api/rtp_parameters.h" #include "api/video/video_layers_allocation.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" @@ -22,8 +25,12 @@ class RtpVideoLayersAllocationExtension { public: using value_type = VideoLayersAllocation; static constexpr RTPExtensionType kId = kRtpExtensionVideoLayersAllocation; - static constexpr const char kUri[] = + static constexpr ABSL_DEPRECATED("Use Uri()") const char kUri[] = "http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00"; + static constexpr absl::string_view Uri() { + return RtpExtension::kVideoLayersAllocationUri; + } + static bool Parse(rtc::ArrayView data, VideoLayersAllocation* allocation); static size_t ValueSize(const VideoLayersAllocation& allocation);