Cleanup media_session_unittest.cc
- Adds namespaces which allows removing redundant using declarations and
static keywords.
- Adds some new using declarations and make sure they are all fully
qualified.
- Use std::tuple instead of testing::tuple.
Bug: None
Change-Id: If2ca3c0b94efc8a96da8d2dada0585370e85a7e2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/326520
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41151}
diff --git a/pc/media_session_unittest.cc b/pc/media_session_unittest.cc
index 0266579..a8d01e9 100644
--- a/pc/media_session_unittest.cc
+++ b/pc/media_session_unittest.cc
@@ -54,50 +54,16 @@
ASSERT_EQ(s, cd->cryptos().size()); \
ASSERT_EQ(cs, cd->cryptos()[0].crypto_suite)
-typedef std::vector<cricket::Candidate> Candidates;
+namespace cricket {
+namespace {
-using cricket::AudioCodec;
-using cricket::AudioContentDescription;
-using cricket::ContentInfo;
-using cricket::CryptoParamsVec;
-using cricket::GetFirstAudioContent;
-using cricket::GetFirstAudioContentDescription;
-using cricket::GetFirstDataContent;
-using cricket::GetFirstVideoContent;
-using cricket::GetFirstVideoContentDescription;
-using cricket::kAutoBandwidth;
-using cricket::MEDIA_TYPE_AUDIO;
-using cricket::MEDIA_TYPE_DATA;
-using cricket::MEDIA_TYPE_VIDEO;
-using cricket::MediaContentDescription;
-using cricket::MediaDescriptionOptions;
-using cricket::MediaProtocolType;
-using cricket::MediaSessionDescriptionFactory;
-using cricket::MediaSessionOptions;
-using cricket::MediaType;
-using cricket::RidDescription;
-using cricket::RidDirection;
-using cricket::SctpDataContentDescription;
-using cricket::SEC_DISABLED;
-using cricket::SEC_ENABLED;
-using cricket::SEC_REQUIRED;
-using cricket::SessionDescription;
-using cricket::SimulcastDescription;
-using cricket::SimulcastLayer;
-using cricket::SimulcastLayerList;
-using cricket::SsrcGroup;
-using cricket::StreamParams;
-using cricket::StreamParamsVec;
-using cricket::TransportDescription;
-using cricket::TransportDescriptionFactory;
-using cricket::TransportInfo;
-using cricket::VideoCodec;
-using cricket::VideoContentDescription;
-using rtc::kCsAeadAes128Gcm;
-using rtc::kCsAeadAes256Gcm;
-using rtc::kCsAesCm128HmacSha1_32;
-using rtc::kCsAesCm128HmacSha1_80;
-using rtc::UniqueRandomIdGenerator;
+using ::rtc::kCsAeadAes128Gcm;
+using ::rtc::kCsAeadAes256Gcm;
+using ::rtc::kCsAesCm128HmacSha1_32;
+using ::rtc::kCsAesCm128HmacSha1_80;
+using ::rtc::UniqueRandomIdGenerator;
+using ::testing::Bool;
+using ::testing::Combine;
using ::testing::Contains;
using ::testing::Each;
using ::testing::ElementsAre;
@@ -110,146 +76,145 @@
using ::testing::Not;
using ::testing::Pointwise;
using ::testing::SizeIs;
-using webrtc::RtpExtension;
-using webrtc::RtpTransceiverDirection;
+using ::testing::Values;
+using ::testing::ValuesIn;
+using ::webrtc::RtpExtension;
+using ::webrtc::RtpTransceiverDirection;
-static AudioCodec createRedAudioCodec(absl::string_view encoding_id) {
- AudioCodec red = cricket::CreateAudioCodec(63, "red", 48000, 2);
- red.SetParam(cricket::kCodecParamNotInNameValueFormat,
+using Candidates = std::vector<Candidate>;
+
+AudioCodec CreateRedAudioCodec(absl::string_view encoding_id) {
+ AudioCodec red = CreateAudioCodec(63, "red", 48000, 2);
+ red.SetParam(kCodecParamNotInNameValueFormat,
std::string(encoding_id) + '/' + std::string(encoding_id));
return red;
}
-static const AudioCodec kAudioCodecs1[] = {
- cricket::CreateAudioCodec(111, "opus", 48000, 2),
- createRedAudioCodec("111"),
- cricket::CreateAudioCodec(102, "iLBC", 8000, 1),
- cricket::CreateAudioCodec(0, "PCMU", 8000, 1),
- cricket::CreateAudioCodec(8, "PCMA", 8000, 1),
- cricket::CreateAudioCodec(117, "red", 8000, 1),
- cricket::CreateAudioCodec(107, "CN", 48000, 1)};
+const AudioCodec kAudioCodecs1[] = {CreateAudioCodec(111, "opus", 48000, 2),
+ CreateRedAudioCodec("111"),
+ CreateAudioCodec(102, "iLBC", 8000, 1),
+ CreateAudioCodec(0, "PCMU", 8000, 1),
+ CreateAudioCodec(8, "PCMA", 8000, 1),
+ CreateAudioCodec(117, "red", 8000, 1),
+ CreateAudioCodec(107, "CN", 48000, 1)};
-static const AudioCodec kAudioCodecs2[] = {
- cricket::CreateAudioCodec(126, "foo", 16000, 1),
- cricket::CreateAudioCodec(0, "PCMU", 8000, 1),
- cricket::CreateAudioCodec(127, "iLBC", 8000, 1),
+const AudioCodec kAudioCodecs2[] = {
+ CreateAudioCodec(126, "foo", 16000, 1),
+ CreateAudioCodec(0, "PCMU", 8000, 1),
+ CreateAudioCodec(127, "iLBC", 8000, 1),
};
-static const AudioCodec kAudioCodecsAnswer[] = {
- cricket::CreateAudioCodec(102, "iLBC", 8000, 1),
- cricket::CreateAudioCodec(0, "PCMU", 8000, 1),
+const AudioCodec kAudioCodecsAnswer[] = {
+ CreateAudioCodec(102, "iLBC", 8000, 1),
+ CreateAudioCodec(0, "PCMU", 8000, 1),
};
-static const VideoCodec kVideoCodecs1[] = {
- cricket::CreateVideoCodec(96, "H264-SVC"),
- cricket::CreateVideoCodec(97, "H264")};
+const VideoCodec kVideoCodecs1[] = {CreateVideoCodec(96, "H264-SVC"),
+ CreateVideoCodec(97, "H264")};
-static const VideoCodec kVideoCodecs1Reverse[] = {
- cricket::CreateVideoCodec(97, "H264"),
- cricket::CreateVideoCodec(96, "H264-SVC")};
+const VideoCodec kVideoCodecs1Reverse[] = {CreateVideoCodec(97, "H264"),
+ CreateVideoCodec(96, "H264-SVC")};
-static const VideoCodec kVideoCodecs2[] = {
- cricket::CreateVideoCodec(126, "H264"),
- cricket::CreateVideoCodec(127, "H263")};
+const VideoCodec kVideoCodecs2[] = {CreateVideoCodec(126, "H264"),
+ CreateVideoCodec(127, "H263")};
-static const VideoCodec kVideoCodecsAnswer[] = {
- cricket::CreateVideoCodec(97, "H264")};
+const VideoCodec kVideoCodecsAnswer[] = {CreateVideoCodec(97, "H264")};
-static const RtpExtension kAudioRtpExtension1[] = {
+const RtpExtension kAudioRtpExtension1[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
RtpExtension("http://google.com/testing/audio_something", 10),
};
-static const RtpExtension kAudioRtpExtensionEncrypted1[] = {
+const RtpExtension kAudioRtpExtensionEncrypted1[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
RtpExtension("http://google.com/testing/audio_something", 10),
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 12, true),
RtpExtension("http://google.com/testing/audio_something", 11, true),
};
-static const RtpExtension kAudioRtpExtension2[] = {
+const RtpExtension kAudioRtpExtension2[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 2),
RtpExtension("http://google.com/testing/audio_something_else", 8),
RtpExtension("http://google.com/testing/both_audio_and_video", 7),
};
-static const RtpExtension kAudioRtpExtension3[] = {
+const RtpExtension kAudioRtpExtension3[] = {
RtpExtension("http://google.com/testing/audio_something", 2),
RtpExtension("http://google.com/testing/both_audio_and_video", 3),
};
-static const RtpExtension kAudioRtpExtension3ForEncryption[] = {
+const RtpExtension kAudioRtpExtension3ForEncryption[] = {
RtpExtension("http://google.com/testing/audio_something", 2),
// Use RTP extension that supports encryption.
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 3),
};
-static const RtpExtension kAudioRtpExtension3ForEncryptionOffer[] = {
+const RtpExtension kAudioRtpExtension3ForEncryptionOffer[] = {
RtpExtension("http://google.com/testing/audio_something", 2),
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 3),
RtpExtension("http://google.com/testing/audio_something", 14, true),
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 13, true),
};
-static const RtpExtension kVideoRtpExtension3ForEncryptionOffer[] = {
+const RtpExtension kVideoRtpExtension3ForEncryptionOffer[] = {
RtpExtension("http://google.com/testing/video_something", 4),
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 3),
RtpExtension("http://google.com/testing/video_something", 12, true),
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 13, true),
};
-static const RtpExtension kAudioRtpExtensionAnswer[] = {
+const RtpExtension kAudioRtpExtensionAnswer[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
};
-static const RtpExtension kAudioRtpExtensionEncryptedAnswer[] = {
+const RtpExtension kAudioRtpExtensionEncryptedAnswer[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 12, true),
};
-static const RtpExtension kVideoRtpExtension1[] = {
+const RtpExtension kVideoRtpExtension1[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
RtpExtension("http://google.com/testing/video_something", 13),
};
-static const RtpExtension kVideoRtpExtensionEncrypted1[] = {
+const RtpExtension kVideoRtpExtensionEncrypted1[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
RtpExtension("http://google.com/testing/video_something", 13),
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 9, true),
RtpExtension("http://google.com/testing/video_something", 7, true),
};
-static const RtpExtension kVideoRtpExtension2[] = {
+const RtpExtension kVideoRtpExtension2[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 2),
RtpExtension("http://google.com/testing/video_something_else", 14),
RtpExtension("http://google.com/testing/both_audio_and_video", 7),
};
-static const RtpExtension kVideoRtpExtension3[] = {
+const RtpExtension kVideoRtpExtension3[] = {
RtpExtension("http://google.com/testing/video_something", 4),
RtpExtension("http://google.com/testing/both_audio_and_video", 5),
};
-static const RtpExtension kVideoRtpExtension3ForEncryption[] = {
+const RtpExtension kVideoRtpExtension3ForEncryption[] = {
RtpExtension("http://google.com/testing/video_something", 4),
// Use RTP extension that supports encryption.
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 5),
};
-static const RtpExtension kVideoRtpExtensionAnswer[] = {
+const RtpExtension kVideoRtpExtensionAnswer[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
};
-static const RtpExtension kVideoRtpExtensionEncryptedAnswer[] = {
+const RtpExtension kVideoRtpExtensionEncryptedAnswer[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 9, true),
};
-static const RtpExtension kRtpExtensionTransportSequenceNumber01[] = {
+const RtpExtension kRtpExtensionTransportSequenceNumber01[] = {
RtpExtension("http://www.ietf.org/id/"
"draft-holmer-rmcat-transport-wide-cc-extensions-01",
1),
};
-static const RtpExtension kRtpExtensionTransportSequenceNumber01And02[] = {
+const RtpExtension kRtpExtensionTransportSequenceNumber01And02[] = {
RtpExtension("http://www.ietf.org/id/"
"draft-holmer-rmcat-transport-wide-cc-extensions-01",
1),
@@ -258,68 +223,64 @@
2),
};
-static const RtpExtension kRtpExtensionTransportSequenceNumber02[] = {
+const RtpExtension kRtpExtensionTransportSequenceNumber02[] = {
RtpExtension(
"http://www.webrtc.org/experiments/rtp-hdrext/transport-wide-cc-02",
2),
};
-static const RtpExtension kRtpExtensionGenericFrameDescriptorUri00[] = {
+const RtpExtension kRtpExtensionGenericFrameDescriptorUri00[] = {
RtpExtension("http://www.webrtc.org/experiments/rtp-hdrext/"
"generic-frame-descriptor-00",
3),
};
-static const uint32_t kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31};
-static const uint32_t kSimSsrc[] = {10, 20, 30};
-static const uint32_t kFec1Ssrc[] = {10, 11};
-static const uint32_t kFec2Ssrc[] = {20, 21};
-static const uint32_t kFec3Ssrc[] = {30, 31};
+const uint32_t kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31};
+const uint32_t kSimSsrc[] = {10, 20, 30};
+const uint32_t kFec1Ssrc[] = {10, 11};
+const uint32_t kFec2Ssrc[] = {20, 21};
+const uint32_t kFec3Ssrc[] = {30, 31};
-static const char kMediaStream1[] = "stream_1";
-static const char kMediaStream2[] = "stream_2";
-static const char kVideoTrack1[] = "video_1";
-static const char kVideoTrack2[] = "video_2";
-static const char kAudioTrack1[] = "audio_1";
-static const char kAudioTrack2[] = "audio_2";
-static const char kAudioTrack3[] = "audio_3";
+const char kMediaStream1[] = "stream_1";
+const char kMediaStream2[] = "stream_2";
+const char kVideoTrack1[] = "video_1";
+const char kVideoTrack2[] = "video_2";
+const char kAudioTrack1[] = "audio_1";
+const char kAudioTrack2[] = "audio_2";
+const char kAudioTrack3[] = "audio_3";
-static const char* kMediaProtocols[] = {"RTP/AVP", "RTP/SAVP", "RTP/AVPF",
- "RTP/SAVPF"};
-static const char* kMediaProtocolsDtls[] = {
- "TCP/TLS/RTP/SAVPF", "TCP/TLS/RTP/SAVP", "UDP/TLS/RTP/SAVPF",
- "UDP/TLS/RTP/SAVP"};
+const char* kMediaProtocols[] = {"RTP/AVP", "RTP/SAVP", "RTP/AVPF",
+ "RTP/SAVPF"};
+const char* kMediaProtocolsDtls[] = {"TCP/TLS/RTP/SAVPF", "TCP/TLS/RTP/SAVP",
+ "UDP/TLS/RTP/SAVPF", "UDP/TLS/RTP/SAVP"};
// SRTP cipher name negotiated by the tests. This must be updated if the
// default changes.
-static const char* kDefaultSrtpCryptoSuite = kCsAesCm128HmacSha1_80;
-static const char* kDefaultSrtpCryptoSuiteGcm = kCsAeadAes256Gcm;
-static const uint8_t kDefaultCryptoSuiteSize = 3U;
+const char* kDefaultSrtpCryptoSuite = kCsAesCm128HmacSha1_80;
+const char* kDefaultSrtpCryptoSuiteGcm = kCsAeadAes256Gcm;
+const uint8_t kDefaultCryptoSuiteSize = 3U;
// These constants are used to make the code using "AddMediaDescriptionOptions"
// more readable.
-static constexpr bool kStopped = true;
-static constexpr bool kActive = false;
+constexpr bool kStopped = true;
+constexpr bool kActive = false;
-static bool IsMediaContentOfType(const ContentInfo* content,
- MediaType media_type) {
+bool IsMediaContentOfType(const ContentInfo* content, MediaType media_type) {
RTC_DCHECK(content);
return content->media_description()->type() == media_type;
}
-static RtpTransceiverDirection GetMediaDirection(const ContentInfo* content) {
+RtpTransceiverDirection GetMediaDirection(const ContentInfo* content) {
RTC_DCHECK(content);
return content->media_description()->direction();
}
-static void AddRtxCodec(const VideoCodec& rtx_codec,
- std::vector<VideoCodec>* codecs) {
- ASSERT_FALSE(cricket::FindCodecById(*codecs, rtx_codec.id));
+void AddRtxCodec(const VideoCodec& rtx_codec, std::vector<VideoCodec>* codecs) {
+ ASSERT_FALSE(FindCodecById(*codecs, rtx_codec.id));
codecs->push_back(rtx_codec);
}
-static std::vector<std::string> GetCodecNames(
- const std::vector<cricket::Codec>& codecs) {
+std::vector<std::string> GetCodecNames(const std::vector<Codec>& codecs) {
std::vector<std::string> codec_names;
codec_names.reserve(codecs.size());
for (const auto& codec : codecs) {
@@ -348,29 +309,29 @@
}
// Add a media section to the `session_options`.
-static void AddMediaDescriptionOptions(MediaType type,
- const std::string& mid,
- RtpTransceiverDirection direction,
- bool stopped,
- MediaSessionOptions* opts) {
+void AddMediaDescriptionOptions(MediaType type,
+ const std::string& mid,
+ RtpTransceiverDirection direction,
+ bool stopped,
+ MediaSessionOptions* opts) {
opts->media_description_options.push_back(
MediaDescriptionOptions(type, mid, direction, stopped));
}
-static void AddAudioVideoSections(RtpTransceiverDirection direction,
- MediaSessionOptions* opts) {
+void AddAudioVideoSections(RtpTransceiverDirection direction,
+ MediaSessionOptions* opts) {
AddMediaDescriptionOptions(MEDIA_TYPE_AUDIO, "audio", direction, kActive,
opts);
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video", direction, kActive,
opts);
}
-static void AddDataSection(RtpTransceiverDirection direction,
- MediaSessionOptions* opts) {
+void AddDataSection(RtpTransceiverDirection direction,
+ MediaSessionOptions* opts) {
AddMediaDescriptionOptions(MEDIA_TYPE_DATA, "data", direction, kActive, opts);
}
-static void AttachSenderToMediaDescriptionOptions(
+void AttachSenderToMediaDescriptionOptions(
const std::string& mid,
MediaType type,
const std::string& track_id,
@@ -393,7 +354,7 @@
}
}
-static void AttachSenderToMediaDescriptionOptions(
+void AttachSenderToMediaDescriptionOptions(
const std::string& mid,
MediaType type,
const std::string& track_id,
@@ -405,22 +366,21 @@
session_options);
}
-static void DetachSenderFromMediaSection(const std::string& mid,
- const std::string& track_id,
- MediaSessionOptions* session_options) {
- std::vector<cricket::SenderOptions>& sender_options_list =
+void DetachSenderFromMediaSection(const std::string& mid,
+ const std::string& track_id,
+ MediaSessionOptions* session_options) {
+ std::vector<SenderOptions>& sender_options_list =
FindFirstMediaDescriptionByMid(mid, session_options)->sender_options;
- auto sender_it =
- absl::c_find_if(sender_options_list,
- [track_id](const cricket::SenderOptions& sender_options) {
- return sender_options.track_id == track_id;
- });
+ auto sender_it = absl::c_find_if(
+ sender_options_list, [track_id](const SenderOptions& sender_options) {
+ return sender_options.track_id == track_id;
+ });
RTC_DCHECK(sender_it != sender_options_list.end());
sender_options_list.erase(sender_it);
}
// Helper function used to create recv-only audio MediaSessionOptions.
-static MediaSessionOptions CreateAudioMediaSession() {
+MediaSessionOptions CreateAudioMediaSession() {
MediaSessionOptions session_options;
AddMediaDescriptionOptions(MEDIA_TYPE_AUDIO, "audio",
RtpTransceiverDirection::kRecvOnly, kActive,
@@ -432,7 +392,7 @@
void PreferGcmCryptoParameters(CryptoParamsVec* cryptos) {
cryptos->erase(
std::remove_if(cryptos->begin(), cryptos->end(),
- [](const cricket::CryptoParams& crypto) {
+ [](const CryptoParams& crypto) {
return crypto.crypto_suite != kCsAeadAes256Gcm &&
crypto.crypto_suite != kCsAeadAes128Gcm;
}),
@@ -443,7 +403,7 @@
// was designed for Plan B SDP, where only one audio "m=" section and one video
// "m=" section could be generated, and ordering couldn't be controlled. Many of
// these tests may be obsolete as a result, and should be refactored or removed.
-class MediaSessionDescriptionFactoryTest : public ::testing::Test {
+class MediaSessionDescriptionFactoryTest : public testing::Test {
public:
MediaSessionDescriptionFactoryTest()
: tdf1_(field_trials),
@@ -547,9 +507,9 @@
EXPECT_EQ(current_audio_ufrag, ti_audio->description.ice_ufrag);
EXPECT_EQ(current_audio_pwd, ti_audio->description.ice_pwd);
} else {
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_UFRAG_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_UFRAG_LENGTH),
ti_audio->description.ice_ufrag.size());
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_PWD_LENGTH),
ti_audio->description.ice_pwd.size());
}
auto media_desc_options_it =
@@ -571,9 +531,9 @@
EXPECT_EQ(current_video_ufrag, ti_video->description.ice_ufrag);
EXPECT_EQ(current_video_pwd, ti_video->description.ice_pwd);
} else {
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_UFRAG_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_UFRAG_LENGTH),
ti_video->description.ice_ufrag.size());
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_PWD_LENGTH),
ti_video->description.ice_pwd.size());
}
}
@@ -592,9 +552,9 @@
EXPECT_EQ(current_data_ufrag, ti_data->description.ice_ufrag);
EXPECT_EQ(current_data_pwd, ti_data->description.ice_pwd);
} else {
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_UFRAG_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_UFRAG_LENGTH),
ti_data->description.ice_ufrag.size());
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_PWD_LENGTH),
ti_data->description.ice_pwd.size());
}
}
@@ -624,10 +584,10 @@
f1_.CreateAnswerOrError(ref_desc.get(), options, nullptr).MoveValue();
}
ASSERT_TRUE(desc);
- const cricket::MediaContentDescription* audio_media_desc =
+ const MediaContentDescription* audio_media_desc =
desc->GetContentDescriptionByName("audio");
ASSERT_TRUE(audio_media_desc);
- const cricket::MediaContentDescription* video_media_desc =
+ const MediaContentDescription* video_media_desc =
desc->GetContentDescriptionByName("video");
ASSERT_TRUE(video_media_desc);
EXPECT_TRUE(CompareCryptoParams(audio_media_desc->cryptos(),
@@ -637,7 +597,7 @@
// Verify the selected crypto is one from the reference audio
// media content.
- const cricket::MediaContentDescription* ref_audio_media_desc =
+ const MediaContentDescription* ref_audio_media_desc =
ref_desc->GetContentDescriptionByName("audio");
bool found = false;
for (size_t i = 0; i < ref_audio_media_desc->cryptos().size(); ++i) {
@@ -679,10 +639,10 @@
EXPECT_EQ(expected_direction_in_answer, vcd_answer->direction());
}
- bool VerifyNoCNCodecs(const cricket::ContentInfo* content) {
+ bool VerifyNoCNCodecs(const ContentInfo* content) {
RTC_DCHECK(content);
RTC_CHECK(content->media_description());
- for (const cricket::Codec& codec : content->media_description()->codecs()) {
+ for (const Codec& codec : content->media_description()->codecs()) {
if (codec.name == "CN") {
return false;
}
@@ -705,7 +665,7 @@
f1_.CreateOfferOrError(offer_opts, nullptr).MoveValue();
ASSERT_TRUE(offer.get());
if (gcm_offer && gcm_answer) {
- for (cricket::ContentInfo& content : offer->contents()) {
+ for (ContentInfo& content : offer->contents()) {
auto cryptos = content.media_description()->cryptos();
PreferGcmCryptoParameters(&cryptos);
content.media_description()->set_cryptos(cryptos);
@@ -740,13 +700,13 @@
} else {
ASSERT_CRYPTO(vcd, 1U, kDefaultSrtpCryptoSuite);
}
- EXPECT_EQ(cricket::kMediaProtocolSavpf, vcd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, vcd->protocol());
}
void TestTransportSequenceNumberNegotiation(
- const cricket::RtpHeaderExtensions& local,
- const cricket::RtpHeaderExtensions& offered,
- const cricket::RtpHeaderExtensions& expectedAnswer) {
+ const RtpHeaderExtensions& local,
+ const RtpHeaderExtensions& offered,
+ const RtpHeaderExtensions& expectedAnswer) {
MediaSessionOptions opts;
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
SetAudioVideoRtpHeaderExtensions(offered, offered, &opts);
@@ -766,8 +726,7 @@
}
std::vector<webrtc::RtpHeaderExtensionCapability>
- HeaderExtensionCapabilitiesFromRtpExtensions(
- cricket::RtpHeaderExtensions extensions) {
+ HeaderExtensionCapabilitiesFromRtpExtensions(RtpHeaderExtensions extensions) {
std::vector<webrtc::RtpHeaderExtensionCapability> capabilities;
for (const auto& extension : extensions) {
webrtc::RtpHeaderExtensionCapability capability(
@@ -778,8 +737,8 @@
return capabilities;
}
- void SetAudioVideoRtpHeaderExtensions(cricket::RtpHeaderExtensions audio_exts,
- cricket::RtpHeaderExtensions video_exts,
+ void SetAudioVideoRtpHeaderExtensions(RtpHeaderExtensions audio_exts,
+ RtpHeaderExtensions video_exts,
MediaSessionOptions* opts) {
auto audio_caps = HeaderExtensionCapabilitiesFromRtpExtensions(audio_exts);
auto video_caps = HeaderExtensionCapabilitiesFromRtpExtensions(video_exts);
@@ -825,7 +784,7 @@
EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // default bandwidth (auto)
EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on
ASSERT_CRYPTO(acd, kDefaultCryptoSuiteSize, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, acd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, acd->protocol());
}
// Create an offer with just Opus and RED.
@@ -909,14 +868,14 @@
EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // default bandwidth (auto)
EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on
ASSERT_CRYPTO(acd, kDefaultCryptoSuiteSize, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, acd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, acd->protocol());
EXPECT_EQ(MEDIA_TYPE_VIDEO, vcd->type());
EXPECT_EQ(f1_.video_sendrecv_codecs(), vcd->codecs());
EXPECT_EQ(0U, vcd->first_ssrc()); // no sender is attached
EXPECT_EQ(kAutoBandwidth, vcd->bandwidth()); // default bandwidth (auto)
EXPECT_TRUE(vcd->rtcp_mux()); // rtcp-mux defaults on
ASSERT_CRYPTO(vcd, kDefaultCryptoSuiteSize, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, vcd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, vcd->protocol());
}
// Test creating an offer with bundle where the Codecs have the same dynamic
@@ -976,9 +935,9 @@
EXPECT_TRUE(acd);
ASSERT_CRYPTO(acd, 1U, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, acd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, acd->protocol());
ASSERT_CRYPTO(vcd, 1U, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, vcd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, vcd->protocol());
}
// Create an SCTP data offer with bundle without error.
@@ -994,7 +953,7 @@
auto dcd = GetFirstSctpDataContentDescription(offer.get());
ASSERT_TRUE(dcd);
// Since this transport is insecure, the protocol should be "SCTP".
- EXPECT_EQ(cricket::kMediaProtocolSctp, dcd->protocol());
+ EXPECT_EQ(kMediaProtocolSctp, dcd->protocol());
}
// Create an SCTP data offer with bundle without error.
@@ -1011,7 +970,7 @@
auto dcd = GetFirstSctpDataContentDescription(offer.get());
ASSERT_TRUE(dcd);
// The protocol should now be "UDP/DTLS/SCTP"
- EXPECT_EQ(cricket::kMediaProtocolUdpDtlsSctp, dcd->protocol());
+ EXPECT_EQ(kMediaProtocolUdpDtlsSctp, dcd->protocol());
}
// Test creating an sctp data channel from an already generated offer.
@@ -1025,13 +984,13 @@
ASSERT_TRUE(offer1.get());
const ContentInfo* data = offer1->GetContentByName("data");
ASSERT_TRUE(data);
- ASSERT_EQ(cricket::kMediaProtocolSctp, data->media_description()->protocol());
+ ASSERT_EQ(kMediaProtocolSctp, data->media_description()->protocol());
std::unique_ptr<SessionDescription> offer2(
f1_.CreateOfferOrError(opts, offer1.get()).MoveValue());
data = offer2->GetContentByName("data");
ASSERT_TRUE(data);
- EXPECT_EQ(cricket::kMediaProtocolSctp, data->media_description()->protocol());
+ EXPECT_EQ(kMediaProtocolSctp, data->media_description()->protocol());
}
// Test that if BUNDLE is enabled and all media sections are rejected then the
@@ -1049,7 +1008,7 @@
std::unique_ptr<SessionDescription> reoffer =
f1_.CreateOfferOrError(opts, offer.get()).MoveValue();
- EXPECT_FALSE(reoffer->GetGroupByName(cricket::GROUP_TYPE_BUNDLE));
+ EXPECT_FALSE(reoffer->GetGroupByName(GROUP_TYPE_BUNDLE));
}
// Test that if BUNDLE is enabled and the remote re-offer does not include a
@@ -1072,7 +1031,7 @@
std::unique_ptr<SessionDescription> reanswer =
f2_.CreateAnswerOrError(reoffer.get(), opts, answer.get()).MoveValue();
- EXPECT_FALSE(reanswer->GetGroupByName(cricket::GROUP_TYPE_BUNDLE));
+ EXPECT_FALSE(reanswer->GetGroupByName(GROUP_TYPE_BUNDLE));
}
// Test that if BUNDLE is enabled and the previous offerer-tagged media section
@@ -1095,8 +1054,7 @@
std::unique_ptr<SessionDescription> reoffer =
f1_.CreateOfferOrError(opts, offer.get()).MoveValue();
- const cricket::ContentGroup* bundle_group =
- reoffer->GetGroupByName(cricket::GROUP_TYPE_BUNDLE);
+ const ContentGroup* bundle_group = reoffer->GetGroupByName(GROUP_TYPE_BUNDLE);
ASSERT_TRUE(bundle_group);
EXPECT_FALSE(bundle_group->HasContentName("audio"));
EXPECT_TRUE(bundle_group->HasContentName("video"));
@@ -1126,8 +1084,8 @@
std::unique_ptr<SessionDescription> reanswer =
f2_.CreateAnswerOrError(reoffer.get(), opts, answer.get()).MoveValue();
- const cricket::ContentGroup* bundle_group =
- reanswer->GetGroupByName(cricket::GROUP_TYPE_BUNDLE);
+ const ContentGroup* bundle_group =
+ reanswer->GetGroupByName(GROUP_TYPE_BUNDLE);
ASSERT_TRUE(bundle_group);
EXPECT_FALSE(bundle_group->HasContentName("audio"));
EXPECT_TRUE(bundle_group->HasContentName("video"));
@@ -1157,10 +1115,10 @@
// Munge the offer to have two groups. Offers like these cannot be generated
// without munging, but it is valid to receive such offers from remote
// endpoints.
- cricket::ContentGroup bundle_group1(cricket::GROUP_TYPE_BUNDLE);
+ ContentGroup bundle_group1(GROUP_TYPE_BUNDLE);
bundle_group1.AddContentName("1");
bundle_group1.AddContentName("2");
- cricket::ContentGroup bundle_group2(cricket::GROUP_TYPE_BUNDLE);
+ ContentGroup bundle_group2(GROUP_TYPE_BUNDLE);
bundle_group2.AddContentName("3");
bundle_group2.AddContentName("4");
offer->AddGroup(bundle_group1);
@@ -1172,8 +1130,8 @@
std::unique_ptr<SessionDescription> answer =
f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue();
- std::vector<const cricket::ContentGroup*> answer_groups =
- answer->GetGroupsByName(cricket::GROUP_TYPE_BUNDLE);
+ std::vector<const ContentGroup*> answer_groups =
+ answer->GetGroupsByName(GROUP_TYPE_BUNDLE);
ASSERT_EQ(answer_groups.size(), 2u);
EXPECT_EQ(answer_groups[0]->content_names().size(), 2u);
EXPECT_TRUE(answer_groups[0]->HasContentName("1"));
@@ -1187,7 +1145,7 @@
opts.bundle_enabled = false;
answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue();
- answer_groups = answer->GetGroupsByName(cricket::GROUP_TYPE_BUNDLE);
+ answer_groups = answer->GetGroupsByName(GROUP_TYPE_BUNDLE);
// Rejected groups are still listed, but they are empty.
ASSERT_EQ(answer_groups.size(), 2u);
EXPECT_TRUE(answer_groups[0]->content_names().empty());
@@ -1351,7 +1309,7 @@
EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // negotiated auto bw
EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux
ASSERT_CRYPTO(acd, 1U, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, acd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, acd->protocol());
}
// Create a typical audio answer with GCM ciphers enabled, and ensure it
@@ -1363,7 +1321,7 @@
std::unique_ptr<SessionDescription> offer =
f1_.CreateOfferOrError(opts, nullptr).MoveValue();
ASSERT_TRUE(offer.get());
- for (cricket::ContentInfo& content : offer->contents()) {
+ for (ContentInfo& content : offer->contents()) {
auto cryptos = content.media_description()->cryptos();
PreferGcmCryptoParameters(&cryptos);
content.media_description()->set_cryptos(cryptos);
@@ -1382,7 +1340,7 @@
EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // negotiated auto bw
EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux
ASSERT_CRYPTO(acd, 1U, kDefaultSrtpCryptoSuiteGcm);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, acd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, acd->protocol());
}
// Create an audio answer with no common codecs, and ensure it is rejected.
@@ -1392,10 +1350,10 @@
AddMediaDescriptionOptions(MEDIA_TYPE_AUDIO, "audio",
RtpTransceiverDirection::kSendRecv, kActive,
&opts);
- std::vector f1_codecs = {cricket::CreateAudioCodec(96, "opus", 48000, 1)};
+ std::vector f1_codecs = {CreateAudioCodec(96, "opus", 48000, 1)};
f1_.set_audio_codecs(f1_codecs, f1_codecs);
- std::vector f2_codecs = {cricket::CreateAudioCodec(0, "PCMU", 8000, 1)};
+ std::vector f2_codecs = {CreateAudioCodec(0, "PCMU", 8000, 1)};
f2_.set_audio_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -1437,7 +1395,7 @@
EXPECT_EQ(0U, vcd->first_ssrc()); // no sender is attached
EXPECT_TRUE(vcd->rtcp_mux()); // negotiated rtcp-mux
ASSERT_CRYPTO(vcd, 1U, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, vcd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, vcd->protocol());
}
// Create a typical video answer with GCM ciphers enabled, and ensure it
@@ -1465,10 +1423,10 @@
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
RtpTransceiverDirection::kSendRecv, kActive,
&opts);
- std::vector f1_codecs = {cricket::CreateVideoCodec(96, "H264")};
+ std::vector f1_codecs = {CreateVideoCodec(96, "H264")};
f1_.set_video_codecs(f1_codecs, f1_codecs);
- std::vector f2_codecs = {cricket::CreateVideoCodec(97, "VP8")};
+ std::vector f2_codecs = {CreateVideoCodec(97, "VP8")};
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -1488,12 +1446,12 @@
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
RtpTransceiverDirection::kSendRecv, kActive,
&opts);
- std::vector f1_codecs = {cricket::CreateVideoCodec(96, "H264"),
- cricket::CreateVideoCodec(118, "flexfec-03")};
+ std::vector f1_codecs = {CreateVideoCodec(96, "H264"),
+ CreateVideoCodec(118, "flexfec-03")};
f1_.set_video_codecs(f1_codecs, f1_codecs);
- std::vector f2_codecs = {cricket::CreateVideoCodec(97, "VP8"),
- cricket::CreateVideoCodec(118, "flexfec-03")};
+ std::vector f2_codecs = {CreateVideoCodec(97, "VP8"),
+ CreateVideoCodec(118, "flexfec-03")};
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -1644,7 +1602,7 @@
const SctpDataContentDescription* dcd_answer =
dc_answer->media_description()->as_sctp();
EXPECT_FALSE(dc_answer->rejected);
- EXPECT_EQ(cricket::kSctpSendBufferSize, dcd_answer->max_message_size());
+ EXPECT_EQ(kSctpSendBufferSize, dcd_answer->max_message_size());
}
// Verifies that the order of the media contents in the offer is preserved in
@@ -1727,7 +1685,7 @@
const AudioContentDescription* offer_acd =
GetFirstAudioContentDescription(offer.get());
ASSERT_TRUE(offer_acd);
- EXPECT_EQ(cricket::kMediaProtocolAvpf, offer_acd->protocol());
+ EXPECT_EQ(kMediaProtocolAvpf, offer_acd->protocol());
std::unique_ptr<SessionDescription> answer =
f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue();
@@ -1739,7 +1697,7 @@
const AudioContentDescription* answer_acd =
GetFirstAudioContentDescription(answer.get());
ASSERT_TRUE(answer_acd);
- EXPECT_EQ(cricket::kMediaProtocolAvpf, answer_acd->protocol());
+ EXPECT_EQ(kMediaProtocolAvpf, answer_acd->protocol());
}
// Create a video offer and answer and ensure the RTP header extensions
@@ -1882,9 +1840,9 @@
MediaSessionOptions opts;
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
- const cricket::RtpHeaderExtensions offered_extensions = {
+ const RtpHeaderExtensions offered_extensions = {
RtpExtension(RtpExtension::kAbsoluteCaptureTimeUri, 7)};
- const cricket::RtpHeaderExtensions local_extensions = {
+ const RtpHeaderExtensions local_extensions = {
RtpExtension(RtpExtension::kTransportSequenceNumberUri, 5)};
SetAudioVideoRtpHeaderExtensions(offered_extensions, offered_extensions,
&opts);
@@ -1906,9 +1864,9 @@
MediaSessionOptions opts;
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
- const cricket::RtpHeaderExtensions offered_extensions = {
+ const RtpHeaderExtensions offered_extensions = {
RtpExtension(RtpExtension::kAbsoluteCaptureTimeUri, 7)};
- const cricket::RtpHeaderExtensions local_extensions = {
+ const RtpHeaderExtensions local_extensions = {
RtpExtension(RtpExtension::kAbsoluteCaptureTimeUri, 5)};
SetAudioVideoRtpHeaderExtensions(offered_extensions, offered_extensions,
&opts);
@@ -1930,9 +1888,9 @@
MediaSessionOptions opts;
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
- const cricket::RtpHeaderExtensions offered_extensions = {
+ const RtpHeaderExtensions offered_extensions = {
RtpExtension(RtpExtension::kTransportSequenceNumberUri, 7)};
- const cricket::RtpHeaderExtensions local_extensions = {
+ const RtpHeaderExtensions local_extensions = {
RtpExtension(RtpExtension::kAbsoluteCaptureTimeUri, 5)};
SetAudioVideoRtpHeaderExtensions(offered_extensions, offered_extensions,
&opts);
@@ -2618,18 +2576,18 @@
ASSERT_EQ(1U, video_streams.size());
EXPECT_EQ(kVideoTrack1, video_streams[0].id);
const SsrcGroup* sim_ssrc_group =
- video_streams[0].get_ssrc_group(cricket::kSimSsrcGroupSemantics);
+ video_streams[0].get_ssrc_group(kSimSsrcGroupSemantics);
ASSERT_TRUE(sim_ssrc_group);
EXPECT_EQ(static_cast<size_t>(num_sim_layers), sim_ssrc_group->ssrcs.size());
}
MATCHER(RidDescriptionEquals, "Verifies that two RidDescriptions are equal.") {
- const RidDescription& rid1 = ::testing::get<0>(arg);
- const RidDescription& rid2 = ::testing::get<1>(arg);
+ const RidDescription& rid1 = std::get<0>(arg);
+ const RidDescription& rid2 = std::get<1>(arg);
return rid1.rid == rid2.rid && rid1.direction == rid2.direction;
}
-static void CheckSimulcastInSessionDescription(
+void CheckSimulcastInSessionDescription(
const SessionDescription* description,
const std::string& content_name,
const std::vector<RidDescription>& send_rids,
@@ -3078,14 +3036,12 @@
&opts);
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates rtx for H264 with the payload type `f1_` uses.
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
// This creates rtx for H264 with the payload type `f2_` uses.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs2[0].id),
- &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -3098,8 +3054,7 @@
GetFirstVideoContentDescription(answer.get());
std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer);
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &expected_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
EXPECT_EQ(expected_codecs, vcd->codecs());
@@ -3132,14 +3087,12 @@
&opts);
// We specifically choose different preferred payload types for VP8 to
// trigger the issue.
- cricket::VideoCodec vp8_offerer = cricket::CreateVideoCodec(100, "VP8");
- cricket::VideoCodec vp8_offerer_rtx =
- cricket::CreateVideoRtxCodec(101, vp8_offerer.id);
- cricket::VideoCodec vp8_answerer = cricket::CreateVideoCodec(110, "VP8");
- cricket::VideoCodec vp8_answerer_rtx =
- cricket::CreateVideoRtxCodec(111, vp8_answerer.id);
- cricket::VideoCodec vp9 = cricket::CreateVideoCodec(120, "VP9");
- cricket::VideoCodec vp9_rtx = cricket::CreateVideoRtxCodec(121, vp9.id);
+ VideoCodec vp8_offerer = CreateVideoCodec(100, "VP8");
+ VideoCodec vp8_offerer_rtx = CreateVideoRtxCodec(101, vp8_offerer.id);
+ VideoCodec vp8_answerer = CreateVideoCodec(110, "VP8");
+ VideoCodec vp8_answerer_rtx = CreateVideoRtxCodec(111, vp8_answerer.id);
+ VideoCodec vp9 = CreateVideoCodec(120, "VP9");
+ VideoCodec vp9_rtx = CreateVideoRtxCodec(121, vp9.id);
std::vector<VideoCodec> f1_codecs = {vp8_offerer, vp8_offerer_rtx};
// We also specifically cause the answerer to prefer VP9, such that if it
@@ -3167,7 +3120,7 @@
const VideoContentDescription* vcd =
GetFirstVideoContentDescription(updated_offer.get());
- std::vector<cricket::VideoCodec> codecs = vcd->codecs();
+ std::vector<VideoCodec> codecs = vcd->codecs();
ASSERT_EQ(4u, codecs.size());
EXPECT_EQ(vp8_offerer, codecs[0]);
EXPECT_EQ(vp8_offerer_rtx, codecs[1]);
@@ -3183,8 +3136,7 @@
RespondentCreatesOfferWithVideoAndRtxAfterCreatingAudioAnswer) {
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates rtx for H264 with the payload type `f1_` uses.
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
MediaSessionOptions opts;
@@ -3210,7 +3162,7 @@
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
int used_pl_type = acd->codecs()[0].id;
f2_codecs[0].id = used_pl_type; // Set the payload type for H264.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, used_pl_type), &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, used_pl_type), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> updated_offer(
@@ -3228,12 +3180,12 @@
GetFirstVideoContentDescription(updated_answer.get());
ASSERT_EQ("H264", updated_vcd->codecs()[0].name);
- ASSERT_EQ(cricket::kRtxCodecName, updated_vcd->codecs()[1].name);
+ ASSERT_EQ(kRtxCodecName, updated_vcd->codecs()[1].name);
int new_h264_pl_type = updated_vcd->codecs()[0].id;
EXPECT_NE(used_pl_type, new_h264_pl_type);
VideoCodec rtx = updated_vcd->codecs()[1];
- int pt_referenced_by_rtx = rtc::FromString<int>(
- rtx.params[cricket::kCodecParamAssociatedPayloadType]);
+ int pt_referenced_by_rtx =
+ rtc::FromString<int>(rtx.params[kCodecParamAssociatedPayloadType]);
EXPECT_EQ(new_h264_pl_type, pt_referenced_by_rtx);
}
@@ -3247,8 +3199,7 @@
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
// This creates rtx for H264 with the payload type `f2_` uses.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs2[0].id),
- &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -3275,8 +3226,7 @@
// New offer should attempt to add H263, and RTX for H264.
expected_codecs.push_back(kVideoCodecs2[1]);
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs1[1].id),
- &expected_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs1[1].id), &expected_codecs);
EXPECT_EQ(expected_codecs, updated_vcd->codecs());
}
@@ -3288,14 +3238,12 @@
&opts);
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates RTX without associated payload type parameter.
- AddRtxCodec(cricket::CreateVideoCodec(126, cricket::kRtxCodecName),
- &f1_codecs);
+ AddRtxCodec(CreateVideoCodec(126, kRtxCodecName), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
// This creates RTX for H264 with the payload type `f2_` uses.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs2[0].id),
- &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -3306,12 +3254,12 @@
// is possible to test that that RTX is dropped when
// kCodecParamAssociatedPayloadType is missing in the offer.
MediaContentDescription* media_desc =
- offer->GetContentDescriptionByName(cricket::CN_VIDEO);
+ offer->GetContentDescriptionByName(CN_VIDEO);
ASSERT_TRUE(media_desc);
VideoContentDescription* desc = media_desc->as_video();
std::vector<VideoCodec> codecs = desc->codecs();
for (VideoCodec& codec : codecs) {
- if (absl::StartsWith(codec.name, cricket::kRtxCodecName)) {
+ if (absl::StartsWith(codec.name, kRtxCodecName)) {
codec.params.clear();
}
}
@@ -3322,7 +3270,7 @@
EXPECT_THAT(
GetCodecNames(GetFirstVideoContentDescription(answer.get())->codecs()),
- Not(Contains(cricket::kRtxCodecName)));
+ Not(Contains(kRtxCodecName)));
}
// Test that RTX will be filtered out in the answer if its associated payload
@@ -3334,14 +3282,12 @@
&opts);
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates RTX for H264 in sender.
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
// This creates RTX for H263 in receiver.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs2[1].id),
- &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[1].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -3354,7 +3300,7 @@
EXPECT_THAT(
GetCodecNames(GetFirstVideoContentDescription(answer.get())->codecs()),
- Not(Contains(cricket::kRtxCodecName)));
+ Not(Contains(kRtxCodecName)));
}
// Test that when multiple RTX codecs are offered, only the matched RTX codec
@@ -3367,19 +3313,16 @@
&opts);
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates RTX for H264-SVC in sender.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs1[0].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs1[0].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
// This creates RTX for H264 in sender.
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
// This creates RTX for H264 in receiver.
- AddRtxCodec(cricket::CreateVideoRtxCodec(124, kVideoCodecs2[0].id),
- &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(124, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f1_codecs);
// H264-SVC codec is removed in the answer, therefore, associated RTX codec
@@ -3392,8 +3335,7 @@
const VideoContentDescription* vcd =
GetFirstVideoContentDescription(answer.get());
std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer);
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &expected_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
EXPECT_EQ(expected_codecs, vcd->codecs());
}
@@ -3407,8 +3349,7 @@
&opts);
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates RTX for H264 for the offerer.
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -3418,13 +3359,11 @@
GetFirstVideoContentDescription(offer.get());
std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecs1);
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &expected_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
EXPECT_EQ(expected_codecs, vcd->codecs());
// Now, attempt to add RTX for H264-SVC.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs1[0].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs1[0].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::unique_ptr<SessionDescription> updated_offer(
@@ -3432,8 +3371,7 @@
ASSERT_TRUE(updated_offer);
vcd = GetFirstVideoContentDescription(updated_offer.get());
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs1[0].id),
- &expected_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs1[0].id), &expected_codecs);
EXPECT_EQ(expected_codecs, vcd->codecs());
}
@@ -3450,8 +3388,8 @@
// Use a single real codec, and then add RTX for it.
std::vector<VideoCodec> f1_codecs;
- f1_codecs.push_back(cricket::CreateVideoCodec(97, "H264"));
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, 97), &f1_codecs);
+ f1_codecs.push_back(CreateVideoCodec(97, "H264"));
+ AddRtxCodec(CreateVideoRtxCodec(125, 97), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
// Ensure that the offer has an RTX ssrc for each regular ssrc, and that there
@@ -3460,7 +3398,7 @@
f1_.CreateOfferOrError(opts, nullptr).MoveValue();
ASSERT_TRUE(offer.get());
MediaContentDescription* media_desc =
- offer->GetContentDescriptionByName(cricket::CN_VIDEO);
+ offer->GetContentDescriptionByName(CN_VIDEO);
ASSERT_TRUE(media_desc);
VideoContentDescription* desc = media_desc->as_video();
const StreamParamsVec& streams = desc->streams();
@@ -3495,8 +3433,8 @@
// Use a single real codec, and then add FlexFEC for it.
std::vector<VideoCodec> f1_codecs;
- f1_codecs.push_back(cricket::CreateVideoCodec(97, "H264"));
- f1_codecs.push_back(cricket::CreateVideoCodec(118, "flexfec-03"));
+ f1_codecs.push_back(CreateVideoCodec(97, "H264"));
+ f1_codecs.push_back(CreateVideoCodec(118, "flexfec-03"));
f1_.set_video_codecs(f1_codecs, f1_codecs);
// Ensure that the offer has a single FlexFEC ssrc and that
@@ -3505,7 +3443,7 @@
f1_.CreateOfferOrError(opts, nullptr).MoveValue();
ASSERT_TRUE(offer.get());
MediaContentDescription* media_desc =
- offer->GetContentDescriptionByName(cricket::CN_VIDEO);
+ offer->GetContentDescriptionByName(CN_VIDEO);
ASSERT_TRUE(media_desc);
VideoContentDescription* desc = media_desc->as_video();
const StreamParamsVec& streams = desc->streams();
@@ -3539,8 +3477,8 @@
// Use a single real codec, and then add FlexFEC for it.
std::vector<VideoCodec> f1_codecs;
- f1_codecs.push_back(cricket::CreateVideoCodec(97, "H264"));
- f1_codecs.push_back(cricket::CreateVideoCodec(118, "flexfec-03"));
+ f1_codecs.push_back(CreateVideoCodec(97, "H264"));
+ f1_codecs.push_back(CreateVideoCodec(118, "flexfec-03"));
f1_.set_video_codecs(f1_codecs, f1_codecs);
// Ensure that the offer has no FlexFEC ssrcs for each regular ssrc, and that
@@ -3549,7 +3487,7 @@
f1_.CreateOfferOrError(opts, nullptr).MoveValue();
ASSERT_TRUE(offer.get());
MediaContentDescription* media_desc =
- offer->GetContentDescriptionByName(cricket::CN_VIDEO);
+ offer->GetContentDescriptionByName(CN_VIDEO);
ASSERT_TRUE(media_desc);
VideoContentDescription* desc = media_desc->as_video();
const StreamParamsVec& streams = desc->streams();
@@ -3700,22 +3638,22 @@
TEST(MediaSessionDescription, CopySessionDescription) {
SessionDescription source;
- cricket::ContentGroup group(cricket::CN_AUDIO);
+ ContentGroup group(CN_AUDIO);
source.AddGroup(group);
std::unique_ptr<AudioContentDescription> acd =
std::make_unique<AudioContentDescription>();
acd->set_codecs(MAKE_VECTOR(kAudioCodecs1));
acd->AddLegacyStream(1);
- source.AddContent(cricket::CN_AUDIO, MediaProtocolType::kRtp, acd->Clone());
+ source.AddContent(CN_AUDIO, MediaProtocolType::kRtp, acd->Clone());
std::unique_ptr<VideoContentDescription> vcd =
std::make_unique<VideoContentDescription>();
vcd->set_codecs(MAKE_VECTOR(kVideoCodecs1));
vcd->AddLegacyStream(2);
- source.AddContent(cricket::CN_VIDEO, MediaProtocolType::kRtp, vcd->Clone());
+ source.AddContent(CN_VIDEO, MediaProtocolType::kRtp, vcd->Clone());
std::unique_ptr<SessionDescription> copy = source.Clone();
ASSERT_TRUE(copy.get());
- EXPECT_TRUE(copy->HasGroup(cricket::CN_AUDIO));
+ EXPECT_TRUE(copy->HasGroup(CN_AUDIO));
const ContentInfo* ac = copy->GetContentByName("audio");
const ContentInfo* vc = copy->GetContentByName("video");
ASSERT_TRUE(ac);
@@ -3872,7 +3810,7 @@
ASSERT_TRUE(offer_content);
AudioContentDescription* offer_audio_desc =
offer_content->media_description()->as_audio();
- offer_audio_desc->set_protocol(cricket::kMediaProtocolDtlsSavpf);
+ offer_audio_desc->set_protocol(kMediaProtocolDtlsSavpf);
std::unique_ptr<SessionDescription> answer =
f2_.CreateAnswerOrError(offer.get(), CreateAudioMediaSession(), nullptr)
@@ -3899,7 +3837,7 @@
ASSERT_TRUE(offer_content);
AudioContentDescription* offer_audio_desc =
offer_content->media_description()->as_audio();
- offer_audio_desc->set_protocol(cricket::kMediaProtocolDtlsSavpf);
+ offer_audio_desc->set_protocol(kMediaProtocolDtlsSavpf);
std::unique_ptr<SessionDescription> answer =
f2_.CreateAnswerOrError(offer.get(), CreateAudioMediaSession(), nullptr)
@@ -3912,7 +3850,7 @@
const AudioContentDescription* answer_audio_desc =
answer_content->media_description()->as_audio();
- EXPECT_EQ(cricket::kMediaProtocolDtlsSavpf, answer_audio_desc->protocol());
+ EXPECT_EQ(kMediaProtocolDtlsSavpf, answer_audio_desc->protocol());
}
// Test that we include both SDES and DTLS in the offer, but only include SDES
@@ -3925,10 +3863,10 @@
MediaSessionOptions options;
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &options);
std::unique_ptr<SessionDescription> offer, answer;
- const cricket::MediaContentDescription* audio_media_desc;
- const cricket::MediaContentDescription* video_media_desc;
- const cricket::TransportDescription* audio_trans_desc;
- const cricket::TransportDescription* video_trans_desc;
+ const MediaContentDescription* audio_media_desc;
+ const MediaContentDescription* video_media_desc;
+ const TransportDescription* audio_trans_desc;
+ const TransportDescription* video_trans_desc;
// Generate an offer with SDES and DTLS support.
offer = f1_.CreateOfferOrError(options, nullptr).MoveValue();
@@ -3977,8 +3915,8 @@
ASSERT_TRUE(video_media_desc);
EXPECT_TRUE(audio_media_desc->cryptos().empty());
EXPECT_TRUE(video_media_desc->cryptos().empty());
- EXPECT_EQ(cricket::kMediaProtocolSavpf, audio_media_desc->protocol());
- EXPECT_EQ(cricket::kMediaProtocolSavpf, video_media_desc->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, audio_media_desc->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, video_media_desc->protocol());
audio_trans_desc = answer->GetTransportDescriptionByName("audio");
ASSERT_TRUE(audio_trans_desc);
@@ -4045,10 +3983,10 @@
GetFirstVideoContentDescription(offer.get());
ASSERT_TRUE(video_offer->cryptos().empty());
- const cricket::TransportDescription* audio_offer_trans_desc =
+ const TransportDescription* audio_offer_trans_desc =
offer->GetTransportDescriptionByName("audio");
ASSERT_TRUE(audio_offer_trans_desc->identity_fingerprint.get());
- const cricket::TransportDescription* video_offer_trans_desc =
+ const TransportDescription* video_offer_trans_desc =
offer->GetTransportDescriptionByName("video");
ASSERT_TRUE(video_offer_trans_desc->identity_fingerprint.get());
@@ -4057,10 +3995,10 @@
f2_.CreateAnswerOrError(offer.get(), options, nullptr).MoveValue();
ASSERT_TRUE(answer.get());
- const cricket::TransportDescription* audio_answer_trans_desc =
+ const TransportDescription* audio_answer_trans_desc =
answer->GetTransportDescriptionByName("audio");
EXPECT_TRUE(audio_answer_trans_desc->identity_fingerprint.get());
- const cricket::TransportDescription* video_answer_trans_desc =
+ const TransportDescription* video_answer_trans_desc =
answer->GetTransportDescriptionByName("video");
EXPECT_TRUE(video_answer_trans_desc->identity_fingerprint.get());
}
@@ -4398,11 +4336,11 @@
// Test verifying that negotiating codecs with the same packetization retains
// the packetization value.
TEST_F(MediaSessionDescriptionFactoryTest, PacketizationIsEqual) {
- std::vector f1_codecs = {cricket::CreateVideoCodec(96, "H264")};
+ std::vector f1_codecs = {CreateVideoCodec(96, "H264")};
f1_codecs.back().packetization = "raw";
f1_.set_video_codecs(f1_codecs, f1_codecs);
- std::vector f2_codecs = {cricket::CreateVideoCodec(96, "H264")};
+ std::vector f2_codecs = {CreateVideoCodec(96, "H264")};
f2_codecs.back().packetization = "raw";
f2_.set_video_codecs(f2_codecs, f2_codecs);
@@ -4434,11 +4372,11 @@
// Test verifying that negotiating codecs with different packetization removes
// the packetization value.
TEST_F(MediaSessionDescriptionFactoryTest, PacketizationIsDifferent) {
- std::vector f1_codecs = {cricket::CreateVideoCodec(96, "H264")};
+ std::vector f1_codecs = {CreateVideoCodec(96, "H264")};
f1_codecs.back().packetization = "raw";
f1_.set_video_codecs(f1_codecs, f1_codecs);
- std::vector f2_codecs = {cricket::CreateVideoCodec(96, "H264")};
+ std::vector f2_codecs = {CreateVideoCodec(96, "H264")};
f2_codecs.back().packetization = "notraw";
f2_.set_video_codecs(f2_codecs, f2_codecs);
@@ -4607,12 +4545,12 @@
H264MatchCriteriaIncludesPacketizationMode) {
// Create two H264 codecs with the same profile level ID and different
// packetization modes.
- VideoCodec h264_pm0 = cricket::CreateVideoCodec(96, "H264");
- h264_pm0.params[cricket::kH264FmtpProfileLevelId] = "42c01f";
- h264_pm0.params[cricket::kH264FmtpPacketizationMode] = "0";
- VideoCodec h264_pm1 = cricket::CreateVideoCodec(97, "H264");
- h264_pm1.params[cricket::kH264FmtpProfileLevelId] = "42c01f";
- h264_pm1.params[cricket::kH264FmtpPacketizationMode] = "1";
+ VideoCodec h264_pm0 = CreateVideoCodec(96, "H264");
+ h264_pm0.params[kH264FmtpProfileLevelId] = "42c01f";
+ h264_pm0.params[kH264FmtpPacketizationMode] = "0";
+ VideoCodec h264_pm1 = CreateVideoCodec(97, "H264");
+ h264_pm1.params[kH264FmtpProfileLevelId] = "42c01f";
+ h264_pm1.params[kH264FmtpPacketizationMode] = "1";
// Offerer will send both codecs, answerer should choose the one with matching
// packetization mode (and not the first one it sees).
@@ -4641,7 +4579,7 @@
EXPECT_EQ(h264_pm1.id, answer_codec.id);
}
-class MediaProtocolTest : public ::testing::TestWithParam<const char*> {
+class MediaProtocolTest : public testing::TestWithParam<const char*> {
public:
MediaProtocolTest()
: tdf1_(field_trials_),
@@ -4702,10 +4640,10 @@
INSTANTIATE_TEST_SUITE_P(MediaProtocolPatternTest,
MediaProtocolTest,
- ::testing::ValuesIn(kMediaProtocols));
+ ValuesIn(kMediaProtocols));
INSTANTIATE_TEST_SUITE_P(MediaProtocolDtlsPatternTest,
MediaProtocolTest,
- ::testing::ValuesIn(kMediaProtocolsDtls));
+ ValuesIn(kMediaProtocolsDtls));
TEST_F(MediaSessionDescriptionFactoryTest, TestSetAudioCodecs) {
webrtc::test::ScopedKeyValueConfig field_trials;
@@ -4761,10 +4699,9 @@
EXPECT_EQ(no_codecs, sf.audio_sendrecv_codecs());
}
-namespace {
// Compare the two vectors of codecs ignoring the payload type.
-bool CodecsMatch(const std::vector<cricket::Codec>& codecs1,
- const std::vector<cricket::Codec>& codecs2,
+bool CodecsMatch(const std::vector<Codec>& codecs1,
+ const std::vector<Codec>& codecs2,
const webrtc::FieldTrialsView* field_trials) {
if (codecs1.size() != codecs2.size()) {
return false;
@@ -4824,14 +4761,14 @@
}
}
-static const AudioCodec kOfferAnswerCodecs[] = {
- cricket::CreateAudioCodec(0, "codec0", 16000, 1),
- cricket::CreateAudioCodec(1, "codec1", 8000, 1),
- cricket::CreateAudioCodec(2, "codec2", 8000, 1),
- cricket::CreateAudioCodec(3, "codec3", 8000, 1),
- cricket::CreateAudioCodec(4, "codec4", 8000, 2),
- cricket::CreateAudioCodec(5, "codec5", 32000, 1),
- cricket::CreateAudioCodec(6, "codec6", 48000, 1)};
+const AudioCodec kOfferAnswerCodecs[] = {
+ CreateAudioCodec(0, "codec0", 16000, 1),
+ CreateAudioCodec(1, "codec1", 8000, 1),
+ CreateAudioCodec(2, "codec2", 8000, 1),
+ CreateAudioCodec(3, "codec3", 8000, 1),
+ CreateAudioCodec(4, "codec4", 8000, 2),
+ CreateAudioCodec(5, "codec5", 32000, 1),
+ CreateAudioCodec(6, "codec6", 48000, 1)};
/* The codecs groups below are chosen as per the matrix below. The objective
* is to have different sets of codecs in the inputs, to get unique sets of
@@ -4852,18 +4789,18 @@
* 6 | x x x | x x x | x x x x x
*/
// Codecs used by offerer in the AudioCodecsAnswerTest
-static const int kOfferSendCodecs[] = {0, 1, 3, 5, 6};
-static const int kOfferRecvCodecs[] = {1, 2, 3, 4, 6};
+const int kOfferSendCodecs[] = {0, 1, 3, 5, 6};
+const int kOfferRecvCodecs[] = {1, 2, 3, 4, 6};
// Codecs used in the answerer in the AudioCodecsAnswerTest. The order is
// jumbled to catch the answer not following the order in the offer.
-static const int kAnswerSendCodecs[] = {6, 5, 2, 3, 4};
-static const int kAnswerRecvCodecs[] = {6, 5, 4, 1, 0};
+const int kAnswerSendCodecs[] = {6, 5, 2, 3, 4};
+const int kAnswerRecvCodecs[] = {6, 5, 4, 1, 0};
// The resulting sets of codecs in the answer in the AudioCodecsAnswerTest
-static const int kResultSend_RecvCodecs[] = {0, 1, 5, 6};
-static const int kResultRecv_SendCodecs[] = {2, 3, 4, 6};
-static const int kResultSendrecv_SendCodecs[] = {3, 6};
-static const int kResultSendrecv_RecvCodecs[] = {1, 6};
-static const int kResultSendrecv_SendrecvCodecs[] = {6};
+const int kResultSend_RecvCodecs[] = {0, 1, 5, 6};
+const int kResultRecv_SendCodecs[] = {2, 3, 4, 6};
+const int kResultSendrecv_SendCodecs[] = {3, 6};
+const int kResultSendrecv_RecvCodecs[] = {1, 6};
+const int kResultSendrecv_SendrecvCodecs[] = {6};
template <typename T, int IDXS>
std::vector<T> VectorFromIndices(const T* array, const int (&indices)[IDXS]) {
@@ -4990,10 +4927,7 @@
}
}
-} // namespace
-
-class AudioCodecsOfferTest
- : public ::testing::TestWithParam<RtpTransceiverDirection> {};
+using AudioCodecsOfferTest = testing::TestWithParam<RtpTransceiverDirection>;
TEST_P(AudioCodecsOfferTest, TestCodecsInOffer) {
TestAudioCodecsOffer(GetParam());
@@ -5001,31 +4935,30 @@
INSTANTIATE_TEST_SUITE_P(MediaSessionDescriptionFactoryTest,
AudioCodecsOfferTest,
- ::testing::Values(RtpTransceiverDirection::kSendOnly,
- RtpTransceiverDirection::kRecvOnly,
- RtpTransceiverDirection::kSendRecv,
- RtpTransceiverDirection::kInactive));
+ Values(RtpTransceiverDirection::kSendOnly,
+ RtpTransceiverDirection::kRecvOnly,
+ RtpTransceiverDirection::kSendRecv,
+ RtpTransceiverDirection::kInactive));
-class AudioCodecsAnswerTest
- : public ::testing::TestWithParam<::testing::tuple<RtpTransceiverDirection,
- RtpTransceiverDirection,
- bool>> {};
+using AudioCodecsAnswerTest = testing::TestWithParam<
+ std::tuple<RtpTransceiverDirection, RtpTransceiverDirection, bool>>;
TEST_P(AudioCodecsAnswerTest, TestCodecsInAnswer) {
- TestAudioCodecsAnswer(::testing::get<0>(GetParam()),
- ::testing::get<1>(GetParam()),
- ::testing::get<2>(GetParam()));
+ TestAudioCodecsAnswer(std::get<0>(GetParam()), std::get<1>(GetParam()),
+ std::get<2>(GetParam()));
}
-INSTANTIATE_TEST_SUITE_P(
- MediaSessionDescriptionFactoryTest,
- AudioCodecsAnswerTest,
- ::testing::Combine(::testing::Values(RtpTransceiverDirection::kSendOnly,
- RtpTransceiverDirection::kRecvOnly,
- RtpTransceiverDirection::kSendRecv,
- RtpTransceiverDirection::kInactive),
- ::testing::Values(RtpTransceiverDirection::kSendOnly,
- RtpTransceiverDirection::kRecvOnly,
- RtpTransceiverDirection::kSendRecv,
- RtpTransceiverDirection::kInactive),
- ::testing::Bool()));
+INSTANTIATE_TEST_SUITE_P(MediaSessionDescriptionFactoryTest,
+ AudioCodecsAnswerTest,
+ Combine(Values(RtpTransceiverDirection::kSendOnly,
+ RtpTransceiverDirection::kRecvOnly,
+ RtpTransceiverDirection::kSendRecv,
+ RtpTransceiverDirection::kInactive),
+ Values(RtpTransceiverDirection::kSendOnly,
+ RtpTransceiverDirection::kRecvOnly,
+ RtpTransceiverDirection::kSendRecv,
+ RtpTransceiverDirection::kInactive),
+ Bool()));
+
+} // namespace
+} // namespace cricket