Add the rejected TransportInfo when creating an answer.

Previously, if a media section is rejected by the answerer, the TransportInfo
of that section will not be added to the answer but when answer SDP is
deserialized by the offerer, the rejected TransportInfo will be added.

This CL fixes this inconsistency by adding the TransportInfo of all the m=
sections including the rejected ones.

Bug: webrtc:8818
Change-Id: I3b163245979c4ac4df31db39262e499f1c4901c4
Reviewed-on: https://webrtc-review.googlesource.com/46380
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Zhi Huang <zhihuang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21815}
This commit is contained in:
Zhi Huang
2018-01-30 13:20:35 -08:00
committed by Commit Bot
parent 018dd6e9d1
commit 3518e7bea4
2 changed files with 20 additions and 12 deletions

View File

@ -2082,10 +2082,12 @@ bool MediaSessionDescriptionFactory::AddAudioContentForAnswer(
offer_content->rejected ||
!IsMediaProtocolSupported(MEDIA_TYPE_AUDIO,
audio_answer->protocol(), secure);
if (!rejected) {
AddTransportAnswer(media_description_options.mid, *(audio_transport.get()),
answer);
} else {
if (!AddTransportAnswer(media_description_options.mid,
*(audio_transport.get()), answer)) {
return false;
}
if (rejected) {
RTC_LOG(LS_INFO) << "Audio m= section '" << media_description_options.mid
<< "' being rejected in answer.";
}
@ -2164,11 +2166,12 @@ bool MediaSessionDescriptionFactory::AddVideoContentForAnswer(
offer_content->rejected ||
!IsMediaProtocolSupported(MEDIA_TYPE_VIDEO,
video_answer->protocol(), secure);
if (!rejected) {
if (!AddTransportAnswer(media_description_options.mid,
*(video_transport.get()), answer)) {
return false;
}
if (!rejected) {
video_answer->set_bandwidth(kAutoBandwidth);
} else {
RTC_LOG(LS_INFO) << "Video m= section '" << media_description_options.mid
@ -2228,12 +2231,13 @@ bool MediaSessionDescriptionFactory::AddDataContentForAnswer(
offer_content->rejected ||
!IsMediaProtocolSupported(MEDIA_TYPE_DATA,
data_answer->protocol(), secure);
if (!rejected) {
data_answer->set_bandwidth(kDataMaxBandwidth);
if (!AddTransportAnswer(media_description_options.mid,
*(data_transport.get()), answer)) {
return false;
}
if (!rejected) {
data_answer->set_bandwidth(kDataMaxBandwidth);
} else {
// RFC 3264
// The answer MUST contain the same number of m-lines as the offer.

View File

@ -3196,6 +3196,10 @@ TEST_F(MediaSessionDescriptionFactoryTest,
ASSERT_EQ(2u, answer->contents().size());
EXPECT_FALSE(answer->contents()[0].rejected);
EXPECT_TRUE(answer->contents()[1].rejected);
// The TransportInfo of the rejected m= section is expected to be added in the
// answer.
EXPECT_EQ(offer->transport_infos().size(), answer->transport_infos().size());
}
// Test the generated media sections has the same order of the