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:
Tommi 2025-01-17 16:48:23 +01:00 committed by WebRTC LUCI CQ
parent 7a0bdb602c
commit 76c8f303a8
13 changed files with 100 additions and 101 deletions

View File

@ -3978,9 +3978,9 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestMIDsMatchesExistingOffer) {
ASSERT_TRUE(audio_content); ASSERT_TRUE(audio_content);
ASSERT_TRUE(video_content); ASSERT_TRUE(video_content);
ASSERT_TRUE(data_content); ASSERT_TRUE(data_content);
EXPECT_EQ("audio_modified", audio_content->name); EXPECT_EQ("audio_modified", audio_content->mid());
EXPECT_EQ("video_modified", video_content->name); EXPECT_EQ("video_modified", video_content->mid());
EXPECT_EQ("data_modified", data_content->name); EXPECT_EQ("data_modified", data_content->mid());
} }
// The following tests verify that the unified plan SDP is supported. // The following tests verify that the unified plan SDP is supported.
@ -4215,8 +4215,8 @@ TEST_F(MediaSessionDescriptionFactoryTest,
ASSERT_TRUE(offer); ASSERT_TRUE(offer);
ASSERT_EQ(2u, offer->contents().size()); ASSERT_EQ(2u, offer->contents().size());
EXPECT_EQ("video", offer->contents()[0].name); EXPECT_EQ("video", offer->contents()[0].mid());
EXPECT_EQ("audio", offer->contents()[1].name); EXPECT_EQ("audio", offer->contents()[1].mid());
} }
// Test that different media sections using the same codec have same payload // Test that different media sections using the same codec have same payload

View File

@ -114,9 +114,9 @@ class PeerConnectionWrapperForBundleTest : public PeerConnectionWrapper {
for (size_t i = 0; i < desc->contents().size(); i++) { for (size_t i = 0; i < desc->contents().size(); i++) {
const auto& content = desc->contents()[i]; const auto& content = desc->contents()[i];
if (content.media_description()->type() == media_type) { 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 = std::unique_ptr<IceCandidateInterface> jsep_candidate =
CreateIceCandidate(content.name, i, *candidate); CreateIceCandidate(content.mid(), i, *candidate);
return pc()->AddIceCandidate(jsep_candidate.get()); return pc()->AddIceCandidate(jsep_candidate.get());
} }
} }
@ -878,8 +878,8 @@ TEST_P(PeerConnectionBundleTest, AddContentToBundleGroupInAnswerNotSupported) {
auto callee = CreatePeerConnectionWithAudioVideo(); auto callee = CreatePeerConnectionWithAudioVideo();
auto offer = caller->CreateOffer(); auto offer = caller->CreateOffer();
std::string first_mid = offer->description()->contents()[0].name; const auto first_mid = offer->description()->contents()[0].mid();
std::string second_mid = offer->description()->contents()[1].name; const auto second_mid = offer->description()->contents()[1].mid();
cricket::ContentGroup bundle_group(cricket::GROUP_TYPE_BUNDLE); cricket::ContentGroup bundle_group(cricket::GROUP_TYPE_BUNDLE);
bundle_group.AddContentName(first_mid); bundle_group.AddContentName(first_mid);
@ -928,7 +928,7 @@ TEST_P(PeerConnectionBundleTest, RemoveContentFromBundleGroup) {
EXPECT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal())); EXPECT_TRUE(callee->SetRemoteDescription(caller->CreateOfferAndSetAsLocal()));
auto answer = callee->CreateAnswer(); 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 = auto invalid_bundle_group =
*answer->description()->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); *answer->description()->GetGroupByName(cricket::GROUP_TYPE_BUNDLE);

View File

@ -155,7 +155,7 @@ class PeerConnectionCryptoBaseTest : public ::testing::Test {
cricket::SessionDescription* desc, cricket::SessionDescription* desc,
cricket::ContentInfo* content) { cricket::ContentInfo* content) {
RTC_DCHECK(content); RTC_DCHECK(content);
auto* transport_info = desc->GetTransportInfoByName(content->name); auto* transport_info = desc->GetTransportInfoByName(content->mid());
RTC_DCHECK(transport_info); RTC_DCHECK(transport_info);
return transport_info->description.connection_role; return transport_info->description.connection_role;
} }
@ -505,7 +505,7 @@ TEST_P(PeerConnectionCryptoTest, SessionErrorIfFingerprintInvalid) {
ASSERT_TRUE(audio_content); ASSERT_TRUE(audio_content);
auto* audio_transport_info = auto* audio_transport_info =
invalid_answer->description()->GetTransportInfoByName( invalid_answer->description()->GetTransportInfoByName(
audio_content->name); audio_content->mid());
ASSERT_TRUE(audio_transport_info); ASSERT_TRUE(audio_transport_info);
audio_transport_info->description.identity_fingerprint = audio_transport_info->description.identity_fingerprint =
rtc::SSLFingerprint::CreateFromCertificate(*other_certificate); rtc::SSLFingerprint::CreateFromCertificate(*other_certificate);

View File

@ -225,10 +225,10 @@ TEST_P(PeerConnectionDataChannelTest, SctpContentAndTransportNameSetCorrectly) {
const auto& offer_contents = offer->description()->contents(); const auto& offer_contents = offer->description()->contents();
ASSERT_EQ(cricket::MEDIA_TYPE_AUDIO, ASSERT_EQ(cricket::MEDIA_TYPE_AUDIO,
offer_contents[0].media_description()->type()); 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, ASSERT_EQ(cricket::MEDIA_TYPE_DATA,
offer_contents[2].media_description()->type()); offer_contents[2].media_description()->type());
std::string data_mid = offer_contents[2].name; auto data_mid = offer_contents[2].mid();
ASSERT_TRUE( ASSERT_TRUE(
caller->SetLocalDescription(CloneSessionDescription(offer.get()))); caller->SetLocalDescription(CloneSessionDescription(offer.get())));
@ -274,7 +274,7 @@ TEST_P(PeerConnectionDataChannelTest,
ASSERT_TRUE(data_content); ASSERT_TRUE(data_content);
EXPECT_FALSE(data_content->rejected); EXPECT_FALSE(data_content->rejected);
EXPECT_TRUE( EXPECT_TRUE(
answer->description()->GetTransportInfoByName(data_content->name)); answer->description()->GetTransportInfoByName(data_content->mid()));
} }
TEST_P(PeerConnectionDataChannelTest, SctpPortPropagatedFromSdpToTransport) { TEST_P(PeerConnectionDataChannelTest, SctpPortPropagatedFromSdpToTransport) {

View File

@ -106,8 +106,8 @@ class PeerConnectionWrapperForIceTest : public PeerConnectionWrapper {
const auto* desc = pc()->remote_description()->description(); const auto* desc = pc()->remote_description()->description();
RTC_DCHECK(!desc->contents().empty()); RTC_DCHECK(!desc->contents().empty());
const auto& first_content = desc->contents()[0]; const auto& first_content = desc->contents()[0];
candidate->set_transport_name(first_content.name); candidate->set_transport_name(first_content.mid());
return CreateIceCandidate(first_content.name, -1, *candidate); return CreateIceCandidate(first_content.mid(), -1, *candidate);
} }
// Adds a new ICE candidate to the first transport. // Adds a new ICE candidate to the first transport.
@ -233,7 +233,7 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
const std::string& pwd) { const std::string& pwd) {
auto* desc = sdesc->description(); auto* desc = sdesc->description();
for (const auto& content : desc->contents()) { 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_ufrag = ufrag;
transport_info->description.ice_pwd = pwd; transport_info->description.ice_pwd = pwd;
} }
@ -244,7 +244,7 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
const cricket::IceMode ice_mode) { const cricket::IceMode ice_mode) {
auto* desc = sdesc->description(); auto* desc = sdesc->description();
for (const auto& content : desc->contents()) { 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; transport_info->description.ice_mode = ice_mode;
} }
} }
@ -254,7 +254,7 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
auto* desc = sdesc->description(); auto* desc = sdesc->description();
RTC_DCHECK(!desc->contents().empty()); RTC_DCHECK(!desc->contents().empty());
auto* transport_info = auto* transport_info =
desc->GetTransportInfoByName(desc->contents()[0].name); desc->GetTransportInfoByName(desc->contents()[0].mid());
RTC_DCHECK(transport_info); RTC_DCHECK(transport_info);
return &transport_info->description; return &transport_info->description;
} }
@ -264,7 +264,7 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
auto* desc = sdesc->description(); auto* desc = sdesc->description();
RTC_DCHECK(!desc->contents().empty()); RTC_DCHECK(!desc->contents().empty());
auto* transport_info = auto* transport_info =
desc->GetTransportInfoByName(desc->contents()[0].name); desc->GetTransportInfoByName(desc->contents()[0].mid());
RTC_DCHECK(transport_info); RTC_DCHECK(transport_info);
return &transport_info->description; return &transport_info->description;
} }
@ -297,7 +297,7 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
const auto* desc = description->description(); const auto* desc = description->description();
for (const auto& content_info : desc->contents()) { for (const auto& content_info : desc->contents()) {
const auto* transport_info = const auto* transport_info =
desc->GetTransportInfoByName(content_info.name); desc->GetTransportInfoByName(content_info.mid());
if (transport_info) { if (transport_info) {
ice_credentials.push_back( ice_credentials.push_back(
std::make_pair(transport_info->description.ice_ufrag, std::make_pair(transport_info->description.ice_ufrag,
@ -312,9 +312,9 @@ class PeerConnectionIceBaseTest : public ::testing::Test {
auto* desc = sdesc->description(); auto* desc = sdesc->description();
RTC_DCHECK(!desc->contents().empty()); RTC_DCHECK(!desc->contents().empty());
const auto& first_content = desc->contents()[0]; 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 = std::unique_ptr<IceCandidateInterface> jsep_candidate =
CreateIceCandidate(first_content.name, 0, *candidate); CreateIceCandidate(first_content.mid(), 0, *candidate);
return sdesc->AddCandidate(jsep_candidate.get()); return sdesc->AddCandidate(jsep_candidate.get());
} }
@ -538,7 +538,7 @@ TEST_P(PeerConnectionIceTest, CannotAddCandidateWhenPeerConnectionClosed) {
auto* audio_content = cricket::GetFirstAudioContent( auto* audio_content = cricket::GetFirstAudioContent(
caller->pc()->local_description()->description()); caller->pc()->local_description()->description());
std::unique_ptr<IceCandidateInterface> jsep_candidate = std::unique_ptr<IceCandidateInterface> jsep_candidate =
CreateIceCandidate(audio_content->name, 0, candidate); CreateIceCandidate(audio_content->mid(), 0, candidate);
caller->pc()->Close(); caller->pc()->Close();
@ -592,7 +592,7 @@ TEST_P(PeerConnectionIceTest,
auto* audio_content = cricket::GetFirstAudioContent( auto* audio_content = cricket::GetFirstAudioContent(
caller->pc()->local_description()->description()); caller->pc()->local_description()->description());
std::unique_ptr<IceCandidateInterface> ice_candidate = 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())); ASSERT_TRUE(caller->pc()->AddIceCandidate(ice_candidate.get()));
@ -617,7 +617,7 @@ TEST_P(PeerConnectionIceTest,
auto* audio_content = cricket::GetFirstAudioContent( auto* audio_content = cricket::GetFirstAudioContent(
caller->pc()->local_description()->description()); caller->pc()->local_description()->description());
std::unique_ptr<IceCandidateInterface> ice_candidate = 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()->AddIceCandidate(ice_candidate.get()));
EXPECT_TRUE(caller->pc()->RemoveIceCandidates({candidate})); EXPECT_TRUE(caller->pc()->RemoveIceCandidates({candidate}));
} }
@ -1573,7 +1573,7 @@ TEST_P(PeerConnectionIceTest, IceCredentialsCreateOffer) {
auto* desc = offer->description(); auto* desc = offer->description();
for (const auto& content : desc->contents()) { 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_ufrag, credentials[0].ufrag);
EXPECT_EQ(transport_info->description.ice_pwd, credentials[0].pwd); EXPECT_EQ(transport_info->description.ice_pwd, credentials[0].pwd);
} }
@ -1594,7 +1594,7 @@ TEST_P(PeerConnectionIceTest, IceCredentialsCreateAnswer) {
auto* desc = answer->description(); auto* desc = answer->description();
for (const auto& content : desc->contents()) { 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_ufrag, credentials[0].ufrag);
EXPECT_EQ(transport_info->description.ice_pwd, credentials[0].pwd); EXPECT_EQ(transport_info->description.ice_pwd, credentials[0].pwd);
} }
@ -1624,7 +1624,7 @@ TEST_P(PeerConnectionIceTest, PrefersMidOverMLineIndex) {
auto* audio_content = cricket::GetFirstAudioContent( auto* audio_content = cricket::GetFirstAudioContent(
caller->pc()->local_description()->description()); caller->pc()->local_description()->description());
std::unique_ptr<IceCandidateInterface> ice_candidate = 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()->AddIceCandidate(ice_candidate.get()));
EXPECT_TRUE(caller->pc()->RemoveIceCandidates({candidate})); EXPECT_TRUE(caller->pc()->RemoveIceCandidates({candidate}));
} }

View File

@ -3584,7 +3584,7 @@ TEST_P(PeerConnectionInterfaceTest, CreateOfferWithIceRestart) {
std::unique_ptr<SessionDescriptionInterface> offer; std::unique_ptr<SessionDescriptionInterface> offer;
CreateOfferWithOptionsAsLocalDescription(&offer, rtc_options); CreateOfferWithOptionsAsLocalDescription(&offer, rtc_options);
std::string mid = cricket::GetFirstAudioContent(offer->description())->name; auto mid = cricket::GetFirstAudioContent(offer->description())->mid();
auto ufrag1 = auto ufrag1 =
offer->description()->GetTransportInfoByName(mid)->description.ice_ufrag; offer->description()->GetTransportInfoByName(mid)->description.ice_ufrag;
auto pwd1 = auto pwd1 =

View File

@ -228,7 +228,7 @@ TEST_F(PeerConnectionJsepTest, MediaSectionsInInitialOfferHaveDifferentMids) {
auto offer = caller->CreateOffer(); auto offer = caller->CreateOffer();
auto contents = offer->description()->contents(); auto contents = offer->description()->contents();
ASSERT_EQ(2u, contents.size()); ASSERT_EQ(2u, contents.size());
EXPECT_NE(contents[0].name, contents[1].name); EXPECT_NE(contents[0].mid(), contents[1].mid());
} }
TEST_F(PeerConnectionJsepTest, TEST_F(PeerConnectionJsepTest,
@ -259,8 +259,8 @@ TEST_F(PeerConnectionJsepTest, SetLocalOfferSetsTransceiverMid) {
auto video_transceiver = caller->AddTransceiver(cricket::MEDIA_TYPE_VIDEO); auto video_transceiver = caller->AddTransceiver(cricket::MEDIA_TYPE_VIDEO);
auto offer = caller->CreateOffer(); auto offer = caller->CreateOffer();
std::string audio_mid = offer->description()->contents()[0].name; auto audio_mid = offer->description()->contents()[0].mid();
std::string video_mid = offer->description()->contents()[1].name; auto video_mid = offer->description()->contents()[1].mid();
ASSERT_TRUE(caller->SetLocalDescription(std::move(offer))); ASSERT_TRUE(caller->SetLocalDescription(std::move(offer)));
@ -439,13 +439,13 @@ TEST_F(PeerConnectionJsepTest, CreateAnswerHasSameMidsAsOffer) {
auto contents = answer->description()->contents(); auto contents = answer->description()->contents();
ASSERT_EQ(4u, contents.size()); ASSERT_EQ(4u, contents.size());
EXPECT_EQ(cricket::MEDIA_TYPE_VIDEO, contents[0].media_description()->type()); 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(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(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(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 // Test that an answering media section is marked as rejected if the underlying
@ -686,7 +686,7 @@ TEST_F(PeerConnectionJsepTest,
callee->AddAudioTrack("audio2"); callee->AddAudioTrack("audio2");
auto offer = caller->CreateOffer(); auto offer = caller->CreateOffer();
auto offer_contents = offer->description()->contents(); 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()); ASSERT_EQ(1u, offer_contents.size());
EXPECT_FALSE(offer_contents[0].rejected); EXPECT_FALSE(offer_contents[0].rejected);
EXPECT_NE(first_mid, second_mid); EXPECT_NE(first_mid, second_mid);
@ -707,7 +707,7 @@ TEST_F(PeerConnectionJsepTest,
auto answer_contents = answer->description()->contents(); auto answer_contents = answer->description()->contents();
ASSERT_EQ(1u, answer_contents.size()); ASSERT_EQ(1u, answer_contents.size());
EXPECT_FALSE(answer_contents[0].rejected); 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. // Finishing the negotiation shouldn't add or dissociate any transceivers.
ASSERT_TRUE( ASSERT_TRUE(
@ -742,7 +742,7 @@ TEST_F(PeerConnectionJsepTest, CreateOfferRecyclesWhenOfferingTwice) {
ASSERT_TRUE(caller->SetLocalDescription(std::move(offer))); ASSERT_TRUE(caller->SetLocalDescription(std::move(offer)));
ASSERT_EQ(1u, caller->pc()->GetTransceivers().size()); ASSERT_EQ(1u, caller->pc()->GetTransceivers().size());
EXPECT_FALSE(caller->pc()->GetTransceivers()[0]->stopped()); 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 // Create another new offer and set the local description again without the
// rest of any negotation ocurring. // rest of any negotation ocurring.
@ -751,7 +751,7 @@ TEST_F(PeerConnectionJsepTest, CreateOfferRecyclesWhenOfferingTwice) {
ASSERT_EQ(1u, second_offer_contents.size()); ASSERT_EQ(1u, second_offer_contents.size());
EXPECT_FALSE(second_offer_contents[0].rejected); EXPECT_FALSE(second_offer_contents[0].rejected);
// The mid shouldn't change. // 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))); ASSERT_TRUE(caller->SetLocalDescription(std::move(second_offer)));
// Make sure that the caller's transceivers are associated correctly. // Make sure that the caller's transceivers are associated correctly.
@ -793,7 +793,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalAndCurrentRemoteRejected) {
ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get()));
std::string first_mid = *first_transceiver->mid(); auto first_mid = *first_transceiver->mid();
first_transceiver->StopInternal(); first_transceiver->StopInternal();
ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get()));
@ -807,7 +807,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalAndCurrentRemoteRejected) {
ASSERT_EQ(1u, offer_contents.size()); ASSERT_EQ(1u, offer_contents.size());
EXPECT_FALSE(offer_contents[0].rejected); EXPECT_FALSE(offer_contents[0].rejected);
EXPECT_EQ(second_type_, offer_contents[0].media_description()->type()); 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); EXPECT_NE(first_mid, second_mid);
// Setting the local offer will dissociate the previous transceiver and set // 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(); auto answer_contents = answer->description()->contents();
ASSERT_EQ(1u, answer_contents.size()); ASSERT_EQ(1u, answer_contents.size());
EXPECT_FALSE(answer_contents[0].rejected); 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()); EXPECT_EQ(second_type_, answer_contents[0].media_description()->type());
// Setting the local answer should succeed. // Setting the local answer should succeed.
@ -870,7 +870,7 @@ TEST_P(RecycleMediaSectionTest, CurrentRemoteOnlyRejected) {
ASSERT_EQ(1u, offer_contents.size()); ASSERT_EQ(1u, offer_contents.size());
EXPECT_FALSE(offer_contents[0].rejected); EXPECT_FALSE(offer_contents[0].rejected);
EXPECT_EQ(second_type_, offer_contents[0].media_description()->type()); 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); EXPECT_NE(first_mid, second_mid);
// Setting the local offer will dissociate the previous transceiver and set // 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(); auto answer_contents = answer->description()->contents();
ASSERT_EQ(1u, answer_contents.size()); ASSERT_EQ(1u, answer_contents.size());
EXPECT_FALSE(answer_contents[0].rejected); 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()); EXPECT_EQ(second_type_, answer_contents[0].media_description()->type());
// Setting the local answer should succeed. // Setting the local answer should succeed.
@ -933,7 +933,7 @@ TEST_P(RecycleMediaSectionTest, CurrentLocalOnlyRejected) {
ASSERT_EQ(1u, offer_contents.size()); ASSERT_EQ(1u, offer_contents.size());
EXPECT_FALSE(offer_contents[0].rejected); EXPECT_FALSE(offer_contents[0].rejected);
EXPECT_EQ(second_type_, offer_contents[0].media_description()->type()); 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); EXPECT_NE(first_mid, second_mid);
// Setting the local offer will dissociate the previous transceiver and set // 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(); auto answer_contents = answer->description()->contents();
ASSERT_EQ(1u, answer_contents.size()); ASSERT_EQ(1u, answer_contents.size());
EXPECT_FALSE(answer_contents[0].rejected); 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()); EXPECT_EQ(second_type_, answer_contents[0].media_description()->type());
// Setting the local answer should succeed. // Setting the local answer should succeed.
@ -979,7 +979,7 @@ TEST_P(RecycleMediaSectionTest, PendingLocalRejectedAndNoRemote) {
ASSERT_TRUE(caller->SetLocalDescription(caller->CreateOffer())); 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(); caller_first_transceiver->StopInternal();
// The reoffer will have a rejected m= section. // The reoffer will have a rejected m= section.
@ -994,10 +994,10 @@ TEST_P(RecycleMediaSectionTest, PendingLocalRejectedAndNoRemote) {
ASSERT_EQ(2u, reoffer_contents.size()); ASSERT_EQ(2u, reoffer_contents.size());
EXPECT_TRUE(reoffer_contents[0].rejected); EXPECT_TRUE(reoffer_contents[0].rejected);
EXPECT_EQ(first_type_, reoffer_contents[0].media_description()->type()); 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_FALSE(reoffer_contents[1].rejected);
EXPECT_EQ(second_type_, reoffer_contents[1].media_description()->type()); 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); EXPECT_NE(first_mid, second_mid);
ASSERT_TRUE(caller->SetLocalDescription(std::move(reoffer))); ASSERT_TRUE(caller->SetLocalDescription(std::move(reoffer)));
@ -1017,7 +1017,7 @@ TEST_P(RecycleMediaSectionTest, PendingLocalRejectedAndNotRejectedRemote) {
ASSERT_TRUE(caller->ExchangeOfferAnswerWith(callee.get())); 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(); caller_first_transceiver->StopInternal();
// The reoffer will have a rejected m= section. // The reoffer will have a rejected m= section.
@ -1032,10 +1032,10 @@ TEST_P(RecycleMediaSectionTest, PendingLocalRejectedAndNotRejectedRemote) {
ASSERT_EQ(2u, reoffer_contents.size()); ASSERT_EQ(2u, reoffer_contents.size());
EXPECT_TRUE(reoffer_contents[0].rejected); EXPECT_TRUE(reoffer_contents[0].rejected);
EXPECT_EQ(first_type_, reoffer_contents[0].media_description()->type()); 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_FALSE(reoffer_contents[1].rejected);
EXPECT_EQ(second_type_, reoffer_contents[1].media_description()->type()); 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); EXPECT_NE(first_mid, second_mid);
ASSERT_TRUE(caller->SetLocalDescription(std::move(reoffer))); ASSERT_TRUE(caller->SetLocalDescription(std::move(reoffer)));
@ -1072,10 +1072,10 @@ TEST_P(RecycleMediaSectionTest, PendingRemoteRejectedAndNoLocal) {
ASSERT_EQ(2u, reoffer_contents.size()); ASSERT_EQ(2u, reoffer_contents.size());
EXPECT_TRUE(reoffer_contents[0].rejected); EXPECT_TRUE(reoffer_contents[0].rejected);
EXPECT_EQ(first_type_, reoffer_contents[0].media_description()->type()); 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_FALSE(reoffer_contents[1].rejected);
EXPECT_EQ(second_type_, reoffer_contents[1].media_description()->type()); 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); EXPECT_NE(first_mid, second_mid);
// Note: Cannot actually set the reoffer since the callee is in the signaling // 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()); ASSERT_EQ(2u, reoffer_contents.size());
EXPECT_TRUE(reoffer_contents[0].rejected); EXPECT_TRUE(reoffer_contents[0].rejected);
EXPECT_EQ(first_type_, reoffer_contents[0].media_description()->type()); 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_FALSE(reoffer_contents[1].rejected);
EXPECT_EQ(second_type_, reoffer_contents[1].media_description()->type()); 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); EXPECT_NE(first_mid, second_mid);
// Note: Cannot actually set the reoffer since the callee is in the signaling // 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. // Tests for MID properties.
static void RenameSection(size_t mline_index, static void RenameSection(size_t mline_index,
const std::string& new_mid, absl::string_view new_mid,
SessionDescriptionInterface* sdesc) { SessionDescriptionInterface* sdesc) {
cricket::SessionDescription* desc = sdesc->description(); cricket::SessionDescription* desc = sdesc->description();
std::string old_mid = desc->contents()[mline_index].name; std::string old_mid(desc->contents()[mline_index].mid());
desc->contents()[mline_index].name = new_mid; desc->contents()[mline_index].set_mid(new_mid);
desc->transport_infos()[mline_index].content_name = new_mid; desc->transport_infos()[mline_index].content_name = new_mid;
const cricket::ContentGroup* bundle = const cricket::ContentGroup* bundle =
desc->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); desc->GetGroupByName(cricket::GROUP_TYPE_BUNDLE);
@ -1234,8 +1234,8 @@ TEST_F(PeerConnectionJsepTest, OfferAnswerWithChangedMids) {
auto answer = callee->CreateAnswer(); auto answer = callee->CreateAnswer();
auto answer_contents = answer->description()->contents(); auto answer_contents = answer->description()->contents();
EXPECT_EQ(kFirstMid, answer_contents[0].name); EXPECT_EQ(kFirstMid, answer_contents[0].mid());
EXPECT_EQ(kSecondMid, answer_contents[1].name); EXPECT_EQ(kSecondMid, answer_contents[1].mid());
ASSERT_TRUE( ASSERT_TRUE(
callee->SetLocalDescription(CloneSessionDescription(answer.get()))); callee->SetLocalDescription(CloneSessionDescription(answer.get())));
@ -1252,8 +1252,7 @@ TEST_F(PeerConnectionJsepTest, CreateOfferGeneratesUniqueMidIfAlreadyTaken) {
pc->AddAudioTrack("a"); pc->AddAudioTrack("a");
pc->AddAudioTrack("b"); pc->AddAudioTrack("b");
auto default_offer = pc->CreateOffer(); auto default_offer = pc->CreateOffer();
std::string default_second_mid = auto default_second_mid = default_offer->description()->contents()[1].mid();
default_offer->description()->contents()[1].name;
// Now, do an offer/answer with one track which has the MID set to the default // Now, do an offer/answer with one track which has the MID set to the default
// second MID. // second MID.
@ -1274,8 +1273,8 @@ TEST_F(PeerConnectionJsepTest, CreateOfferGeneratesUniqueMidIfAlreadyTaken) {
auto reoffer = caller->CreateOffer(); auto reoffer = caller->CreateOffer();
auto reoffer_contents = reoffer->description()->contents(); auto reoffer_contents = reoffer->description()->contents();
EXPECT_EQ(default_second_mid, reoffer_contents[0].name); EXPECT_EQ(default_second_mid, reoffer_contents[0].mid());
EXPECT_NE(reoffer_contents[0].name, reoffer_contents[1].name); 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 // 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(); auto pc = CreatePeerConnection();
pc->CreateDataChannel("dc"); pc->CreateDataChannel("dc");
auto default_offer = pc->CreateOffer(); auto default_offer = pc->CreateOffer();
std::string default_data_mid = auto default_data_mid = default_offer->description()->contents()[0].mid();
default_offer->description()->contents()[0].name;
// Now do an offer/answer with one audio track which has a MID set to the // Now do an offer/answer with one audio track which has a MID set to the
// default data MID. // default data MID.
@ -1308,8 +1306,8 @@ TEST_F(PeerConnectionJsepTest,
auto reoffer = caller->CreateOffer(); auto reoffer = caller->CreateOffer();
auto reoffer_contents = reoffer->description()->contents(); auto reoffer_contents = reoffer->description()->contents();
EXPECT_EQ(default_data_mid, reoffer_contents[0].name); EXPECT_EQ(default_data_mid, reoffer_contents[0].mid());
EXPECT_NE(reoffer_contents[0].name, reoffer_contents[1].name); 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. // 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); desc->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
cricket::ContentInfo* audio_content = cricket::GetFirstAudioContent(desc); cricket::ContentInfo* audio_content = cricket::GetFirstAudioContent(desc);
if (audio_content) { if (audio_content) {
desc->GetTransportInfoByName(audio_content->name)->content_name = ""; desc->GetTransportInfoByName(audio_content->mid())->content_name = "";
audio_content->name = ""; audio_content->set_mid("");
RemoveRtpHeaderExtensionByUri(audio_content->media_description(), RemoveRtpHeaderExtensionByUri(audio_content->media_description(),
RtpExtension::kMidUri); RtpExtension::kMidUri);
} }
cricket::ContentInfo* video_content = cricket::GetFirstVideoContent(desc); cricket::ContentInfo* video_content = cricket::GetFirstVideoContent(desc);
if (video_content) { if (video_content) {
desc->GetTransportInfoByName(video_content->name)->content_name = ""; desc->GetTransportInfoByName(video_content->mid())->content_name = "";
video_content->name = ""; video_content->set_mid("");
RemoveRtpHeaderExtensionByUri(video_content->media_description(), RemoveRtpHeaderExtensionByUri(video_content->media_description(),
RtpExtension::kMidUri); RtpExtension::kMidUri);
} }

View File

@ -1037,7 +1037,7 @@ TEST_P(PeerConnectionMediaInvalidMediaTest, FailToSetLocalAnswer) {
void RemoveVideoContentAndUnbundle(cricket::SessionDescription* desc) { void RemoveVideoContentAndUnbundle(cricket::SessionDescription* desc) {
// Removing BUNDLE is easier than removing the content in there. // Removing BUNDLE is easier than removing the content in there.
desc->RemoveGroupByName("BUNDLE"); desc->RemoveGroupByName("BUNDLE");
auto content_name = cricket::GetFirstVideoContent(desc)->name; auto content_name = cricket::GetFirstVideoContent(desc)->mid();
desc->RemoveContentByName(content_name); desc->RemoveContentByName(content_name);
desc->RemoveTransportInfoByName(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. // Removing BUNDLE is easier than renaming the content in there.
desc->RemoveGroupByName("BUNDLE"); desc->RemoveGroupByName("BUNDLE");
auto* video_content = cricket::GetFirstVideoContent(desc); auto* video_content = cricket::GetFirstVideoContent(desc);
auto* transport_info = desc->GetTransportInfoByName(video_content->name); auto* transport_info = desc->GetTransportInfoByName(video_content->mid());
video_content->name = "video_renamed"; video_content->set_mid("video_renamed");
transport_info->content_name = video_content->name; transport_info->content_name = video_content->mid();
} }
void ReverseMediaContent(cricket::SessionDescription* desc) { void ReverseMediaContent(cricket::SessionDescription* desc) {
@ -1057,7 +1057,7 @@ void ReverseMediaContent(cricket::SessionDescription* desc) {
} }
void ChangeMediaTypeAudioToVideo(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); desc->RemoveContentByName(audio_mid);
auto* video_content = cricket::GetFirstVideoContent(desc); auto* video_content = cricket::GetFirstVideoContent(desc);
desc->AddContent(audio_mid, video_content->type, desc->AddContent(audio_mid, video_content->type,
@ -1137,8 +1137,8 @@ void RenameContent(cricket::SessionDescription* desc,
const std::string& new_name) { const std::string& new_name) {
auto* content = cricket::GetFirstMediaContent(desc, media_type); auto* content = cricket::GetFirstMediaContent(desc, media_type);
RTC_DCHECK(content); RTC_DCHECK(content);
std::string old_name = content->name; std::string old_name(content->mid());
content->name = new_name; content->set_mid(new_name);
auto* transport = desc->GetTransportInfoByName(old_name); auto* transport = desc->GetTransportInfoByName(old_name);
RTC_DCHECK(transport); RTC_DCHECK(transport);
transport->content_name = new_name; transport->content_name = new_name;
@ -1167,9 +1167,9 @@ TEST_P(PeerConnectionMediaTest, AnswerHasSameMidsAsOffer) {
auto answer = callee->CreateAnswer(); auto answer = callee->CreateAnswer();
EXPECT_EQ(kAudioMid, EXPECT_EQ(kAudioMid,
cricket::GetFirstAudioContent(answer->description())->name); cricket::GetFirstAudioContent(answer->description())->mid());
EXPECT_EQ(kVideoMid, 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 // 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(); auto reoffer = callee->CreateOffer();
EXPECT_EQ(kAudioMid, EXPECT_EQ(kAudioMid,
cricket::GetFirstAudioContent(reoffer->description())->name); cricket::GetFirstAudioContent(reoffer->description())->mid());
EXPECT_EQ(kVideoMid, 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 // Test that SetRemoteDescription returns an error if there are two m= sections

View File

@ -262,7 +262,7 @@ SdpMungingType DetermineSdpMungingType(
} }
for (size_t i = 0; i < last_created_contents.size(); i++) { for (size_t i = 0; i < last_created_contents.size(); i++) {
// TODO: crbug.com/40567530 - more checks are needed here. // 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 " RTC_LOG(LS_WARNING) << "SDP munging: mid does not match "
"last created description."; "last created description.";
return SdpMungingType::kMid; return SdpMungingType::kMid;

View File

@ -1743,8 +1743,8 @@ TEST_F(SdpOfferAnswerMungingTest, RemoveContent) {
auto offer = pc->CreateOffer(); auto offer = pc->CreateOffer();
auto& contents = offer->description()->contents(); auto& contents = offer->description()->contents();
ASSERT_EQ(contents.size(), 1u); ASSERT_EQ(contents.size(), 1u);
std::string name = contents[0].name; auto name = contents[0].mid();
EXPECT_TRUE(offer->description()->RemoveContentByName(contents[0].name)); EXPECT_TRUE(offer->description()->RemoveContentByName(contents[0].mid()));
std::string sdp; std::string sdp;
offer->ToString(&sdp); offer->ToString(&sdp);
auto modified_offer = CreateSessionDescription( auto modified_offer = CreateSessionDescription(
@ -1765,8 +1765,8 @@ TEST_F(SdpOfferAnswerMungingTest, Mid) {
auto offer = pc->CreateOffer(); auto offer = pc->CreateOffer();
auto& contents = offer->description()->contents(); auto& contents = offer->description()->contents();
ASSERT_EQ(contents.size(), 1u); ASSERT_EQ(contents.size(), 1u);
std::string name = contents[0].name; std::string name(contents[0].mid());
contents[0].name = "amungedmid"; contents[0].set_mid("amungedmid");
auto& transport_infos = offer->description()->transport_infos(); auto& transport_infos = offer->description()->transport_infos();
ASSERT_EQ(transport_infos.size(), 1u); ASSERT_EQ(transport_infos.size(), 1u);

View File

@ -43,7 +43,7 @@ bool SdpContentsAll(SdpContentPredicate pred,
const cricket::SessionDescription* desc) { const cricket::SessionDescription* desc) {
RTC_DCHECK(desc); RTC_DCHECK(desc);
for (const auto& content : desc->contents()) { 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)) { if (!pred(&content, transport_info)) {
return false; return false;
} }
@ -65,7 +65,7 @@ void SdpContentsForEach(SdpContentMutator fn,
cricket::SessionDescription* desc) { cricket::SessionDescription* desc) {
RTC_DCHECK(desc); RTC_DCHECK(desc);
for (auto& content : desc->contents()) { for (auto& content : desc->contents()) {
auto* transport_info = desc->GetTransportInfoByName(content.name); auto* transport_info = desc->GetTransportInfoByName(content.mid());
fn(&content, transport_info); fn(&content, transport_info);
} }
} }

View File

@ -933,7 +933,7 @@ std::string SdpSerialize(const JsepSessionDescription& jdesc) {
for (const ContentInfo& content : desc->contents()) { for (const ContentInfo& content : desc->contents()) {
std::vector<Candidate> candidates; std::vector<Candidate> candidates;
GetCandidatesByMindex(jdesc, ++mline_index, &candidates); GetCandidatesByMindex(jdesc, ++mline_index, &candidates);
BuildMediaDescription(&content, desc->GetTransportInfoByName(content.name), BuildMediaDescription(&content, desc->GetTransportInfoByName(content.mid()),
content.media_description()->type(), candidates, content.media_description()->type(), candidates,
desc->msid_signaling(), &message); desc->msid_signaling(), &message);
} }
@ -1554,7 +1554,7 @@ void BuildMediaDescription(const ContentInfo* content_info,
// identification-tag = token // identification-tag = token
// Use the content name as the mid identification-tag. // Use the content name as the mid identification-tag.
InitAttrLine(kAttributeMid, &os); InitAttrLine(kAttributeMid, &os);
os << kSdpDelimiterColon << content_info->name; os << kSdpDelimiterColon << content_info->mid();
AddLine(os.str(), message); AddLine(os.str(), message);
if (cricket::IsDtlsSctp(media_desc->protocol())) { if (cricket::IsDtlsSctp(media_desc->protocol())) {

View File

@ -76,6 +76,7 @@ using cricket::TransportInfo;
using cricket::VideoContentDescription; using cricket::VideoContentDescription;
using ::testing::ElementsAre; using ::testing::ElementsAre;
using ::testing::Field; using ::testing::Field;
using ::testing::Property;
using webrtc::IceCandidateCollection; using webrtc::IceCandidateCollection;
using webrtc::IceCandidateInterface; using webrtc::IceCandidateInterface;
using webrtc::IceCandidateType; using webrtc::IceCandidateType;
@ -1417,7 +1418,7 @@ class WebRtcSdpTest : public ::testing::Test {
const cricket::ContentInfo& c1 = desc1.contents().at(i); const cricket::ContentInfo& c1 = desc1.contents().at(i);
const cricket::ContentInfo& c2 = desc2.contents().at(i); const cricket::ContentInfo& c2 = desc2.contents().at(i);
// ContentInfo properties. // ContentInfo properties.
EXPECT_EQ(c1.name, c2.name); EXPECT_EQ(c1.mid(), c2.mid());
EXPECT_EQ(c1.type, c2.type); EXPECT_EQ(c1.type, c2.type);
EXPECT_EQ(c1.rejected, c2.rejected); EXPECT_EQ(c1.rejected, c2.rejected);
EXPECT_EQ(c1.bundle_only, c2.bundle_only); EXPECT_EQ(c1.bundle_only, c2.bundle_only);
@ -4738,8 +4739,8 @@ TEST_F(WebRtcSdpTest, ParseNoMid) {
ASSERT_TRUE(webrtc::SdpDeserialize(sdp, &output, &error)); ASSERT_TRUE(webrtc::SdpDeserialize(sdp, &output, &error));
EXPECT_THAT(output.description()->contents(), EXPECT_THAT(output.description()->contents(),
ElementsAre(Field("name", &cricket::ContentInfo::name, ""), ElementsAre(Property("name", &cricket::ContentInfo::mid, ""),
Field("name", &cricket::ContentInfo::name, ""))); Property("name", &cricket::ContentInfo::mid, "")));
} }
TEST_F(WebRtcSdpTest, SerializeWithDefaultSctpProtocol) { 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()[0].rejected);
EXPECT_TRUE(jdesc_output.description()->contents()[1].rejected); EXPECT_TRUE(jdesc_output.description()->contents()[1].rejected);
EXPECT_EQ(jdesc_output.description()->contents()[0].name, "bogusmid"); EXPECT_EQ(jdesc_output.description()->contents()[0].mid(), "bogusmid");
EXPECT_EQ(jdesc_output.description()->contents()[1].name, "somethingmid"); EXPECT_EQ(jdesc_output.description()->contents()[1].mid(), "somethingmid");
} }
TEST_F(WebRtcSdpTest, MediaTypeProtocolMismatch) { TEST_F(WebRtcSdpTest, MediaTypeProtocolMismatch) {