Bug 1766646 - Vendor libwebrtc from d0321c5e5ab

Upstream commit: https://webrtc.googlesource.com/src/+/d0321c5e5ab0dc26f2ca7f9d46b797b9af50f8ff
    Deduplicate set of the rtp header extension uri constants

    Bug: webrtc:7472
    Change-Id: Ic0b4f2cc3374ba70a043310b5046d8bf91f0acbe
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/231949
    Reviewed-by: Tommi <tommi@webrtc.org>
    Commit-Queue: Tommi <tommi@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#34990}
This commit is contained in:
Michael Froman 2022-06-07 19:53:19 -05:00 коммит произвёл Connor Sheehan
Родитель 2d52da7c64
Коммит c28b0f993f
22 изменённых файлов: 212 добавлений и 132 удалений

3
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

2
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.

6
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) {

Просмотреть файл

@ -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);
}
}

Просмотреть файл

@ -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);
{

4
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());
}
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -15,6 +15,7 @@
#include <string>
#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 <typename Extension>
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_;

Просмотреть файл

@ -47,13 +47,13 @@ RtpHeaderExtensionMap RegisterSupportedExtensions(
const std::vector<RtpExtension>& rtp_header_extensions) {
RtpHeaderExtensionMap map;
for (const auto& extension : rtp_header_extensions) {
if (extension.uri == TransportSequenceNumber::kUri) {
if (extension.uri == TransportSequenceNumber::Uri()) {
map.Register<TransportSequenceNumber>(extension.id);
} else if (extension.uri == AbsoluteSendTime::kUri) {
} else if (extension.uri == AbsoluteSendTime::Uri()) {
map.Register<AbsoluteSendTime>(extension.id);
} else if (extension.uri == TransmissionOffset::kUri) {
} else if (extension.uri == TransmissionOffset::Uri()) {
map.Register<TransmissionOffset>(extension.id);
} else if (extension.uri == RtpMid::kUri) {
} else if (extension.uri == RtpMid::Uri()) {
map.Register<RtpMid>(extension.id);
} else {
RTC_LOG(LS_INFO)

Просмотреть файл

@ -13,7 +13,10 @@
#include <bitset>
#include <cstdint>
#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<const uint8_t> data,
const FrameDependencyStructure* structure,

Просмотреть файл

@ -13,7 +13,10 @@
#include <stddef.h>
#include <stdint.h>
#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<const uint8_t> data,

Просмотреть файл

@ -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 <typename Extension>
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);

Просмотреть файл

@ -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<RtpExtension> config = {{TransmissionOffset::kUri, 1},
{AbsoluteSendTime::kUri, 3}};
const std::vector<RtpExtension> config = {{TransmissionOffset::Uri(), 1},
{AbsoluteSendTime::Uri(), 3}};
const RtpHeaderExtensionMap map(config);
EXPECT_EQ(1, map.GetId(TransmissionOffset::kId));

Просмотреть файл

@ -16,8 +16,11 @@
#include <string>
#include <vector>
#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<const uint8_t> 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<const uint8_t> 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<const uint8_t> 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<const uint8_t> data,
std::vector<uint8_t>* 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<const uint8_t> 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<const uint8_t> 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<const uint8_t> data,
uint16_t* transport_sequence_number,
absl::optional<FeedbackRequest>* 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<const uint8_t> 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<const uint8_t> 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<const uint8_t> 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<const uint8_t> data,
absl::optional<uint8_t>* 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<const uint8_t> data,
uint16_t* video_frame_tracking_id);
static size_t ValueSize(uint16_t /*video_frame_tracking_id*/) {

Просмотреть файл

@ -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<uint8_t> data,
@ -899,7 +899,6 @@ struct UncopyableExtension {
}
};
constexpr RTPExtensionType UncopyableExtension::kId;
constexpr char UncopyableExtension::kUri[];
TEST(RtpPacketTest, SetUncopyableExtension) {
RtpPacket::ExtensionManager extensions;

Просмотреть файл

@ -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));

Просмотреть файл

@ -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<RTPSenderAudio>(&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";

Просмотреть файл

@ -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<RtpSenderEgress> sender = CreateRtpSenderEgress();
header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId,
TransportSequenceNumber::kUri);
TransportSequenceNumber::Uri());
std::unique_ptr<RtpPacketToSend> 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<RtpSenderEgress> sender = CreateRtpSenderEgress();
header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId,
TransportSequenceNumber::kUri);
TransportSequenceNumber::Uri());
std::unique_ptr<RtpPacketToSend> 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<RtpSenderEgress> sender = CreateRtpSenderEgress();
header_extensions_.RegisterByUri(kVideoTimingExtensionId,
VideoTimingExtension::kUri);
VideoTimingExtension::Uri());
std::unique_ptr<RtpPacketToSend> packet = BuildRtpPacket();
packet->SetExtension<VideoTimingExtension>(VideoSendTiming{});
@ -364,7 +364,7 @@ TEST_P(RtpSenderEgressTest, WritesNetwork2ToTimingExtension) {
rtp_config.populate_network2_timestamp = true;
auto sender = std::make_unique<RtpSenderEgress>(rtp_config, &packet_history_);
header_extensions_.RegisterByUri(kVideoTimingExtensionId,
VideoTimingExtension::kUri);
VideoTimingExtension::Uri());
const uint16_t kPacerExitMs = 1234u;
std::unique_ptr<RtpPacketToSend> packet = BuildRtpPacket();
@ -388,7 +388,7 @@ TEST_P(RtpSenderEgressTest, WritesNetwork2ToTimingExtension) {
TEST_P(RtpSenderEgressTest, OnSendPacketUpdated) {
std::unique_ptr<RtpSenderEgress> 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<RtpSenderEgress> 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<RtpSenderEgress> sender = CreateRtpSenderEgress();
std::unique_ptr<RtpPacketToSend> packet = BuildRtpPacket();
@ -779,7 +779,7 @@ TEST_P(RtpSenderEgressTest, SendPacketSetsPacketOptions) {
const uint16_t kPacketId = 42;
std::unique_ptr<RtpSenderEgress> sender = CreateRtpSenderEgress();
header_extensions_.RegisterByUri(kTransportSequenceNumberExtensionId,
TransportSequenceNumber::kUri);
TransportSequenceNumber::Uri());
std::unique_ptr<RtpPacketToSend> packet = BuildRtpPacket();
packet->SetExtension<TransportSequenceNumber>(kPacketId);
@ -816,7 +816,7 @@ TEST_P(RtpSenderEgressTest, SendPacketUpdatesStats) {
auto sender = std::make_unique<RtpSenderEgress>(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<RtpPacketToSend> retransmission = BuildRtpPacket();
retransmission->set_packet_type(RtpPacketMediaType::kRetransmission);
retransmission->SetExtension<TransportSequenceNumber>(
@ -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<RtpPacketToSend> 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<RtpPacketToSend> 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<RtpPacketToSend> 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<RtpPacketToSend> fec_packet = BuildRtpPacket();
fec_packet->SetSsrc(kFlexFecSsrc);

Просмотреть файл

@ -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<RtpPacketToSend> 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<RtpPacketToSend> 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) {

Просмотреть файл

@ -207,7 +207,7 @@ class RtpSenderVideoTest : public ::testing::TestWithParam<bool> {
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<MockFrameEncryptor> encryptor(
new rtc::RefCountedObject<NiceMock<MockFrameEncryptor>>);
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};

Просмотреть файл

@ -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<const uint8_t> data,
VideoLayersAllocation* allocation);
static size_t ValueSize(const VideoLayersAllocation& allocation);