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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2226 InjectAfter("a=mid:video_content_name\r\na=sendrecv\r\n", | 2226 InjectAfter("a=mid:video_content_name\r\na=sendrecv\r\n", |
2227 "b=AS:100\r\n", | 2227 "b=AS:100\r\n", |
2228 &sdp_with_bandwidth); | 2228 &sdp_with_bandwidth); |
2229 InjectAfter("a=mid:audio_content_name\r\na=sendrecv\r\n", | 2229 InjectAfter("a=mid:audio_content_name\r\na=sendrecv\r\n", |
2230 "b=AS:50\r\n", | 2230 "b=AS:50\r\n", |
2231 &sdp_with_bandwidth); | 2231 &sdp_with_bandwidth); |
2232 EXPECT_TRUE( | 2232 EXPECT_TRUE( |
2233 SdpDeserialize(sdp_with_bandwidth, &jdesc_with_bandwidth)); | 2233 SdpDeserialize(sdp_with_bandwidth, &jdesc_with_bandwidth)); |
2234 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( | 2234 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( |
2235 GetFirstVideoContent(&desc_)->description); | 2235 GetFirstVideoContent(&desc_)->description); |
2236 vcd->set_bandwidth(100 * 1000); | 2236 vcd->set_bandwidth(rtc::Optional<int>(100 * 1000)); |
2237 AudioContentDescription* acd = static_cast<AudioContentDescription*>( | 2237 AudioContentDescription* acd = static_cast<AudioContentDescription*>( |
2238 GetFirstAudioContent(&desc_)->description); | 2238 GetFirstAudioContent(&desc_)->description); |
2239 acd->set_bandwidth(50 * 1000); | 2239 acd->set_bandwidth(rtc::Optional<int>(50 * 1000)); |
2240 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), | 2240 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), |
2241 jdesc_.session_id(), | 2241 jdesc_.session_id(), |
2242 jdesc_.session_version())); | 2242 jdesc_.session_version())); |
2243 EXPECT_TRUE(CompareSessionDescription(jdesc_, jdesc_with_bandwidth)); | 2243 EXPECT_TRUE(CompareSessionDescription(jdesc_, jdesc_with_bandwidth)); |
2244 } | 2244 } |
2245 | 2245 |
2246 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithIceOptions) { | 2246 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithIceOptions) { |
2247 JsepSessionDescription jdesc_with_ice_options(kDummyString); | 2247 JsepSessionDescription jdesc_with_ice_options(kDummyString); |
2248 std::string sdp_with_ice_options = kSdpFullString; | 2248 std::string sdp_with_ice_options = kSdpFullString; |
2249 InjectAfter(kSessionTime, | 2249 InjectAfter(kSessionTime, |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 JsepSessionDescription jdesc_with_bandwidth(kDummyString); | 2624 JsepSessionDescription jdesc_with_bandwidth(kDummyString); |
2625 | 2625 |
2626 EXPECT_FALSE(SdpDeserialize(sdp_with_bandwidth, &jdesc_with_bandwidth)); | 2626 EXPECT_FALSE(SdpDeserialize(sdp_with_bandwidth, &jdesc_with_bandwidth)); |
2627 } | 2627 } |
2628 | 2628 |
2629 TEST_F(WebRtcSdpTest, DeserializeSdpWithSctpDataChannelsAndBandwidth) { | 2629 TEST_F(WebRtcSdpTest, DeserializeSdpWithSctpDataChannelsAndBandwidth) { |
2630 AddSctpDataChannel(); | 2630 AddSctpDataChannel(); |
2631 JsepSessionDescription jdesc(kDummyString); | 2631 JsepSessionDescription jdesc(kDummyString); |
2632 DataContentDescription* dcd = static_cast<DataContentDescription*>( | 2632 DataContentDescription* dcd = static_cast<DataContentDescription*>( |
2633 GetFirstDataContent(&desc_)->description); | 2633 GetFirstDataContent(&desc_)->description); |
2634 dcd->set_bandwidth(100 * 1000); | 2634 dcd->set_bandwidth(rtc::Optional<int>(100 * 1000)); |
2635 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | 2635 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); |
2636 | 2636 |
2637 std::string sdp_with_bandwidth = kSdpString; | 2637 std::string sdp_with_bandwidth = kSdpString; |
2638 sdp_with_bandwidth.append(kSdpSctpDataChannelString); | 2638 sdp_with_bandwidth.append(kSdpSctpDataChannelString); |
2639 InjectAfter("a=mid:data_content_name\r\n", | 2639 InjectAfter("a=mid:data_content_name\r\n", |
2640 "b=AS:100\r\n", | 2640 "b=AS:100\r\n", |
2641 &sdp_with_bandwidth); | 2641 &sdp_with_bandwidth); |
2642 JsepSessionDescription jdesc_with_bandwidth(kDummyString); | 2642 JsepSessionDescription jdesc_with_bandwidth(kDummyString); |
2643 | 2643 |
2644 // SCTP has congestion control, so we shouldn't limit the bandwidth | 2644 // SCTP has congestion control, so we shouldn't limit the bandwidth |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 EXPECT_TRUE( | 3112 EXPECT_TRUE( |
3113 SdpDeserialize(kUnifiedPlanSdpFullString, &deserialized_description)); | 3113 SdpDeserialize(kUnifiedPlanSdpFullString, &deserialized_description)); |
3114 | 3114 |
3115 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description)); | 3115 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description)); |
3116 } | 3116 } |
3117 | 3117 |
3118 TEST_F(WebRtcSdpTest, SerializeUnifiedPlanSessionDescription) { | 3118 TEST_F(WebRtcSdpTest, SerializeUnifiedPlanSessionDescription) { |
3119 MakeUnifiedPlanDescription(); | 3119 MakeUnifiedPlanDescription(); |
3120 TestSerialize(jdesc_, true); | 3120 TestSerialize(jdesc_, true); |
3121 } | 3121 } |
OLD | NEW |