Replace use of .name in test code with .mid()
Bug: webrtc:42233761 Change-Id: Iea64cc3d9831d59f4f937af6f779d99c276b3b8b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374664 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43782}
This commit is contained in:
parent
7a0bdb602c
commit
76c8f303a8
@ -3978,9 +3978,9 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestMIDsMatchesExistingOffer) {
|
||||
ASSERT_TRUE(audio_content);
|
||||
ASSERT_TRUE(video_content);
|
||||
ASSERT_TRUE(data_content);
|
||||
EXPECT_EQ("audio_modified", audio_content->name);
|
||||
EXPECT_EQ("video_modified", video_content->name);
|
||||
EXPECT_EQ("data_modified", data_content->name);
|
||||
EXPECT_EQ("audio_modified", audio_content->mid());
|
||||
EXPECT_EQ("video_modified", video_content->mid());
|
||||
EXPECT_EQ("data_modified", data_content->mid());
|
||||
}
|
||||
|
||||
// The following tests verify that the unified plan SDP is supported.
|
||||
@ -4215,8 +4215,8 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||
|
||||
ASSERT_TRUE(offer);
|
||||
ASSERT_EQ(2u, offer->contents().size());
|
||||
EXPECT_EQ("video", offer->contents()[0].name);
|
||||
EXPECT_EQ("audio", offer->contents()[1].name);
|
||||
EXPECT_EQ("video", offer->contents()[0].mid());
|
||||
EXPECT_EQ("audio", offer->contents()[1].mid());
|
||||
}
|
||||
|
||||
// Test that different media sections using the same codec have same payload
|
||||
|
||||
@ -114,9 +114,9 @@ class PeerConnectionWrapperForBundleTest : public PeerConnectionWrapper {
|
||||
for (size_t i = 0; i < desc->contents().size(); i++) {
|
||||
const auto& content = desc->contents()[i];
|
||||
if (content.media_description()->type() == media_type) {
|
||||
candidate->set_transport_name(content.name);
|
||||
candidate->set_transport_name(content.mid());
|
||||
std::unique_ptr<IceCandidateInterface> jsep_candidate =
|
||||
CreateIceCandidate(content.name, i, *candidate);
|
||||
CreateIceCandidate(content.mid(), i, *candidate);
|
||||
return pc()->AddIceCandidate(jsep_candidate.get());
|
||||
}
|
||||
}
|
||||
@ -878,8 +878,8 @@ TEST_P(PeerConnectionBundleTest, AddContentToBundleGroupInAnswerNotSupported) {
|
||||
auto callee = CreatePeerConnectionWithAudioVideo();
|
||||
|
||||
auto offer = caller->CreateOffer();
|
||||
std::string first_mid = offer->description()->contents()[0].name;
|
||||
std::string second_mid = offer->description()->contents()[1].name;
|
||||
const auto first_mid = offer->description()->contents()[0].mid();
|
||||
const auto second_mid = offer->description()->contents()[1].mid();
|
||||
|
||||
cricket::ContentGroup bundle_group(cricket::GROUP_TYPE_BUNDLE);
|
||||
bundle_group.AddContentName(first_mid);
|
||||
@ -928,7 +928,7 @@ TEST_P(PeerConnectionBundleTest, RemoveContentFromBundleGroup) {
|
||||
|
||||
EXPECT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal()));
|
||||
auto answer = callee->CreateAnswer();
|
||||
std::string second_mid = answer->description()->contents()[1].name;
|
||||
const auto second_mid = answer->description()->contents()[1].mid();
|
||||
|
||||
auto invalid_bundle_group =
|
||||
*answer->description()->GetGroupByName(cricket::GROUP_TYPE_BUNDLE);
|
||||
|
||||
@ -155,7 +155,7 @@ class PeerConnectionCryptoBaseTest : public ::testing::Test {
|
||||
cricket::SessionDescription* desc,
|
||||
cricket::ContentInfo* content) {
|
||||
RTC_DCHECK(content);
|
||||
auto* transport_info = desc->GetTransportInfoByName(content->name);
|
||||
auto* transport_info = desc->GetTransportInfoByName(content->mid());
|
||||
RTC_DCHECK(transport_info);
|
||||
return transport_info->description.connection_role;
|
||||
}
|
||||
@ -505,7 +505,7 @@ TEST_P(PeerConnectionCryptoTest, SessionErrorIfFingerprintInvalid) {
|
||||
ASSERT_TRUE(audio_content);
|
||||
auto* audio_transport_info =
|
||||
invalid_answer->description()->GetTransportInfoByName(
|
||||
audio_content->name);
|
||||
audio_content->mid());
|
||||
ASSERT_TRUE(audio_transport_info);
|
||||
audio_transport_info->description.identity_fingerprint =
|
||||
rtc::SSLFingerprint::CreateFromCertificate(*other_certificate);
|
||||
|
||||
@ -225,10 +225,10 @@ TEST_P(PeerConnectionDataChannelTest, SctpContentAndTransportNameSetCorrectly) {
|
||||
const auto& offer_contents = offer->description()->contents();
|
||||
ASSERT_EQ(cricket::MEDIA_TYPE_AUDIO,
|
||||
offer_contents[0].media_description()->type());
|
||||
std::string audio_mid = offer_contents[0].name;
|
||||
auto audio_mid = offer_contents[0].mid();
|
||||
ASSERT_EQ(cricket::MEDIA_TYPE_DATA,
|
||||
offer_contents[2].media_description()->type());
|
||||
std::string data_mid = offer_contents[2].name;
|
||||
auto data_mid = offer_contents[2].mid();
|
||||
|
||||
ASSERT_TRUE(
|
||||
caller->SetLocalDescription(CloneSessionDescription(offer.get())));
|
||||
@ -274,7 +274,7 @@ TEST_P(PeerConnectionDataChannelTest,
|
||||
ASSERT_TRUE(data_content);
|
||||
EXPECT_FALSE(data_content->rejected);
|
||||
EXPECT_TRUE(
|
||||
answer->description()->GetTransportInfoByName(data_content->name));
|
||||
answer->description()->GetTransportInfoByName(data_content->mid()));
|
||||
}
|
||||
|
||||
TEST_P(PeerConnectionDataChannelTest, SctpPortPropagatedFromSdpToTransport) {
|
||||
|
||||
@ -106,8 +106,8 @@ class PeerConnectionWrapperForIceTest : public PeerConnectionWrapper {
|
||||
const auto* desc = pc()->remote_description()->description();
|
||||
RTC_DCHECK(!desc->contents().empty());
|
||||
const auto& first_content = desc->contents()[0];
|
||||
candidate->set_transport_name(first_content.name);
|
||||
return CreateIceCandidate(first_content.name, -1, *candidate);
|
||||
candidate->set_transport_name(first_content.mid());
|
||||
return CreateIceCandidate(first_content.mid(), -1, *candidate);
|
||||
}
|
||||
|
||||
// Adds a new ICE candidate to the first transport.
|
||||
@ -233,7 +233,7 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
|
||||
const std::string& pwd) {
|
||||
auto* desc = sdesc->description();
|
||||
for (const auto& content : desc->contents()) {
|
||||
auto* transport_info = desc->GetTransportInfoByName(content.name);
|
||||
auto* transport_info = desc->GetTransportInfoByName(content.mid());
|
||||
transport_info->description.ice_ufrag = ufrag;
|
||||
transport_info->description.ice_pwd = pwd;
|
||||
}
|
||||
@ -244,7 +244,7 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
|
||||
const cricket::IceMode ice_mode) {
|
||||
auto* desc = sdesc->description();
|
||||
for (const auto& content : desc->contents()) {
|
||||
auto* transport_info = desc->GetTransportInfoByName(content.name);
|
||||
auto* transport_info = desc->GetTransportInfoByName(content.mid());
|
||||
transport_info->description.ice_mode = ice_mode;
|
||||
}
|
||||
}
|
||||
@ -254,7 +254,7 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
|
||||
auto* desc = sdesc->description();
|
||||
RTC_DCHECK(!desc->contents().empty());
|
||||
auto* transport_info =
|
||||
desc->GetTransportInfoByName(desc->contents()[0].name);
|
||||
desc->GetTransportInfoByName(desc->contents()[0].mid());
|
||||
RTC_DCHECK(transport_info);
|
||||
return &transport_info->description;
|
||||
}
|
||||
@ -264,7 +264,7 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
|
||||
auto* desc = sdesc->description();
|
||||
RTC_DCHECK(!desc->contents().empty());
|
||||
auto* transport_info =
|
||||
desc->GetTransportInfoByName(desc->contents()[0].name);
|
||||
desc->GetTransportInfoByName(desc->contents()[0].mid());
|
||||
RTC_DCHECK(transport_info);
|
||||
return &transport_info->description;
|
||||
}
|
||||
@ -297,7 +297,7 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
|
||||
const auto* desc = description->description();
|
||||
for (const auto& content_info : desc->contents()) {
|
||||
const auto* transport_info =
|
||||
desc->GetTransportInfoByName(content_info.name);
|
||||
desc->GetTransportInfoByName(content_info.mid());
|
||||
if (transport_info) {
|
||||
ice_credentials.push_back(
|
||||
std::make_pair(transport_info->description.ice_ufrag,
|
||||
@ -312,9 +312,9 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
|
||||
auto* desc = sdesc->description();
|
||||
RTC_DCHECK(!desc->contents().empty());
|
||||
const auto& first_content = desc->contents()[0];
|
||||
candidate->set_transport_name(first_content.name);
|
||||
candidate->set_transport_name(first_content.mid());
|
||||
std::unique_ptr<IceCandidateInterface> jsep_candidate =
|
||||
CreateIceCandidate(first_content.name, 0, *candidate);
|
||||
CreateIceCandidate(first_content.mid(), 0, *candidate);
|
||||
return sdesc->AddCandidate(jsep_candidate.get());
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ TEST_P(PeerConnectionIceTest, CannotAddCandidateWhenPeerConnectionClosed) {
|
||||
auto* audio_content = cricket::GetFirstAudioContent(
|
||||
caller->pc()->local_description()->description());
|
||||
std::unique_ptr<IceCandidateInterface> jsep_candidate =
|
||||
CreateIceCandidate(audio_content->name, 0, candidate);
|
||||
CreateIceCandidate(audio_content->mid(), 0, candidate);
|
||||
|
||||
caller->pc()->Close();
|
||||
|
||||
@ -592,7 +592,7 @@ TEST_P(PeerConnectionIceTest,
|
||||
auto* audio_content = cricket::GetFirstAudioContent(
|
||||
caller->pc()->local_description()->description());
|
||||
std::unique_ptr<IceCandidateInterface> ice_candidate =
|
||||
CreateIceCandidate(audio_content->name, 0, candidate);
|
||||
CreateIceCandidate(audio_content->mid(), 0, candidate);
|
||||
|
||||
ASSERT_TRUE(caller->pc()->AddIceCandidate(ice_candidate.get()));
|
||||
|
||||
@ -617,7 +617,7 @@ TEST_P(PeerConnectionIceTest,
|
||||
auto* audio_content = cricket::GetFirstAudioContent(
|
||||
caller->pc()->local_description()->description());
|
||||
std::unique_ptr<IceCandidateInterface> ice_candidate =
|
||||
CreateIceCandidate(audio_content->name, 0, candidate);
|
||||
CreateIceCandidate(audio_content->mid(), 0, candidate);
|
||||
EXPECT_TRUE(caller->pc()->AddIceCandidate(ice_candidate.get()));
|
||||
EXPECT_TRUE(caller->pc()->RemoveIceCandidates({candidate}));
|
||||
}
|
||||
@ -1573,7 +1573,7 @@ TEST_P(PeerConnectionIceTest, IceCredentialsCreateOffer) {
|
||||
|
||||
auto* desc = offer->description();
|
||||
for (const auto& content : desc->contents()) {
|
||||
auto* transport_info = desc->GetTransportInfoByName(content.name);
|
||||
auto* transport_info = desc->GetTransportInfoByName(content.mid());
|
||||
EXPECT_EQ(transport_info->description.ice_ufrag, credentials[0].ufrag);
|
||||
EXPECT_EQ(transport_info->description.ice_pwd, credentials[0].pwd);
|
||||
}
|
||||
@ -1594,7 +1594,7 @@ TEST_P(PeerConnectionIceTest, IceCredentialsCreateAnswer) {
|
||||
|
||||
auto* desc = answer->description();
|
||||
for (const auto& content : desc->contents()) {
|
||||
auto* transport_info = desc->GetTransportInfoByName(content.name);
|
||||
auto* transport_info = desc->GetTransportInfoByName(content.mid());
|
||||
EXPECT_EQ(transport_info->description.ice_ufrag, credentials[0].ufrag);
|
||||
EXPECT_EQ(transport_info->description.ice_pwd, credentials[0].pwd);
|
||||
}
|
||||
@ -1624,7 +1624,7 @@ TEST_P(PeerConnectionIceTest, PrefersMidOverMLineIndex) {
|
||||
auto* audio_content = cricket::GetFirstAudioContent(
|
||||
caller->pc()->local_description()->description());
|
||||
std::unique_ptr<IceCandidateInterface> ice_candidate =
|
||||
CreateIceCandidate(audio_content->name, 65535, candidate);
|
||||
CreateIceCandidate(audio_content->mid(), 65535, candidate);
|
||||
EXPECT_TRUE(caller->pc()->AddIceCandidate(ice_candidate.get()));
|
||||
EXPECT_TRUE(caller->pc()->RemoveIceCandidates({candidate}));
|
||||
}
|
||||
|
||||
@ -3584,7 +3584,7 @@ TEST_P(PeerConnectionInterfaceTest, CreateOfferWithIceRestart) {
|
||||
|
||||
std::unique_ptr<SessionDescriptionInterface> offer;
|
||||
CreateOfferWithOptionsAsLocalDescription(&offer, rtc_options);
|
||||
std::string mid = cricket::GetFirstAudioContent(offer->description())->name;
|
||||
auto mid = cricket::GetFirstAudioContent(offer->description())->mid();
|
||||
auto ufrag1 =
|
||||
offer->description()->GetTransportInfoByName(mid)->description.ice_ufrag;
|
||||
auto pwd1 =
|
||||
|
||||
@ -228,7 +228,7 @@ TEST_F(PeerConnectionJsepTest, MediaSectionsInInitialOfferHaveDifferentMids) {
|
||||
auto offer = caller->CreateOffer();
|
||||
auto contents = offer->description()->contents();
|
||||
ASSERT_EQ(2u, contents.size());
|
||||
EXPECT_NE(contents[0].name, contents[1].name);
|
||||
EXPECT_NE(contents[0].mid(), contents[1].mid());
|
||||
}
|
||||
|
||||
TEST_F(PeerConnectionJsepTest,
|
||||
@ -259,8 +259,8 @@ TEST_F(PeerConnectionJsepTest, SetLocalOfferSetsTransceiverMid) {
|
||||
auto video_transceiver = caller->AddTransceiver(cricket::MEDIA_TYPE_VIDEO);
|
||||
|
||||
auto offer = caller->CreateOffer();
|
||||
std::string audio_mid = offer->description()->contents()[0].name;
|
||||
std::string video_mid = offer->description()->contents()[1].name;
|
||||
auto audio_mid = offer->description()->contents()[0].mid();
|
||||
auto video_mid = offer->description()->contents()[1].mid();
|
||||
|
||||
ASSERT_TRUE(caller->SetLocalDescription(std::move(offer)));
|
||||
|
||||
@ -439,13 +439,13 @@ TEST_F(PeerConnectionJsepTest, CreateAnswerHasSameMidsAsOffer) {
|
||||
auto contents = answer->description()->contents();
|
||||
ASSERT_EQ(4u, contents.size());
|
||||
EXPECT_EQ(cricket::MEDIA_TYPE_VIDEO, contents[0].media_description()->type());
|
||||
EXPECT_EQ(first_transceiver->mid(), contents[0].name);
|
||||
EXPECT_EQ(first_transceiver->mid(), contents[0].mid());
|
||||
EXPECT_EQ(cricket::MEDIA_TYPE_AUDIO, contents[1].media_description()->type());
|
||||
EXPECT_EQ(second_transceiver->mid(), contents[1].name);
|
||||
EXPECT_EQ(second_transceiver->mid(), contents[1].mid());
|
||||
EXPECT_EQ(cricket::MEDIA_TYPE_VIDEO, contents[2].media_description()->type());
|
||||
EXPECT_EQ(third_transceiver->mid(), contents[2].name);
|
||||
EXPECT_EQ(third_transceiver->mid(), contents[2].mid());
|
||||
EXPECT_EQ(cricket::MEDIA_TYPE_DATA, contents[3].media_description()->type());
|
||||
EXPECT_EQ(offer_data->name, contents[3].name);
|
||||
EXPECT_EQ(offer_data->mid(), contents[3].mid());
|
||||
}
|
||||
|
||||
// Test that an answering media section is marked as rejected if the underlying
|
||||
@ -686,7 +686,7 @@ TEST_F(PeerConnectionJsepTest,
|
||||
callee->AddAudioTrack("audio2");
|
||||
auto offer = caller->CreateOffer();
|
||||
auto offer_contents = offer->description()->contents();
|
||||
std::string second_mid = offer_contents[0].name;
|
||||
auto second_mid = offer_contents[0].mid();
|
||||
ASSERT_EQ(1u, offer_contents.size());
|
||||
EXPECT_FALSE(offer_contents[0].rejected);
|
||||
EXPECT_NE(first_mid, second_mid);
|
||||
@ -707,7 +707,7 @@ TEST_F(PeerConnectionJsepTest,
|
||||
auto answer_contents = answer->description()->contents();
|
||||
ASSERT_EQ(1u, answer_contents.size());
|
||||
EXPECT_FALSE(answer_contents[0].rejected);
|
||||
EXPECT_EQ(second_mid, answer_contents[0].name);
|
||||
EXPECT_EQ(second_mid, answer_contents[0].mid());
|
||||
|
||||
// Finishing the negotiation shouldn't add or dissociate any transceivers.
|
||||
ASSERT_TRUE(
|
||||
@ -742,7 +742,7 @@ TEST_F(PeerConnectionJsepTest, CreateOfferRecyclesWhenOfferingTwice) {
|
||||
ASSERT_TRUE(caller->SetLocalDescription(std::move(offer)));
|
||||
ASSERT_EQ(1u, caller->pc()->GetTransceivers().size());
|
||||
EXPECT_FALSE(caller->pc()->GetTransceivers()[0]->stopped());
|
||||
std::string second_mid = offer_contents[0].name;
|
||||
auto second_mid = offer_contents[0].mid();
|
||||
|
||||
// Create another new offer and set the local description again without the
|
||||
// rest of any negotation ocurring.
|
||||
@ -751,7 +751,7 @@ TEST_F(PeerConnectionJsepTest, CreateOfferRecyclesWhenOfferingTwice) {
|
||||
ASSERT_EQ(1u, second_offer_contents.size());
|
||||
EXPECT_FALSE(second_offer_contents[0].rejected);
|
||||
// The mid shouldn't change.
|
||||
EXPECT_EQ(second_mid, second_offer_contents[0].name);
|
||||
EXPECT_EQ(second_mid, second_offer_contents[0].mid());
|
||||
|
||||
ASSERT_TRUE(caller->SetLocalDescription(std::move(second_offer)));
|
||||
// Make sure that the caller's transceivers are associated correctly.
|
||||
@ -793,7 +793,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalAndCurrentRemoteRejected) {
|
||||
|
||||
ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get()));
|
||||
|
||||
std::string first_mid = *first_transceiver->mid();
|
||||
auto first_mid = *first_transceiver->mid();
|
||||
first_transceiver->StopInternal();
|
||||
|
||||
ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get()));
|
||||
@ -807,7 +807,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalAndCurrentRemoteRejected) {
|
||||
ASSERT_EQ(1u, offer_contents.size());
|
||||
EXPECT_FALSE(offer_contents[0].rejected);
|
||||
EXPECT_EQ(second_type_, offer_contents[0].media_description()->type());
|
||||
std::string second_mid = offer_contents[0].name;
|
||||
auto second_mid = offer_contents[0].mid();
|
||||
EXPECT_NE(first_mid, second_mid);
|
||||
|
||||
// Setting the local offer will dissociate the previous transceiver and set
|
||||
@ -830,7 +830,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalAndCurrentRemoteRejected) {
|
||||
auto answer_contents = answer->description()->contents();
|
||||
ASSERT_EQ(1u, answer_contents.size());
|
||||
EXPECT_FALSE(answer_contents[0].rejected);
|
||||
EXPECT_EQ(second_mid, answer_contents[0].name);
|
||||
EXPECT_EQ(second_mid, answer_contents[0].mid());
|
||||
EXPECT_EQ(second_type_, answer_contents[0].media_description()->type());
|
||||
|
||||
// Setting the local answer should succeed.
|
||||
@ -870,7 +870,7 @@ TEST_P(RecycleMediaSectionTest, CurrentRemoteOnlyRejected) {
|
||||
ASSERT_EQ(1u, offer_contents.size());
|
||||
EXPECT_FALSE(offer_contents[0].rejected);
|
||||
EXPECT_EQ(second_type_, offer_contents[0].media_description()->type());
|
||||
std::string second_mid = offer_contents[0].name;
|
||||
auto second_mid = offer_contents[0].mid();
|
||||
EXPECT_NE(first_mid, second_mid);
|
||||
|
||||
// Setting the local offer will dissociate the previous transceiver and set
|
||||
@ -893,7 +893,7 @@ TEST_P(RecycleMediaSectionTest, CurrentRemoteOnlyRejected) {
|
||||
auto answer_contents = answer->description()->contents();
|
||||
ASSERT_EQ(1u, answer_contents.size());
|
||||
EXPECT_FALSE(answer_contents[0].rejected);
|
||||
EXPECT_EQ(second_mid, answer_contents[0].name);
|
||||
EXPECT_EQ(second_mid, answer_contents[0].mid());
|
||||
EXPECT_EQ(second_type_, answer_contents[0].media_description()->type());
|
||||
|
||||
// Setting the local answer should succeed.
|
||||
@ -933,7 +933,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalOnlyRejected) {
|
||||
ASSERT_EQ(1u, offer_contents.size());
|
||||
EXPECT_FALSE(offer_contents[0].rejected);
|
||||
EXPECT_EQ(second_type_, offer_contents[0].media_description()->type());
|
||||
std::string second_mid = offer_contents[0].name;
|
||||
auto second_mid = offer_contents[0].mid();
|
||||
EXPECT_NE(first_mid, second_mid);
|
||||
|
||||
// Setting the local offer will dissociate the previous transceiver and set
|
||||
@ -956,7 +956,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalOnlyRejected) {
|
||||
auto answer_contents = answer->description()->contents();
|
||||
ASSERT_EQ(1u, answer_contents.size());
|
||||
EXPECT_FALSE(answer_contents[0].rejected);
|
||||
EXPECT_EQ(second_mid, answer_contents[0].name);
|
||||
EXPECT_EQ(second_mid, answer_contents[0].mid());
|
||||
EXPECT_EQ(second_type_, answer_contents[0].media_description()->type());
|
||||
|
||||
// Setting the local answer should succeed.
|
||||
@ -979,7 +979,7 @@ TEST_P(RecycleMediaSectionTest, PendingLocalRejectedAndNoRemote) {
|
||||
|
||||
ASSERT_TRUE(caller->SetLocalDescription(caller->CreateOffer()));
|
||||
|
||||
std::string first_mid = *caller_first_transceiver->mid();
|
||||
auto first_mid = *caller_first_transceiver->mid();
|
||||
caller_first_transceiver->StopInternal();
|
||||
|
||||
// The reoffer will have a rejected m= section.
|
||||
@ -994,10 +994,10 @@ TEST_P(RecycleMediaSectionTest, PendingLocalRejectedAndNoRemote) {
|
||||
ASSERT_EQ(2u, reoffer_contents.size());
|
||||
EXPECT_TRUE(reoffer_contents[0].rejected);
|
||||
EXPECT_EQ(first_type_, reoffer_contents[0].media_description()->type());
|
||||
EXPECT_EQ(first_mid, reoffer_contents[0].name);
|
||||
EXPECT_EQ(first_mid, reoffer_contents[0].mid());
|
||||
EXPECT_FALSE(reoffer_contents[1].rejected);
|
||||
EXPECT_EQ(second_type_, reoffer_contents[1].media_description()->type());
|
||||
std::string second_mid = reoffer_contents[1].name;
|
||||
auto second_mid = reoffer_contents[1].mid();
|
||||
EXPECT_NE(first_mid, second_mid);
|
||||
|
||||
ASSERT_TRUE(caller->SetLocalDescription(std::move(reoffer)));
|
||||
@ -1017,7 +1017,7 @@ TEST_P(RecycleMediaSectionTest, PendingLocalRejectedAndNotRejectedRemote) {
|
||||
|
||||
ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get()));
|
||||
|
||||
std::string first_mid = *caller_first_transceiver->mid();
|
||||
auto first_mid = *caller_first_transceiver->mid();
|
||||
caller_first_transceiver->StopInternal();
|
||||
|
||||
// The reoffer will have a rejected m= section.
|
||||
@ -1032,10 +1032,10 @@ TEST_P(RecycleMediaSectionTest, PendingLocalRejectedAndNotRejectedRemote) {
|
||||
ASSERT_EQ(2u, reoffer_contents.size());
|
||||
EXPECT_TRUE(reoffer_contents[0].rejected);
|
||||
EXPECT_EQ(first_type_, reoffer_contents[0].media_description()->type());
|
||||
EXPECT_EQ(first_mid, reoffer_contents[0].name);
|
||||
EXPECT_EQ(first_mid, reoffer_contents[0].mid());
|
||||
EXPECT_FALSE(reoffer_contents[1].rejected);
|
||||
EXPECT_EQ(second_type_, reoffer_contents[1].media_description()->type());
|
||||
std::string second_mid = reoffer_contents[1].name;
|
||||
auto second_mid = reoffer_contents[1].mid();
|
||||
EXPECT_NE(first_mid, second_mid);
|
||||
|
||||
ASSERT_TRUE(caller->SetLocalDescription(std::move(reoffer)));
|
||||
@ -1072,10 +1072,10 @@ TEST_P(RecycleMediaSectionTest, PendingRemoteRejectedAndNoLocal) {
|
||||
ASSERT_EQ(2u, reoffer_contents.size());
|
||||
EXPECT_TRUE(reoffer_contents[0].rejected);
|
||||
EXPECT_EQ(first_type_, reoffer_contents[0].media_description()->type());
|
||||
EXPECT_EQ(first_mid, reoffer_contents[0].name);
|
||||
EXPECT_EQ(first_mid, reoffer_contents[0].mid());
|
||||
EXPECT_FALSE(reoffer_contents[1].rejected);
|
||||
EXPECT_EQ(second_type_, reoffer_contents[1].media_description()->type());
|
||||
std::string second_mid = reoffer_contents[1].name;
|
||||
auto second_mid = reoffer_contents[1].mid();
|
||||
EXPECT_NE(first_mid, second_mid);
|
||||
|
||||
// Note: Cannot actually set the reoffer since the callee is in the signaling
|
||||
@ -1109,10 +1109,10 @@ TEST_P(RecycleMediaSectionTest, PendingRemoteRejectedAndNotRejectedLocal) {
|
||||
ASSERT_EQ(2u, reoffer_contents.size());
|
||||
EXPECT_TRUE(reoffer_contents[0].rejected);
|
||||
EXPECT_EQ(first_type_, reoffer_contents[0].media_description()->type());
|
||||
EXPECT_EQ(first_mid, reoffer_contents[0].name);
|
||||
EXPECT_EQ(first_mid, reoffer_contents[0].mid());
|
||||
EXPECT_FALSE(reoffer_contents[1].rejected);
|
||||
EXPECT_EQ(second_type_, reoffer_contents[1].media_description()->type());
|
||||
std::string second_mid = reoffer_contents[1].name;
|
||||
auto second_mid = reoffer_contents[1].mid();
|
||||
EXPECT_NE(first_mid, second_mid);
|
||||
|
||||
// Note: Cannot actually set the reoffer since the callee is in the signaling
|
||||
@ -1188,11 +1188,11 @@ TEST_F(PeerConnectionJsepTest, AudioTrackAddedAfterDataSectionInReoffer) {
|
||||
// Tests for MID properties.
|
||||
|
||||
static void RenameSection(size_t mline_index,
|
||||
const std::string& new_mid,
|
||||
absl::string_view new_mid,
|
||||
SessionDescriptionInterface* sdesc) {
|
||||
cricket::SessionDescription* desc = sdesc->description();
|
||||
std::string old_mid = desc->contents()[mline_index].name;
|
||||
desc->contents()[mline_index].name = new_mid;
|
||||
std::string old_mid(desc->contents()[mline_index].mid());
|
||||
desc->contents()[mline_index].set_mid(new_mid);
|
||||
desc->transport_infos()[mline_index].content_name = new_mid;
|
||||
const cricket::ContentGroup* bundle =
|
||||
desc->GetGroupByName(cricket::GROUP_TYPE_BUNDLE);
|
||||
@ -1234,8 +1234,8 @@ TEST_F(PeerConnectionJsepTest, OfferAnswerWithChangedMids) {
|
||||
|
||||
auto answer = callee->CreateAnswer();
|
||||
auto answer_contents = answer->description()->contents();
|
||||
EXPECT_EQ(kFirstMid, answer_contents[0].name);
|
||||
EXPECT_EQ(kSecondMid, answer_contents[1].name);
|
||||
EXPECT_EQ(kFirstMid, answer_contents[0].mid());
|
||||
EXPECT_EQ(kSecondMid, answer_contents[1].mid());
|
||||
|
||||
ASSERT_TRUE(
|
||||
callee->SetLocalDescription(CloneSessionDescription(answer.get())));
|
||||
@ -1252,8 +1252,7 @@ TEST_F(PeerConnectionJsepTest, CreateOfferGeneratesUniqueMidIfAlreadyTaken) {
|
||||
pc->AddAudioTrack("a");
|
||||
pc->AddAudioTrack("b");
|
||||
auto default_offer = pc->CreateOffer();
|
||||
std::string default_second_mid =
|
||||
default_offer->description()->contents()[1].name;
|
||||
auto default_second_mid = default_offer->description()->contents()[1].mid();
|
||||
|
||||
// Now, do an offer/answer with one track which has the MID set to the default
|
||||
// second MID.
|
||||
@ -1274,8 +1273,8 @@ TEST_F(PeerConnectionJsepTest, CreateOfferGeneratesUniqueMidIfAlreadyTaken) {
|
||||
|
||||
auto reoffer = caller->CreateOffer();
|
||||
auto reoffer_contents = reoffer->description()->contents();
|
||||
EXPECT_EQ(default_second_mid, reoffer_contents[0].name);
|
||||
EXPECT_NE(reoffer_contents[0].name, reoffer_contents[1].name);
|
||||
EXPECT_EQ(default_second_mid, reoffer_contents[0].mid());
|
||||
EXPECT_NE(reoffer_contents[0].mid(), reoffer_contents[1].mid());
|
||||
}
|
||||
|
||||
// Test that if an audio or video section has the default data section MID, then
|
||||
@ -1286,8 +1285,7 @@ TEST_F(PeerConnectionJsepTest,
|
||||
auto pc = CreatePeerConnection();
|
||||
pc->CreateDataChannel("dc");
|
||||
auto default_offer = pc->CreateOffer();
|
||||
std::string default_data_mid =
|
||||
default_offer->description()->contents()[0].name;
|
||||
auto default_data_mid = default_offer->description()->contents()[0].mid();
|
||||
|
||||
// Now do an offer/answer with one audio track which has a MID set to the
|
||||
// default data MID.
|
||||
@ -1308,8 +1306,8 @@ TEST_F(PeerConnectionJsepTest,
|
||||
|
||||
auto reoffer = caller->CreateOffer();
|
||||
auto reoffer_contents = reoffer->description()->contents();
|
||||
EXPECT_EQ(default_data_mid, reoffer_contents[0].name);
|
||||
EXPECT_NE(reoffer_contents[0].name, reoffer_contents[1].name);
|
||||
EXPECT_EQ(default_data_mid, reoffer_contents[0].mid());
|
||||
EXPECT_NE(reoffer_contents[0].mid(), reoffer_contents[1].mid());
|
||||
}
|
||||
|
||||
// Test that a reoffer initiated by the callee adds a new track to the caller.
|
||||
@ -1683,15 +1681,15 @@ static void ClearMids(SessionDescriptionInterface* sdesc) {
|
||||
desc->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
|
||||
cricket::ContentInfo* audio_content = cricket::GetFirstAudioContent(desc);
|
||||
if (audio_content) {
|
||||
desc->GetTransportInfoByName(audio_content->name)->content_name = "";
|
||||
audio_content->name = "";
|
||||
desc->GetTransportInfoByName(audio_content->mid())->content_name = "";
|
||||
audio_content->set_mid("");
|
||||
RemoveRtpHeaderExtensionByUri(audio_content->media_description(),
|
||||
RtpExtension::kMidUri);
|
||||
}
|
||||
cricket::ContentInfo* video_content = cricket::GetFirstVideoContent(desc);
|
||||
if (video_content) {
|
||||
desc->GetTransportInfoByName(video_content->name)->content_name = "";
|
||||
video_content->name = "";
|
||||
desc->GetTransportInfoByName(video_content->mid())->content_name = "";
|
||||
video_content->set_mid("");
|
||||
RemoveRtpHeaderExtensionByUri(video_content->media_description(),
|
||||
RtpExtension::kMidUri);
|
||||
}
|
||||
|
||||
@ -1037,7 +1037,7 @@ TEST_P(PeerConnectionMediaInvalidMediaTest, FailToSetLocalAnswer) {
|
||||
void RemoveVideoContentAndUnbundle(cricket::SessionDescription* desc) {
|
||||
// Removing BUNDLE is easier than removing the content in there.
|
||||
desc->RemoveGroupByName("BUNDLE");
|
||||
auto content_name = cricket::GetFirstVideoContent(desc)->name;
|
||||
auto content_name = cricket::GetFirstVideoContent(desc)->mid();
|
||||
desc->RemoveContentByName(content_name);
|
||||
desc->RemoveTransportInfoByName(content_name);
|
||||
}
|
||||
@ -1046,9 +1046,9 @@ void RenameVideoContentAndUnbundle(cricket::SessionDescription* desc) {
|
||||
// Removing BUNDLE is easier than renaming the content in there.
|
||||
desc->RemoveGroupByName("BUNDLE");
|
||||
auto* video_content = cricket::GetFirstVideoContent(desc);
|
||||
auto* transport_info = desc->GetTransportInfoByName(video_content->name);
|
||||
video_content->name = "video_renamed";
|
||||
transport_info->content_name = video_content->name;
|
||||
auto* transport_info = desc->GetTransportInfoByName(video_content->mid());
|
||||
video_content->set_mid("video_renamed");
|
||||
transport_info->content_name = video_content->mid();
|
||||
}
|
||||
|
||||
void ReverseMediaContent(cricket::SessionDescription* desc) {
|
||||
@ -1057,7 +1057,7 @@ void ReverseMediaContent(cricket::SessionDescription* desc) {
|
||||
}
|
||||
|
||||
void ChangeMediaTypeAudioToVideo(cricket::SessionDescription* desc) {
|
||||
std::string audio_mid = cricket::GetFirstAudioContent(desc)->name;
|
||||
auto audio_mid = cricket::GetFirstAudioContent(desc)->mid();
|
||||
desc->RemoveContentByName(audio_mid);
|
||||
auto* video_content = cricket::GetFirstVideoContent(desc);
|
||||
desc->AddContent(audio_mid, video_content->type,
|
||||
@ -1137,8 +1137,8 @@ void RenameContent(cricket::SessionDescription* desc,
|
||||
const std::string& new_name) {
|
||||
auto* content = cricket::GetFirstMediaContent(desc, media_type);
|
||||
RTC_DCHECK(content);
|
||||
std::string old_name = content->name;
|
||||
content->name = new_name;
|
||||
std::string old_name(content->mid());
|
||||
content->set_mid(new_name);
|
||||
auto* transport = desc->GetTransportInfoByName(old_name);
|
||||
RTC_DCHECK(transport);
|
||||
transport->content_name = new_name;
|
||||
@ -1167,9 +1167,9 @@ TEST_P(PeerConnectionMediaTest, AnswerHasSameMidsAsOffer) {
|
||||
|
||||
auto answer = callee->CreateAnswer();
|
||||
EXPECT_EQ(kAudioMid,
|
||||
cricket::GetFirstAudioContent(answer->description())->name);
|
||||
cricket::GetFirstAudioContent(answer->description())->mid());
|
||||
EXPECT_EQ(kVideoMid,
|
||||
cricket::GetFirstVideoContent(answer->description())->name);
|
||||
cricket::GetFirstVideoContent(answer->description())->mid());
|
||||
}
|
||||
|
||||
// Test that if the callee creates a re-offer, the MIDs are the same as the
|
||||
@ -1189,9 +1189,9 @@ TEST_P(PeerConnectionMediaTest, ReOfferHasSameMidsAsFirstOffer) {
|
||||
|
||||
auto reoffer = callee->CreateOffer();
|
||||
EXPECT_EQ(kAudioMid,
|
||||
cricket::GetFirstAudioContent(reoffer->description())->name);
|
||||
cricket::GetFirstAudioContent(reoffer->description())->mid());
|
||||
EXPECT_EQ(kVideoMid,
|
||||
cricket::GetFirstVideoContent(reoffer->description())->name);
|
||||
cricket::GetFirstVideoContent(reoffer->description())->mid());
|
||||
}
|
||||
|
||||
// Test that SetRemoteDescription returns an error if there are two m= sections
|
||||
|
||||
@ -262,7 +262,7 @@ SdpMungingType DetermineSdpMungingType(
|
||||
}
|
||||
for (size_t i = 0; i < last_created_contents.size(); i++) {
|
||||
// TODO: crbug.com/40567530 - more checks are needed here.
|
||||
if (last_created_contents[i].name != contents_to_set[i].name) {
|
||||
if (last_created_contents[i].mid() != contents_to_set[i].mid()) {
|
||||
RTC_LOG(LS_WARNING) << "SDP munging: mid does not match "
|
||||
"last created description.";
|
||||
return SdpMungingType::kMid;
|
||||
|
||||
@ -1743,8 +1743,8 @@ TEST_F(SdpOfferAnswerMungingTest, RemoveContent) {
|
||||
auto offer = pc->CreateOffer();
|
||||
auto& contents = offer->description()->contents();
|
||||
ASSERT_EQ(contents.size(), 1u);
|
||||
std::string name = contents[0].name;
|
||||
EXPECT_TRUE(offer->description()->RemoveContentByName(contents[0].name));
|
||||
auto name = contents[0].mid();
|
||||
EXPECT_TRUE(offer->description()->RemoveContentByName(contents[0].mid()));
|
||||
std::string sdp;
|
||||
offer->ToString(&sdp);
|
||||
auto modified_offer = CreateSessionDescription(
|
||||
@ -1765,8 +1765,8 @@ TEST_F(SdpOfferAnswerMungingTest, Mid) {
|
||||
auto offer = pc->CreateOffer();
|
||||
auto& contents = offer->description()->contents();
|
||||
ASSERT_EQ(contents.size(), 1u);
|
||||
std::string name = contents[0].name;
|
||||
contents[0].name = "amungedmid";
|
||||
std::string name(contents[0].mid());
|
||||
contents[0].set_mid("amungedmid");
|
||||
|
||||
auto& transport_infos = offer->description()->transport_infos();
|
||||
ASSERT_EQ(transport_infos.size(), 1u);
|
||||
|
||||
@ -43,7 +43,7 @@ bool SdpContentsAll(SdpContentPredicate pred,
|
||||
const cricket::SessionDescription* desc) {
|
||||
RTC_DCHECK(desc);
|
||||
for (const auto& content : desc->contents()) {
|
||||
const auto* transport_info = desc->GetTransportInfoByName(content.name);
|
||||
const auto* transport_info = desc->GetTransportInfoByName(content.mid());
|
||||
if (!pred(&content, transport_info)) {
|
||||
return false;
|
||||
}
|
||||
@ -65,7 +65,7 @@ void SdpContentsForEach(SdpContentMutator fn,
|
||||
cricket::SessionDescription* desc) {
|
||||
RTC_DCHECK(desc);
|
||||
for (auto& content : desc->contents()) {
|
||||
auto* transport_info = desc->GetTransportInfoByName(content.name);
|
||||
auto* transport_info = desc->GetTransportInfoByName(content.mid());
|
||||
fn(&content, transport_info);
|
||||
}
|
||||
}
|
||||
|
||||
@ -933,7 +933,7 @@ std::string SdpSerialize(const JsepSessionDescription& jdesc) {
|
||||
for (const ContentInfo& content : desc->contents()) {
|
||||
std::vector<Candidate> candidates;
|
||||
GetCandidatesByMindex(jdesc, ++mline_index, &candidates);
|
||||
BuildMediaDescription(&content, desc->GetTransportInfoByName(content.name),
|
||||
BuildMediaDescription(&content, desc->GetTransportInfoByName(content.mid()),
|
||||
content.media_description()->type(), candidates,
|
||||
desc->msid_signaling(), &message);
|
||||
}
|
||||
@ -1554,7 +1554,7 @@ void BuildMediaDescription(const ContentInfo* content_info,
|
||||
// identification-tag = token
|
||||
// Use the content name as the mid identification-tag.
|
||||
InitAttrLine(kAttributeMid, &os);
|
||||
os << kSdpDelimiterColon << content_info->name;
|
||||
os << kSdpDelimiterColon << content_info->mid();
|
||||
AddLine(os.str(), message);
|
||||
|
||||
if (cricket::IsDtlsSctp(media_desc->protocol())) {
|
||||
|
||||
@ -76,6 +76,7 @@ using cricket::TransportInfo;
|
||||
using cricket::VideoContentDescription;
|
||||
using ::testing::ElementsAre;
|
||||
using ::testing::Field;
|
||||
using ::testing::Property;
|
||||
using webrtc::IceCandidateCollection;
|
||||
using webrtc::IceCandidateInterface;
|
||||
using webrtc::IceCandidateType;
|
||||
@ -1417,7 +1418,7 @@ class WebRtcSdpTest : public ::testing::Test {
|
||||
const cricket::ContentInfo& c1 = desc1.contents().at(i);
|
||||
const cricket::ContentInfo& c2 = desc2.contents().at(i);
|
||||
// ContentInfo properties.
|
||||
EXPECT_EQ(c1.name, c2.name);
|
||||
EXPECT_EQ(c1.mid(), c2.mid());
|
||||
EXPECT_EQ(c1.type, c2.type);
|
||||
EXPECT_EQ(c1.rejected, c2.rejected);
|
||||
EXPECT_EQ(c1.bundle_only, c2.bundle_only);
|
||||
@ -4738,8 +4739,8 @@ TEST_F(WebRtcSdpTest, ParseNoMid) {
|
||||
ASSERT_TRUE(webrtc::SdpDeserialize(sdp, &output, &error));
|
||||
|
||||
EXPECT_THAT(output.description()->contents(),
|
||||
ElementsAre(Field("name", &cricket::ContentInfo::name, ""),
|
||||
Field("name", &cricket::ContentInfo::name, "")));
|
||||
ElementsAre(Property("name", &cricket::ContentInfo::mid, ""),
|
||||
Property("name", &cricket::ContentInfo::mid, "")));
|
||||
}
|
||||
|
||||
TEST_F(WebRtcSdpTest, SerializeWithDefaultSctpProtocol) {
|
||||
@ -4843,8 +4844,8 @@ TEST_F(WebRtcSdpTest, DeserializeSdpWithUnsupportedMediaType) {
|
||||
EXPECT_TRUE(jdesc_output.description()->contents()[0].rejected);
|
||||
EXPECT_TRUE(jdesc_output.description()->contents()[1].rejected);
|
||||
|
||||
EXPECT_EQ(jdesc_output.description()->contents()[0].name, "bogusmid");
|
||||
EXPECT_EQ(jdesc_output.description()->contents()[1].name, "somethingmid");
|
||||
EXPECT_EQ(jdesc_output.description()->contents()[0].mid(), "bogusmid");
|
||||
EXPECT_EQ(jdesc_output.description()->contents()[1].mid(), "somethingmid");
|
||||
}
|
||||
|
||||
TEST_F(WebRtcSdpTest, MediaTypeProtocolMismatch) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user