OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 std::string sdp_with_bundle = kSdpFullString; | 1888 std::string sdp_with_bundle = kSdpFullString; |
1889 InjectAfter(kSessionTime, | 1889 InjectAfter(kSessionTime, |
1890 "a=group:BUNDLE audio_content_name video_content_name\r\n", | 1890 "a=group:BUNDLE audio_content_name video_content_name\r\n", |
1891 &sdp_with_bundle); | 1891 &sdp_with_bundle); |
1892 EXPECT_EQ(sdp_with_bundle, message); | 1892 EXPECT_EQ(sdp_with_bundle, message); |
1893 } | 1893 } |
1894 | 1894 |
1895 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBandwidth) { | 1895 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBandwidth) { |
1896 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( | 1896 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( |
1897 GetFirstVideoContent(&desc_)->description); | 1897 GetFirstVideoContent(&desc_)->description); |
1898 vcd->set_bandwidth(100 * 1000); | 1898 vcd->set_bandwidth(rtc::Optional<int>(100 * 1000)); |
1899 AudioContentDescription* acd = static_cast<AudioContentDescription*>( | 1899 AudioContentDescription* acd = static_cast<AudioContentDescription*>( |
1900 GetFirstAudioContent(&desc_)->description); | 1900 GetFirstAudioContent(&desc_)->description); |
1901 acd->set_bandwidth(50 * 1000); | 1901 acd->set_bandwidth(rtc::Optional<int>(50 * 1000)); |
1902 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), | 1902 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), |
1903 jdesc_.session_id(), | 1903 jdesc_.session_id(), |
1904 jdesc_.session_version())); | 1904 jdesc_.session_version())); |
1905 std::string message = webrtc::SdpSerialize(jdesc_, false); | 1905 std::string message = webrtc::SdpSerialize(jdesc_, false); |
1906 std::string sdp_with_bandwidth = kSdpFullString; | 1906 std::string sdp_with_bandwidth = kSdpFullString; |
1907 InjectAfter("c=IN IP4 74.125.224.39\r\n", | 1907 InjectAfter("c=IN IP4 74.125.224.39\r\n", |
1908 "b=AS:100\r\n", | 1908 "b=AS:100\r\n", |
1909 &sdp_with_bandwidth); | 1909 &sdp_with_bandwidth); |
1910 InjectAfter("c=IN IP4 74.125.127.126\r\n", | 1910 InjectAfter("c=IN IP4 74.125.127.126\r\n", |
1911 "b=AS:50\r\n", | 1911 "b=AS:50\r\n", |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 rtc::sprintfn(new_portstr, sizeof(new_portstr), "%d", kNewPort); | 2010 rtc::sprintfn(new_portstr, sizeof(new_portstr), "%d", kNewPort); |
2011 rtc::replace_substrs(default_portstr, strlen(default_portstr), | 2011 rtc::replace_substrs(default_portstr, strlen(default_portstr), |
2012 new_portstr, strlen(new_portstr), | 2012 new_portstr, strlen(new_portstr), |
2013 &expected_sdp); | 2013 &expected_sdp); |
2014 | 2014 |
2015 EXPECT_EQ(expected_sdp, message); | 2015 EXPECT_EQ(expected_sdp, message); |
2016 } | 2016 } |
2017 | 2017 |
2018 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithDataChannelAndBandwidth) { | 2018 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithDataChannelAndBandwidth) { |
2019 AddRtpDataChannel(); | 2019 AddRtpDataChannel(); |
2020 data_desc_->set_bandwidth(100*1000); | 2020 data_desc_->set_bandwidth(rtc::Optional<int>(100 * 1000)); |
2021 JsepSessionDescription jsep_desc(kDummyString); | 2021 JsepSessionDescription jsep_desc(kDummyString); |
2022 | 2022 |
2023 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | 2023 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); |
2024 std::string message = webrtc::SdpSerialize(jsep_desc, false); | 2024 std::string message = webrtc::SdpSerialize(jsep_desc, false); |
2025 | 2025 |
2026 std::string expected_sdp = kSdpString; | 2026 std::string expected_sdp = kSdpString; |
2027 expected_sdp.append(kSdpRtpDataChannelString); | 2027 expected_sdp.append(kSdpRtpDataChannelString); |
2028 // Serializing data content shouldn't ignore bandwidth settings. | 2028 // Serializing data content shouldn't ignore bandwidth settings. |
2029 InjectAfter("m=application 9 RTP/SAVPF 101\r\nc=IN IP4 0.0.0.0\r\n", | 2029 InjectAfter("m=application 9 RTP/SAVPF 101\r\nc=IN IP4 0.0.0.0\r\n", |
2030 "b=AS:100\r\n", | 2030 "b=AS:100\r\n", |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2213 InjectAfter("a=mid:video_content_name\r\na=sendrecv\r\n", | 2213 InjectAfter("a=mid:video_content_name\r\na=sendrecv\r\n", |
2214 "b=AS:100\r\n", | 2214 "b=AS:100\r\n", |
2215 &sdp_with_bandwidth); | 2215 &sdp_with_bandwidth); |
2216 InjectAfter("a=mid:audio_content_name\r\na=sendrecv\r\n", | 2216 InjectAfter("a=mid:audio_content_name\r\na=sendrecv\r\n", |
2217 "b=AS:50\r\n", | 2217 "b=AS:50\r\n", |
2218 &sdp_with_bandwidth); | 2218 &sdp_with_bandwidth); |
2219 EXPECT_TRUE( | 2219 EXPECT_TRUE( |
2220 SdpDeserialize(sdp_with_bandwidth, &jdesc_with_bandwidth)); | 2220 SdpDeserialize(sdp_with_bandwidth, &jdesc_with_bandwidth)); |
2221 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( | 2221 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( |
2222 GetFirstVideoContent(&desc_)->description); | 2222 GetFirstVideoContent(&desc_)->description); |
2223 vcd->set_bandwidth(100 * 1000); | 2223 vcd->set_bandwidth(rtc::Optional<int>(100 * 1000)); |
2224 AudioContentDescription* acd = static_cast<AudioContentDescription*>( | 2224 AudioContentDescription* acd = static_cast<AudioContentDescription*>( |
2225 GetFirstAudioContent(&desc_)->description); | 2225 GetFirstAudioContent(&desc_)->description); |
2226 acd->set_bandwidth(50 * 1000); | 2226 acd->set_bandwidth(rtc::Optional<int>(50 * 1000)); |
2227 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), | 2227 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), |
2228 jdesc_.session_id(), | 2228 jdesc_.session_id(), |
2229 jdesc_.session_version())); | 2229 jdesc_.session_version())); |
2230 EXPECT_TRUE(CompareSessionDescription(jdesc_, jdesc_with_bandwidth)); | 2230 EXPECT_TRUE(CompareSessionDescription(jdesc_, jdesc_with_bandwidth)); |
2231 } | 2231 } |
2232 | 2232 |
2233 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithIceOptions) { | 2233 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithIceOptions) { |
2234 JsepSessionDescription jdesc_with_ice_options(kDummyString); | 2234 JsepSessionDescription jdesc_with_ice_options(kDummyString); |
2235 std::string sdp_with_ice_options = kSdpFullString; | 2235 std::string sdp_with_ice_options = kSdpFullString; |
2236 InjectAfter(kSessionTime, | 2236 InjectAfter(kSessionTime, |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2594 JsepSessionDescription jdesc_with_bandwidth(kDummyString); | 2594 JsepSessionDescription jdesc_with_bandwidth(kDummyString); |
2595 | 2595 |
2596 EXPECT_FALSE(SdpDeserialize(sdp_with_bandwidth, &jdesc_with_bandwidth)); | 2596 EXPECT_FALSE(SdpDeserialize(sdp_with_bandwidth, &jdesc_with_bandwidth)); |
2597 } | 2597 } |
2598 | 2598 |
2599 TEST_F(WebRtcSdpTest, DeserializeSdpWithSctpDataChannelsAndBandwidth) { | 2599 TEST_F(WebRtcSdpTest, DeserializeSdpWithSctpDataChannelsAndBandwidth) { |
2600 AddSctpDataChannel(); | 2600 AddSctpDataChannel(); |
2601 JsepSessionDescription jdesc(kDummyString); | 2601 JsepSessionDescription jdesc(kDummyString); |
2602 DataContentDescription* dcd = static_cast<DataContentDescription*>( | 2602 DataContentDescription* dcd = static_cast<DataContentDescription*>( |
2603 GetFirstDataContent(&desc_)->description); | 2603 GetFirstDataContent(&desc_)->description); |
2604 dcd->set_bandwidth(100 * 1000); | 2604 dcd->set_bandwidth(rtc::Optional<int>(100 * 1000)); |
2605 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | 2605 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); |
2606 | 2606 |
2607 std::string sdp_with_bandwidth = kSdpString; | 2607 std::string sdp_with_bandwidth = kSdpString; |
2608 sdp_with_bandwidth.append(kSdpSctpDataChannelString); | 2608 sdp_with_bandwidth.append(kSdpSctpDataChannelString); |
2609 InjectAfter("a=mid:data_content_name\r\n", | 2609 InjectAfter("a=mid:data_content_name\r\n", |
2610 "b=AS:100\r\n", | 2610 "b=AS:100\r\n", |
2611 &sdp_with_bandwidth); | 2611 &sdp_with_bandwidth); |
2612 JsepSessionDescription jdesc_with_bandwidth(kDummyString); | 2612 JsepSessionDescription jdesc_with_bandwidth(kDummyString); |
2613 | 2613 |
2614 // SCTP has congestion control, so we shouldn't limit the bandwidth | 2614 // SCTP has congestion control, so we shouldn't limit the bandwidth |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3082 EXPECT_TRUE( | 3082 EXPECT_TRUE( |
3083 SdpDeserialize(kUnifiedPlanSdpFullString, &deserialized_description)); | 3083 SdpDeserialize(kUnifiedPlanSdpFullString, &deserialized_description)); |
3084 | 3084 |
3085 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description)); | 3085 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description)); |
3086 } | 3086 } |
3087 | 3087 |
3088 TEST_F(WebRtcSdpTest, SerializeUnifiedPlanSessionDescription) { | 3088 TEST_F(WebRtcSdpTest, SerializeUnifiedPlanSessionDescription) { |
3089 MakeUnifiedPlanDescription(); | 3089 MakeUnifiedPlanDescription(); |
3090 TestSerialize(jdesc_, true); | 3090 TestSerialize(jdesc_, true); |
3091 } | 3091 } |
OLD | NEW |