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:
@ -2082,10 +2082,12 @@ bool MediaSessionDescriptionFactory::AddAudioContentForAnswer(
|
|||||||
offer_content->rejected ||
|
offer_content->rejected ||
|
||||||
!IsMediaProtocolSupported(MEDIA_TYPE_AUDIO,
|
!IsMediaProtocolSupported(MEDIA_TYPE_AUDIO,
|
||||||
audio_answer->protocol(), secure);
|
audio_answer->protocol(), secure);
|
||||||
if (!rejected) {
|
if (!AddTransportAnswer(media_description_options.mid,
|
||||||
AddTransportAnswer(media_description_options.mid, *(audio_transport.get()),
|
*(audio_transport.get()), answer)) {
|
||||||
answer);
|
return false;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (rejected) {
|
||||||
RTC_LOG(LS_INFO) << "Audio m= section '" << media_description_options.mid
|
RTC_LOG(LS_INFO) << "Audio m= section '" << media_description_options.mid
|
||||||
<< "' being rejected in answer.";
|
<< "' being rejected in answer.";
|
||||||
}
|
}
|
||||||
@ -2164,11 +2166,12 @@ bool MediaSessionDescriptionFactory::AddVideoContentForAnswer(
|
|||||||
offer_content->rejected ||
|
offer_content->rejected ||
|
||||||
!IsMediaProtocolSupported(MEDIA_TYPE_VIDEO,
|
!IsMediaProtocolSupported(MEDIA_TYPE_VIDEO,
|
||||||
video_answer->protocol(), secure);
|
video_answer->protocol(), secure);
|
||||||
|
if (!AddTransportAnswer(media_description_options.mid,
|
||||||
|
*(video_transport.get()), answer)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!rejected) {
|
if (!rejected) {
|
||||||
if (!AddTransportAnswer(media_description_options.mid,
|
|
||||||
*(video_transport.get()), answer)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
video_answer->set_bandwidth(kAutoBandwidth);
|
video_answer->set_bandwidth(kAutoBandwidth);
|
||||||
} else {
|
} else {
|
||||||
RTC_LOG(LS_INFO) << "Video m= section '" << media_description_options.mid
|
RTC_LOG(LS_INFO) << "Video m= section '" << media_description_options.mid
|
||||||
@ -2228,12 +2231,13 @@ bool MediaSessionDescriptionFactory::AddDataContentForAnswer(
|
|||||||
offer_content->rejected ||
|
offer_content->rejected ||
|
||||||
!IsMediaProtocolSupported(MEDIA_TYPE_DATA,
|
!IsMediaProtocolSupported(MEDIA_TYPE_DATA,
|
||||||
data_answer->protocol(), secure);
|
data_answer->protocol(), secure);
|
||||||
|
if (!AddTransportAnswer(media_description_options.mid,
|
||||||
|
*(data_transport.get()), answer)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!rejected) {
|
if (!rejected) {
|
||||||
data_answer->set_bandwidth(kDataMaxBandwidth);
|
data_answer->set_bandwidth(kDataMaxBandwidth);
|
||||||
if (!AddTransportAnswer(media_description_options.mid,
|
|
||||||
*(data_transport.get()), answer)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// RFC 3264
|
// RFC 3264
|
||||||
// The answer MUST contain the same number of m-lines as the offer.
|
// The answer MUST contain the same number of m-lines as the offer.
|
||||||
|
@ -3196,6 +3196,10 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
|||||||
ASSERT_EQ(2u, answer->contents().size());
|
ASSERT_EQ(2u, answer->contents().size());
|
||||||
EXPECT_FALSE(answer->contents()[0].rejected);
|
EXPECT_FALSE(answer->contents()[0].rejected);
|
||||||
EXPECT_TRUE(answer->contents()[1].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
|
// Test the generated media sections has the same order of the
|
||||||
|
Reference in New Issue
Block a user