| 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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 webrtc::InitializeAndroidObjects(); | 868 webrtc::InitializeAndroidObjects(); |
| 869 #endif | 869 #endif |
| 870 // AudioContentDescription | 870 // AudioContentDescription |
| 871 audio_desc_ = CreateAudioContentDescription(); | 871 audio_desc_ = CreateAudioContentDescription(); |
| 872 StreamParams audio_stream; | 872 StreamParams audio_stream; |
| 873 audio_stream.id = kAudioTrackId1; | 873 audio_stream.id = kAudioTrackId1; |
| 874 audio_stream.cname = kStream1Cname; | 874 audio_stream.cname = kStream1Cname; |
| 875 audio_stream.sync_label = kStreamLabel1; | 875 audio_stream.sync_label = kStreamLabel1; |
| 876 audio_stream.ssrcs.push_back(kAudioTrack1Ssrc); | 876 audio_stream.ssrcs.push_back(kAudioTrack1Ssrc); |
| 877 audio_desc_->AddStream(audio_stream); | 877 audio_desc_->AddStream(audio_stream); |
| 878 rtc::SocketAddress audio_addr("74.125.127.126", 2345); |
| 879 audio_desc_->set_connection_address(audio_addr); |
| 878 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_); | 880 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_); |
| 879 | 881 |
| 880 // VideoContentDescription | 882 // VideoContentDescription |
| 881 video_desc_ = CreateVideoContentDescription(); | 883 video_desc_ = CreateVideoContentDescription(); |
| 882 StreamParams video_stream; | 884 StreamParams video_stream; |
| 883 video_stream.id = kVideoTrackId1; | 885 video_stream.id = kVideoTrackId1; |
| 884 video_stream.cname = kStream1Cname; | 886 video_stream.cname = kStream1Cname; |
| 885 video_stream.sync_label = kStreamLabel1; | 887 video_stream.sync_label = kStreamLabel1; |
| 886 video_stream.ssrcs.push_back(kVideoTrack1Ssrc1); | 888 video_stream.ssrcs.push_back(kVideoTrack1Ssrc1); |
| 887 video_stream.ssrcs.push_back(kVideoTrack1Ssrc2); | 889 video_stream.ssrcs.push_back(kVideoTrack1Ssrc2); |
| 888 cricket::SsrcGroup ssrc_group(kFecSsrcGroupSemantics, video_stream.ssrcs); | 890 cricket::SsrcGroup ssrc_group(kFecSsrcGroupSemantics, video_stream.ssrcs); |
| 889 video_stream.ssrc_groups.push_back(ssrc_group); | 891 video_stream.ssrc_groups.push_back(ssrc_group); |
| 890 video_desc_->AddStream(video_stream); | 892 video_desc_->AddStream(video_stream); |
| 893 rtc::SocketAddress video_addr("74.125.224.39", 3457); |
| 894 video_desc_->set_connection_address(video_addr); |
| 891 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_desc_); | 895 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_desc_); |
| 892 | 896 |
| 893 // TransportInfo | 897 // TransportInfo |
| 894 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( | 898 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
| 895 kAudioContentName, TransportDescription(kUfragVoice, kPwdVoice)))); | 899 kAudioContentName, TransportDescription(kUfragVoice, kPwdVoice)))); |
| 896 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( | 900 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
| 897 kVideoContentName, TransportDescription(kUfragVideo, kPwdVideo)))); | 901 kVideoContentName, TransportDescription(kUfragVideo, kPwdVideo)))); |
| 898 | 902 |
| 899 // v4 host | 903 // v4 host |
| 900 int port = 1234; | 904 int port = 1234; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 AudioContentDescription* audio_desc_2 = CreateAudioContentDescription(); | 1087 AudioContentDescription* audio_desc_2 = CreateAudioContentDescription(); |
| 1084 StreamParams audio_track_2; | 1088 StreamParams audio_track_2; |
| 1085 audio_track_2.id = kAudioTrackId2; | 1089 audio_track_2.id = kAudioTrackId2; |
| 1086 audio_track_2.cname = kStream2Cname; | 1090 audio_track_2.cname = kStream2Cname; |
| 1087 audio_track_2.sync_label = kStreamLabel2; | 1091 audio_track_2.sync_label = kStreamLabel2; |
| 1088 audio_track_2.ssrcs.push_back(kAudioTrack2Ssrc); | 1092 audio_track_2.ssrcs.push_back(kAudioTrack2Ssrc); |
| 1089 audio_desc_2->AddStream(audio_track_2); | 1093 audio_desc_2->AddStream(audio_track_2); |
| 1090 desc_.AddContent(kAudioContentName2, NS_JINGLE_RTP, audio_desc_2); | 1094 desc_.AddContent(kAudioContentName2, NS_JINGLE_RTP, audio_desc_2); |
| 1091 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( | 1095 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
| 1092 kAudioContentName2, TransportDescription(kUfragVoice2, kPwdVoice2)))); | 1096 kAudioContentName2, TransportDescription(kUfragVoice2, kPwdVoice2)))); |
| 1093 | |
| 1094 // Video track 2, in stream 2. | 1097 // Video track 2, in stream 2. |
| 1095 VideoContentDescription* video_desc_2 = CreateVideoContentDescription(); | 1098 VideoContentDescription* video_desc_2 = CreateVideoContentDescription(); |
| 1096 StreamParams video_track_2; | 1099 StreamParams video_track_2; |
| 1097 video_track_2.id = kVideoTrackId2; | 1100 video_track_2.id = kVideoTrackId2; |
| 1098 video_track_2.cname = kStream2Cname; | 1101 video_track_2.cname = kStream2Cname; |
| 1099 video_track_2.sync_label = kStreamLabel2; | 1102 video_track_2.sync_label = kStreamLabel2; |
| 1100 video_track_2.ssrcs.push_back(kVideoTrack2Ssrc); | 1103 video_track_2.ssrcs.push_back(kVideoTrack2Ssrc); |
| 1101 video_desc_2->AddStream(video_track_2); | 1104 video_desc_2->AddStream(video_track_2); |
| 1102 desc_.AddContent(kVideoContentName2, NS_JINGLE_RTP, video_desc_2); | 1105 desc_.AddContent(kVideoContentName2, NS_JINGLE_RTP, video_desc_2); |
| 1103 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( | 1106 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 std::string message = webrtc::SdpSerialize(jdesc_, false); | 1466 std::string message = webrtc::SdpSerialize(jdesc_, false); |
| 1464 EXPECT_EQ(new_sdp, message); | 1467 EXPECT_EQ(new_sdp, message); |
| 1465 return true; | 1468 return true; |
| 1466 } | 1469 } |
| 1467 | 1470 |
| 1468 bool TestSerializeRejected(bool audio_rejected, bool video_rejected) { | 1471 bool TestSerializeRejected(bool audio_rejected, bool video_rejected) { |
| 1469 audio_desc_ = static_cast<AudioContentDescription*>( | 1472 audio_desc_ = static_cast<AudioContentDescription*>( |
| 1470 audio_desc_->Copy()); | 1473 audio_desc_->Copy()); |
| 1471 video_desc_ = static_cast<VideoContentDescription*>( | 1474 video_desc_ = static_cast<VideoContentDescription*>( |
| 1472 video_desc_->Copy()); | 1475 video_desc_->Copy()); |
| 1476 |
| 1473 desc_.RemoveContentByName(kAudioContentName); | 1477 desc_.RemoveContentByName(kAudioContentName); |
| 1474 desc_.RemoveContentByName(kVideoContentName); | 1478 desc_.RemoveContentByName(kVideoContentName); |
| 1475 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_rejected, | 1479 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_rejected, |
| 1476 audio_desc_); | 1480 audio_desc_); |
| 1477 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_rejected, | 1481 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_rejected, |
| 1478 video_desc_); | 1482 video_desc_); |
| 1479 SetIceUfragPwd(kAudioContentName, audio_rejected ? "" : kUfragVoice, | 1483 SetIceUfragPwd(kAudioContentName, audio_rejected ? "" : kUfragVoice, |
| 1480 audio_rejected ? "" : kPwdVoice); | 1484 audio_rejected ? "" : kPwdVoice); |
| 1481 SetIceUfragPwd(kVideoContentName, video_rejected ? "" : kUfragVideo, | 1485 SetIceUfragPwd(kVideoContentName, video_rejected ? "" : kUfragVideo, |
| 1482 video_rejected ? "" : kPwdVideo); | 1486 video_rejected ? "" : kPwdVideo); |
| 1483 | 1487 |
| 1484 std::string new_sdp = kSdpString; | 1488 std::string new_sdp = kSdpString; |
| 1485 ReplaceRejected(audio_rejected, video_rejected, &new_sdp); | 1489 ReplaceRejected(audio_rejected, video_rejected, &new_sdp); |
| 1486 | 1490 |
| 1487 JsepSessionDescription jdesc_no_candidates(kDummyString); | 1491 JsepSessionDescription jdesc_no_candidates(kDummyString); |
| 1488 if (!jdesc_no_candidates.Initialize(desc_.Copy(), kSessionId, | 1492 MakeDescriptionWithoutCandidates(&jdesc_no_candidates); |
| 1489 kSessionVersion)) { | |
| 1490 return false; | |
| 1491 } | |
| 1492 std::string message = webrtc::SdpSerialize(jdesc_no_candidates, false); | 1493 std::string message = webrtc::SdpSerialize(jdesc_no_candidates, false); |
| 1493 EXPECT_EQ(new_sdp, message); | 1494 EXPECT_EQ(new_sdp, message); |
| 1494 return true; | 1495 return true; |
| 1495 } | 1496 } |
| 1496 | 1497 |
| 1497 void AddSctpDataChannel(bool use_sctpmap) { | 1498 void AddSctpDataChannel(bool use_sctpmap) { |
| 1498 std::unique_ptr<DataContentDescription> data(new DataContentDescription()); | 1499 std::unique_ptr<DataContentDescription> data(new DataContentDescription()); |
| 1499 data_desc_ = data.get(); | 1500 data_desc_ = data.get(); |
| 1500 data_desc_->set_use_sctpmap(use_sctpmap); | 1501 data_desc_->set_use_sctpmap(use_sctpmap); |
| 1501 data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp); | 1502 data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1759 // the serializer sufficiently. | 1760 // the serializer sufficiently. |
| 1760 void TestSerialize(const JsepSessionDescription& jdesc, | 1761 void TestSerialize(const JsepSessionDescription& jdesc, |
| 1761 bool unified_plan_sdp) { | 1762 bool unified_plan_sdp) { |
| 1762 std::string message = webrtc::SdpSerialize(jdesc, unified_plan_sdp); | 1763 std::string message = webrtc::SdpSerialize(jdesc, unified_plan_sdp); |
| 1763 JsepSessionDescription jdesc_output_des(kDummyString); | 1764 JsepSessionDescription jdesc_output_des(kDummyString); |
| 1764 SdpParseError error; | 1765 SdpParseError error; |
| 1765 EXPECT_TRUE(webrtc::SdpDeserialize(message, &jdesc_output_des, &error)); | 1766 EXPECT_TRUE(webrtc::SdpDeserialize(message, &jdesc_output_des, &error)); |
| 1766 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output_des)); | 1767 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output_des)); |
| 1767 } | 1768 } |
| 1768 | 1769 |
| 1770 // Calling 'Initialize' with a copy of the inner SessionDescription will |
| 1771 // create a copy of the JsepSessionDescription without candidates. The |
| 1772 // 'connection address' field, previously set from the candidates, must also |
| 1773 // be reset. |
| 1774 void MakeDescriptionWithoutCandidates(JsepSessionDescription* jdesc) { |
| 1775 rtc::SocketAddress audio_addr("0.0.0.0", 9); |
| 1776 rtc::SocketAddress video_addr("0.0.0.0", 9); |
| 1777 audio_desc_->set_connection_address(audio_addr); |
| 1778 video_desc_->set_connection_address(video_addr); |
| 1779 ASSERT_TRUE(jdesc->Initialize(desc_.Copy(), kSessionId, kSessionVersion)); |
| 1780 } |
| 1781 |
| 1769 protected: | 1782 protected: |
| 1770 SessionDescription desc_; | 1783 SessionDescription desc_; |
| 1771 AudioContentDescription* audio_desc_; | 1784 AudioContentDescription* audio_desc_; |
| 1772 VideoContentDescription* video_desc_; | 1785 VideoContentDescription* video_desc_; |
| 1773 DataContentDescription* data_desc_; | 1786 DataContentDescription* data_desc_; |
| 1774 Candidates candidates_; | 1787 Candidates candidates_; |
| 1775 std::unique_ptr<IceCandidateInterface> jcandidate_; | 1788 std::unique_ptr<IceCandidateInterface> jcandidate_; |
| 1776 JsepSessionDescription jdesc_; | 1789 JsepSessionDescription jdesc_; |
| 1777 }; | 1790 }; |
| 1778 | 1791 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1794 // SessionDescription with desc and candidates. | 1807 // SessionDescription with desc and candidates. |
| 1795 std::string message = webrtc::SdpSerialize(jdesc_, false); | 1808 std::string message = webrtc::SdpSerialize(jdesc_, false); |
| 1796 TestMismatch(std::string(kSdpFullString), message); | 1809 TestMismatch(std::string(kSdpFullString), message); |
| 1797 } | 1810 } |
| 1798 | 1811 |
| 1799 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionEmpty) { | 1812 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionEmpty) { |
| 1800 JsepSessionDescription jdesc_empty(kDummyString); | 1813 JsepSessionDescription jdesc_empty(kDummyString); |
| 1801 EXPECT_EQ("", webrtc::SdpSerialize(jdesc_empty, false)); | 1814 EXPECT_EQ("", webrtc::SdpSerialize(jdesc_empty, false)); |
| 1802 } | 1815 } |
| 1803 | 1816 |
| 1804 // This tests serialization of SDP with only IPv6 candidates and verifies that | |
| 1805 // IPv6 is used as default address in c line according to preference. | |
| 1806 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithIPv6Only) { | |
| 1807 // Only test 1 m line. | |
| 1808 desc_.RemoveContentByName("video_content_name"); | |
| 1809 // Stun has a high preference than local host. | |
| 1810 cricket::Candidate candidate1( | |
| 1811 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp", | |
| 1812 rtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", | |
| 1813 cricket::STUN_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); | |
| 1814 cricket::Candidate candidate2( | |
| 1815 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp", | |
| 1816 rtc::SocketAddress("::2", 1235), kCandidatePriority, "", "", | |
| 1817 cricket::LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); | |
| 1818 JsepSessionDescription jdesc(kDummyString); | |
| 1819 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | |
| 1820 | |
| 1821 // Only add the candidates to audio m line. | |
| 1822 JsepIceCandidate jice1("audio_content_name", 0, candidate1); | |
| 1823 JsepIceCandidate jice2("audio_content_name", 0, candidate2); | |
| 1824 ASSERT_TRUE(jdesc.AddCandidate(&jice1)); | |
| 1825 ASSERT_TRUE(jdesc.AddCandidate(&jice2)); | |
| 1826 std::string message = webrtc::SdpSerialize(jdesc, false); | |
| 1827 | |
| 1828 // Audio line should have a c line like this one. | |
| 1829 EXPECT_NE(message.find("c=IN IP6 ::1"), std::string::npos); | |
| 1830 // Shouldn't have a IP4 c line. | |
| 1831 EXPECT_EQ(message.find("c=IN IP4"), std::string::npos); | |
| 1832 } | |
| 1833 | |
| 1834 // This tests serialization of SDP with both IPv4 and IPv6 candidates and | |
| 1835 // verifies that IPv4 is used as default address in c line even if the | |
| 1836 // preference of IPv4 is lower. | |
| 1837 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBothIPFamilies) { | |
| 1838 // Only test 1 m line. | |
| 1839 desc_.RemoveContentByName("video_content_name"); | |
| 1840 cricket::Candidate candidate_v4( | |
| 1841 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp", | |
| 1842 rtc::SocketAddress("192.168.1.5", 1234), kCandidatePriority, "", "", | |
| 1843 cricket::STUN_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); | |
| 1844 cricket::Candidate candidate_v6( | |
| 1845 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp", | |
| 1846 rtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", | |
| 1847 cricket::LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); | |
| 1848 JsepSessionDescription jdesc(kDummyString); | |
| 1849 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | |
| 1850 | |
| 1851 // Only add the candidates to audio m line. | |
| 1852 JsepIceCandidate jice_v4("audio_content_name", 0, candidate_v4); | |
| 1853 JsepIceCandidate jice_v6("audio_content_name", 0, candidate_v6); | |
| 1854 ASSERT_TRUE(jdesc.AddCandidate(&jice_v4)); | |
| 1855 ASSERT_TRUE(jdesc.AddCandidate(&jice_v6)); | |
| 1856 std::string message = webrtc::SdpSerialize(jdesc, false); | |
| 1857 | |
| 1858 // Audio line should have a c line like this one. | |
| 1859 EXPECT_NE(message.find("c=IN IP4 192.168.1.5"), std::string::npos); | |
| 1860 // Shouldn't have a IP6 c line. | |
| 1861 EXPECT_EQ(message.find("c=IN IP6"), std::string::npos); | |
| 1862 } | |
| 1863 | |
| 1864 // This tests serialization of SDP with both UDP and TCP candidates and | |
| 1865 // verifies that UDP is used as default address in c line even if the | |
| 1866 // preference of UDP is lower. | |
| 1867 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBothProtocols) { | |
| 1868 // Only test 1 m line. | |
| 1869 desc_.RemoveContentByName("video_content_name"); | |
| 1870 // Stun has a high preference than local host. | |
| 1871 cricket::Candidate candidate1( | |
| 1872 cricket::ICE_CANDIDATE_COMPONENT_RTP, "tcp", | |
| 1873 rtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", | |
| 1874 cricket::STUN_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); | |
| 1875 cricket::Candidate candidate2( | |
| 1876 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp", | |
| 1877 rtc::SocketAddress("fe80::1234:5678:abcd:ef12", 1235), kCandidatePriority, | |
| 1878 "", "", cricket::LOCAL_PORT_TYPE, kCandidateGeneration, | |
| 1879 kCandidateFoundation1); | |
| 1880 JsepSessionDescription jdesc(kDummyString); | |
| 1881 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | |
| 1882 | |
| 1883 // Only add the candidates to audio m line. | |
| 1884 JsepIceCandidate jice1("audio_content_name", 0, candidate1); | |
| 1885 JsepIceCandidate jice2("audio_content_name", 0, candidate2); | |
| 1886 ASSERT_TRUE(jdesc.AddCandidate(&jice1)); | |
| 1887 ASSERT_TRUE(jdesc.AddCandidate(&jice2)); | |
| 1888 std::string message = webrtc::SdpSerialize(jdesc, false); | |
| 1889 | |
| 1890 // Audio line should have a c line like this one. | |
| 1891 EXPECT_NE(message.find("c=IN IP6 fe80::1234:5678:abcd:ef12"), | |
| 1892 std::string::npos); | |
| 1893 // Shouldn't have a IP4 c line. | |
| 1894 EXPECT_EQ(message.find("c=IN IP4"), std::string::npos); | |
| 1895 } | |
| 1896 | |
| 1897 // This tests serialization of SDP with only TCP candidates and verifies that | |
| 1898 // null IPv4 is used as default address in c line. | |
| 1899 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithTCPOnly) { | |
| 1900 // Only test 1 m line. | |
| 1901 desc_.RemoveContentByName("video_content_name"); | |
| 1902 // Stun has a high preference than local host. | |
| 1903 cricket::Candidate candidate1( | |
| 1904 cricket::ICE_CANDIDATE_COMPONENT_RTP, "tcp", | |
| 1905 rtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", | |
| 1906 cricket::STUN_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); | |
| 1907 cricket::Candidate candidate2( | |
| 1908 cricket::ICE_CANDIDATE_COMPONENT_RTP, "tcp", | |
| 1909 rtc::SocketAddress("::2", 1235), kCandidatePriority, "", "", | |
| 1910 cricket::LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); | |
| 1911 JsepSessionDescription jdesc(kDummyString); | |
| 1912 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | |
| 1913 | |
| 1914 // Only add the candidates to audio m line. | |
| 1915 JsepIceCandidate jice1("audio_content_name", 0, candidate1); | |
| 1916 JsepIceCandidate jice2("audio_content_name", 0, candidate2); | |
| 1917 ASSERT_TRUE(jdesc.AddCandidate(&jice1)); | |
| 1918 ASSERT_TRUE(jdesc.AddCandidate(&jice2)); | |
| 1919 std::string message = webrtc::SdpSerialize(jdesc, false); | |
| 1920 | |
| 1921 // Audio line should have a c line like this one when no any default exists. | |
| 1922 EXPECT_NE(message.find("c=IN IP4 0.0.0.0"), std::string::npos); | |
| 1923 } | |
| 1924 | |
| 1925 // This tests serialization of SDP with a=crypto and a=fingerprint, as would be | 1817 // This tests serialization of SDP with a=crypto and a=fingerprint, as would be |
| 1926 // the case in a DTLS offer. | 1818 // the case in a DTLS offer. |
| 1927 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithFingerprint) { | 1819 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithFingerprint) { |
| 1928 AddFingerprint(); | 1820 AddFingerprint(); |
| 1929 JsepSessionDescription jdesc_with_fingerprint(kDummyString); | 1821 JsepSessionDescription jdesc_with_fingerprint(kDummyString); |
| 1930 ASSERT_TRUE(jdesc_with_fingerprint.Initialize(desc_.Copy(), | 1822 MakeDescriptionWithoutCandidates(&jdesc_with_fingerprint); |
| 1931 kSessionId, kSessionVersion)); | |
| 1932 std::string message = webrtc::SdpSerialize(jdesc_with_fingerprint, false); | 1823 std::string message = webrtc::SdpSerialize(jdesc_with_fingerprint, false); |
| 1933 | 1824 |
| 1934 std::string sdp_with_fingerprint = kSdpString; | 1825 std::string sdp_with_fingerprint = kSdpString; |
| 1935 InjectAfter(kAttributeIcePwdVoice, | 1826 InjectAfter(kAttributeIcePwdVoice, |
| 1936 kFingerprint, &sdp_with_fingerprint); | 1827 kFingerprint, &sdp_with_fingerprint); |
| 1937 InjectAfter(kAttributeIcePwdVideo, | 1828 InjectAfter(kAttributeIcePwdVideo, |
| 1938 kFingerprint, &sdp_with_fingerprint); | 1829 kFingerprint, &sdp_with_fingerprint); |
| 1939 | 1830 |
| 1940 EXPECT_EQ(sdp_with_fingerprint, message); | 1831 EXPECT_EQ(sdp_with_fingerprint, message); |
| 1941 } | 1832 } |
| 1942 | 1833 |
| 1943 // This tests serialization of SDP with a=fingerprint with no a=crypto, as would | 1834 // This tests serialization of SDP with a=fingerprint with no a=crypto, as would |
| 1944 // be the case in a DTLS answer. | 1835 // be the case in a DTLS answer. |
| 1945 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithFingerprintNoCryptos) { | 1836 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithFingerprintNoCryptos) { |
| 1946 AddFingerprint(); | 1837 AddFingerprint(); |
| 1947 RemoveCryptos(); | 1838 RemoveCryptos(); |
| 1948 JsepSessionDescription jdesc_with_fingerprint(kDummyString); | 1839 JsepSessionDescription jdesc_with_fingerprint(kDummyString); |
| 1949 ASSERT_TRUE(jdesc_with_fingerprint.Initialize(desc_.Copy(), | 1840 MakeDescriptionWithoutCandidates(&jdesc_with_fingerprint); |
| 1950 kSessionId, kSessionVersion)); | |
| 1951 std::string message = webrtc::SdpSerialize(jdesc_with_fingerprint, false); | 1841 std::string message = webrtc::SdpSerialize(jdesc_with_fingerprint, false); |
| 1952 | 1842 |
| 1953 std::string sdp_with_fingerprint = kSdpString; | 1843 std::string sdp_with_fingerprint = kSdpString; |
| 1954 Replace(kAttributeCryptoVoice, "", &sdp_with_fingerprint); | 1844 Replace(kAttributeCryptoVoice, "", &sdp_with_fingerprint); |
| 1955 Replace(kAttributeCryptoVideo, "", &sdp_with_fingerprint); | 1845 Replace(kAttributeCryptoVideo, "", &sdp_with_fingerprint); |
| 1956 InjectAfter(kAttributeIcePwdVoice, | 1846 InjectAfter(kAttributeIcePwdVoice, |
| 1957 kFingerprint, &sdp_with_fingerprint); | 1847 kFingerprint, &sdp_with_fingerprint); |
| 1958 InjectAfter(kAttributeIcePwdVideo, | 1848 InjectAfter(kAttributeIcePwdVideo, |
| 1959 kFingerprint, &sdp_with_fingerprint); | 1849 kFingerprint, &sdp_with_fingerprint); |
| 1960 | 1850 |
| 1961 EXPECT_EQ(sdp_with_fingerprint, message); | 1851 EXPECT_EQ(sdp_with_fingerprint, message); |
| 1962 } | 1852 } |
| 1963 | 1853 |
| 1964 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithoutCandidates) { | 1854 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithoutCandidates) { |
| 1965 // JsepSessionDescription with desc but without candidates. | 1855 // JsepSessionDescription with desc but without candidates. |
| 1966 JsepSessionDescription jdesc_no_candidates(kDummyString); | 1856 JsepSessionDescription jdesc_no_candidates(kDummyString); |
| 1967 ASSERT_TRUE(jdesc_no_candidates.Initialize(desc_.Copy(), kSessionId, | 1857 MakeDescriptionWithoutCandidates(&jdesc_no_candidates); |
| 1968 kSessionVersion)); | |
| 1969 std::string message = webrtc::SdpSerialize(jdesc_no_candidates, false); | 1858 std::string message = webrtc::SdpSerialize(jdesc_no_candidates, false); |
| 1970 EXPECT_EQ(std::string(kSdpString), message); | 1859 EXPECT_EQ(std::string(kSdpString), message); |
| 1971 } | 1860 } |
| 1972 | 1861 |
| 1973 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBundle) { | 1862 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBundle) { |
| 1974 ContentGroup group(cricket::GROUP_TYPE_BUNDLE); | 1863 ContentGroup group(cricket::GROUP_TYPE_BUNDLE); |
| 1975 group.AddContentName(kAudioContentName); | 1864 group.AddContentName(kAudioContentName); |
| 1976 group.AddContentName(kVideoContentName); | 1865 group.AddContentName(kVideoContentName); |
| 1977 desc_.AddGroup(group); | 1866 desc_.AddGroup(group); |
| 1978 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), | 1867 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2051 } | 1940 } |
| 2052 | 1941 |
| 2053 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithAudioVideoRejected) { | 1942 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithAudioVideoRejected) { |
| 2054 EXPECT_TRUE(TestSerializeRejected(true, true)); | 1943 EXPECT_TRUE(TestSerializeRejected(true, true)); |
| 2055 } | 1944 } |
| 2056 | 1945 |
| 2057 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithRtpDataChannel) { | 1946 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithRtpDataChannel) { |
| 2058 AddRtpDataChannel(); | 1947 AddRtpDataChannel(); |
| 2059 JsepSessionDescription jsep_desc(kDummyString); | 1948 JsepSessionDescription jsep_desc(kDummyString); |
| 2060 | 1949 |
| 2061 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | 1950 MakeDescriptionWithoutCandidates(&jsep_desc); |
| 2062 std::string message = webrtc::SdpSerialize(jsep_desc, false); | 1951 std::string message = webrtc::SdpSerialize(jsep_desc, false); |
| 2063 | 1952 |
| 2064 std::string expected_sdp = kSdpString; | 1953 std::string expected_sdp = kSdpString; |
| 2065 expected_sdp.append(kSdpRtpDataChannelString); | 1954 expected_sdp.append(kSdpRtpDataChannelString); |
| 2066 EXPECT_EQ(expected_sdp, message); | 1955 EXPECT_EQ(expected_sdp, message); |
| 2067 } | 1956 } |
| 2068 | 1957 |
| 2069 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithSctpDataChannel) { | 1958 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithSctpDataChannel) { |
| 2070 bool use_sctpmap = true; | 1959 bool use_sctpmap = true; |
| 2071 AddSctpDataChannel(use_sctpmap); | 1960 AddSctpDataChannel(use_sctpmap); |
| 2072 JsepSessionDescription jsep_desc(kDummyString); | 1961 JsepSessionDescription jsep_desc(kDummyString); |
| 2073 | 1962 |
| 2074 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | 1963 MakeDescriptionWithoutCandidates(&jsep_desc); |
| 2075 std::string message = webrtc::SdpSerialize(jsep_desc, false); | 1964 std::string message = webrtc::SdpSerialize(jsep_desc, false); |
| 2076 | 1965 |
| 2077 std::string expected_sdp = kSdpString; | 1966 std::string expected_sdp = kSdpString; |
| 2078 expected_sdp.append(kSdpSctpDataChannelString); | 1967 expected_sdp.append(kSdpSctpDataChannelString); |
| 2079 EXPECT_EQ(message, expected_sdp); | 1968 EXPECT_EQ(message, expected_sdp); |
| 2080 } | 1969 } |
| 2081 | 1970 |
| 2082 TEST_F(WebRtcSdpTest, SerializeWithSctpDataChannelAndNewPort) { | 1971 TEST_F(WebRtcSdpTest, SerializeWithSctpDataChannelAndNewPort) { |
| 2083 bool use_sctpmap = true; | 1972 bool use_sctpmap = true; |
| 2084 AddSctpDataChannel(use_sctpmap); | 1973 AddSctpDataChannel(use_sctpmap); |
| 2085 JsepSessionDescription jsep_desc(kDummyString); | 1974 JsepSessionDescription jsep_desc(kDummyString); |
| 2086 | 1975 MakeDescriptionWithoutCandidates(&jsep_desc); |
| 2087 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | |
| 2088 DataContentDescription* dcdesc = static_cast<DataContentDescription*>( | 1976 DataContentDescription* dcdesc = static_cast<DataContentDescription*>( |
| 2089 jsep_desc.description()->GetContentDescriptionByName(kDataContentName)); | 1977 jsep_desc.description()->GetContentDescriptionByName(kDataContentName)); |
| 2090 | 1978 |
| 2091 const int kNewPort = 1234; | 1979 const int kNewPort = 1234; |
| 2092 cricket::DataCodec codec(cricket::kGoogleSctpDataCodecPlType, | 1980 cricket::DataCodec codec(cricket::kGoogleSctpDataCodecPlType, |
| 2093 cricket::kGoogleSctpDataCodecName); | 1981 cricket::kGoogleSctpDataCodecName); |
| 2094 codec.SetParam(cricket::kCodecParamPort, kNewPort); | 1982 codec.SetParam(cricket::kCodecParamPort, kNewPort); |
| 2095 dcdesc->AddOrReplaceCodec(codec); | 1983 dcdesc->AddOrReplaceCodec(codec); |
| 2096 | 1984 |
| 2097 std::string message = webrtc::SdpSerialize(jsep_desc, false); | 1985 std::string message = webrtc::SdpSerialize(jsep_desc, false); |
| 2098 | 1986 |
| 2099 std::string expected_sdp = kSdpString; | 1987 std::string expected_sdp = kSdpString; |
| 2100 expected_sdp.append(kSdpSctpDataChannelString); | 1988 expected_sdp.append(kSdpSctpDataChannelString); |
| 2101 | 1989 |
| 2102 char default_portstr[16]; | 1990 char default_portstr[16]; |
| 2103 char new_portstr[16]; | 1991 char new_portstr[16]; |
| 2104 rtc::sprintfn(default_portstr, sizeof(default_portstr), "%d", | 1992 rtc::sprintfn(default_portstr, sizeof(default_portstr), "%d", |
| 2105 kDefaultSctpPort); | 1993 kDefaultSctpPort); |
| 2106 rtc::sprintfn(new_portstr, sizeof(new_portstr), "%d", kNewPort); | 1994 rtc::sprintfn(new_portstr, sizeof(new_portstr), "%d", kNewPort); |
| 2107 rtc::replace_substrs(default_portstr, strlen(default_portstr), | 1995 rtc::replace_substrs(default_portstr, strlen(default_portstr), |
| 2108 new_portstr, strlen(new_portstr), | 1996 new_portstr, strlen(new_portstr), |
| 2109 &expected_sdp); | 1997 &expected_sdp); |
| 2110 | 1998 |
| 2111 EXPECT_EQ(expected_sdp, message); | 1999 EXPECT_EQ(expected_sdp, message); |
| 2112 } | 2000 } |
| 2113 | 2001 |
| 2114 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithDataChannelAndBandwidth) { | 2002 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithDataChannelAndBandwidth) { |
| 2003 JsepSessionDescription jsep_desc(kDummyString); |
| 2115 AddRtpDataChannel(); | 2004 AddRtpDataChannel(); |
| 2116 data_desc_->set_bandwidth(100*1000); | 2005 data_desc_->set_bandwidth(100*1000); |
| 2117 JsepSessionDescription jsep_desc(kDummyString); | 2006 MakeDescriptionWithoutCandidates(&jsep_desc); |
| 2118 | |
| 2119 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); | |
| 2120 std::string message = webrtc::SdpSerialize(jsep_desc, false); | 2007 std::string message = webrtc::SdpSerialize(jsep_desc, false); |
| 2121 | 2008 |
| 2122 std::string expected_sdp = kSdpString; | 2009 std::string expected_sdp = kSdpString; |
| 2123 expected_sdp.append(kSdpRtpDataChannelString); | 2010 expected_sdp.append(kSdpRtpDataChannelString); |
| 2124 // Serializing data content shouldn't ignore bandwidth settings. | 2011 // Serializing data content shouldn't ignore bandwidth settings. |
| 2125 InjectAfter("m=application 9 RTP/SAVPF 101\r\nc=IN IP4 0.0.0.0\r\n", | 2012 InjectAfter("m=application 9 RTP/SAVPF 101\r\nc=IN IP4 0.0.0.0\r\n", |
| 2126 "b=AS:100\r\n", | 2013 "b=AS:100\r\n", |
| 2127 &expected_sdp); | 2014 &expected_sdp); |
| 2128 EXPECT_EQ(expected_sdp, message); | 2015 EXPECT_EQ(expected_sdp, message); |
| 2129 } | 2016 } |
| 2130 | 2017 |
| 2131 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithExtmap) { | 2018 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithExtmap) { |
| 2132 AddExtmap(); | 2019 AddExtmap(); |
| 2133 JsepSessionDescription desc_with_extmap("dummy"); | 2020 JsepSessionDescription desc_with_extmap("dummy"); |
| 2134 ASSERT_TRUE(desc_with_extmap.Initialize(desc_.Copy(), | 2021 MakeDescriptionWithoutCandidates(&desc_with_extmap); |
| 2135 kSessionId, kSessionVersion)); | |
| 2136 std::string message = webrtc::SdpSerialize(desc_with_extmap, false); | 2022 std::string message = webrtc::SdpSerialize(desc_with_extmap, false); |
| 2137 | 2023 |
| 2138 std::string sdp_with_extmap = kSdpString; | 2024 std::string sdp_with_extmap = kSdpString; |
| 2139 InjectAfter("a=mid:audio_content_name\r\n", | 2025 InjectAfter("a=mid:audio_content_name\r\n", |
| 2140 kExtmap, &sdp_with_extmap); | 2026 kExtmap, &sdp_with_extmap); |
| 2141 InjectAfter("a=mid:video_content_name\r\n", | 2027 InjectAfter("a=mid:video_content_name\r\n", |
| 2142 kExtmap, &sdp_with_extmap); | 2028 kExtmap, &sdp_with_extmap); |
| 2143 | 2029 |
| 2144 EXPECT_EQ(sdp_with_extmap, message); | 2030 EXPECT_EQ(sdp_with_extmap, message); |
| 2145 } | 2031 } |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3497 "s=-\r\n" | 3383 "s=-\r\n" |
| 3498 "t=0 0\r\n" | 3384 "t=0 0\r\n" |
| 3499 "m=audio 9 RTP/SAVPF 111\r\n" | 3385 "m=audio 9 RTP/SAVPF 111\r\n" |
| 3500 "c=IN IP4 0.0.0.0\r\n" | 3386 "c=IN IP4 0.0.0.0\r\n" |
| 3501 "a=rtpmap:111 opus/48000/2\r\n" | 3387 "a=rtpmap:111 opus/48000/2\r\n" |
| 3502 "a=msid: track_id\r\n"; | 3388 "a=msid: track_id\r\n"; |
| 3503 | 3389 |
| 3504 JsepSessionDescription jdesc_output(kDummyString); | 3390 JsepSessionDescription jdesc_output(kDummyString); |
| 3505 EXPECT_FALSE(SdpDeserialize(kSdpWithMissingStreamId, &jdesc_output)); | 3391 EXPECT_FALSE(SdpDeserialize(kSdpWithMissingStreamId, &jdesc_output)); |
| 3506 } | 3392 } |
| 3393 |
| 3394 // Tests that if both session-level address and media-level address exist, use |
| 3395 // the media-level address. |
| 3396 TEST_F(WebRtcSdpTest, ParseConnectionData) { |
| 3397 JsepSessionDescription jsep_desc(kDummyString); |
| 3398 |
| 3399 // Sesssion-level address. |
| 3400 std::string sdp = kSdpFullString; |
| 3401 InjectAfter("s=-\r\n", "c=IN IP4 192.168.0.3\r\n", &sdp); |
| 3402 EXPECT_TRUE(SdpDeserialize(sdp, &jsep_desc)); |
| 3403 |
| 3404 const auto& content1 = jsep_desc.description()->contents()[0]; |
| 3405 EXPECT_EQ("74.125.127.126:2345", |
| 3406 static_cast<cricket::MediaContentDescription*>(content1.description) |
| 3407 ->connection_address() |
| 3408 .ToString()); |
| 3409 const auto& content2 = jsep_desc.description()->contents()[1]; |
| 3410 EXPECT_EQ("74.125.224.39:3457", |
| 3411 static_cast<cricket::MediaContentDescription*>(content2.description) |
| 3412 ->connection_address() |
| 3413 .ToString()); |
| 3414 } |
| 3415 |
| 3416 // Tests that the session-level connection address will be used if the media |
| 3417 // level-addresses are not specified. |
| 3418 TEST_F(WebRtcSdpTest, ParseConnectionDataSessionLevelOnly) { |
| 3419 JsepSessionDescription jsep_desc(kDummyString); |
| 3420 |
| 3421 // Sesssion-level address. |
| 3422 std::string sdp = kSdpString; |
| 3423 InjectAfter("s=-\r\n", "c=IN IP4 192.168.0.3\r\n", &sdp); |
| 3424 // Remove the media level addresses. |
| 3425 Replace("c=IN IP4 0.0.0.0\r\n", "", &sdp); |
| 3426 Replace("c=IN IP4 0.0.0.0\r\n", "", &sdp); |
| 3427 EXPECT_TRUE(SdpDeserialize(sdp, &jsep_desc)); |
| 3428 |
| 3429 const auto& content1 = jsep_desc.description()->contents()[0]; |
| 3430 EXPECT_EQ("192.168.0.3:9", |
| 3431 static_cast<cricket::MediaContentDescription*>(content1.description) |
| 3432 ->connection_address() |
| 3433 .ToString()); |
| 3434 const auto& content2 = jsep_desc.description()->contents()[1]; |
| 3435 EXPECT_EQ("192.168.0.3:9", |
| 3436 static_cast<cricket::MediaContentDescription*>(content2.description) |
| 3437 ->connection_address() |
| 3438 .ToString()); |
| 3439 } |
| 3440 |
| 3441 TEST_F(WebRtcSdpTest, ParseConnectionDataIPv6) { |
| 3442 JsepSessionDescription jsep_desc(kDummyString); |
| 3443 |
| 3444 std::string sdp = kSdpString; |
| 3445 EXPECT_TRUE(SdpDeserialize(sdp, &jsep_desc)); |
| 3446 Replace("m=audio 9 RTP/SAVPF 111 103 104\r\nc=IN IP4 0.0.0.0\r\n", |
| 3447 "m=audio 9 RTP/SAVPF 111 103 104\r\nc=IN IP6 " |
| 3448 "2001:0db8:85a3:0000:0000:8a2e:0370:7335\r\n", |
| 3449 &sdp); |
| 3450 Replace("m=video 9 RTP/SAVPF 120\r\nc=IN IP4 0.0.0.0\r\n", |
| 3451 "m=video 9 RTP/SAVPF 120\r\nc=IN IP6 " |
| 3452 "2001:0db8:85a3:0000:0000:8a2e:0370:7336\r\n", |
| 3453 &sdp); |
| 3454 EXPECT_TRUE(SdpDeserialize(sdp, &jsep_desc)); |
| 3455 const auto& content1 = jsep_desc.description()->contents()[0]; |
| 3456 EXPECT_EQ("[2001:db8:85a3::8a2e:370:7335]:9", |
| 3457 static_cast<cricket::MediaContentDescription*>(content1.description) |
| 3458 ->connection_address() |
| 3459 .ToString()); |
| 3460 const auto& content2 = jsep_desc.description()->contents()[1]; |
| 3461 EXPECT_EQ("[2001:db8:85a3::8a2e:370:7336]:9", |
| 3462 static_cast<cricket::MediaContentDescription*>(content2.description) |
| 3463 ->connection_address() |
| 3464 .ToString()); |
| 3465 } |
| 3466 |
| 3467 // Test that the invalid or unsupprted connection data cannot be parsed. |
| 3468 TEST_F(WebRtcSdpTest, ParseConnectionDataFailure) { |
| 3469 JsepSessionDescription jsep_desc(kDummyString); |
| 3470 std::string sdp = kSdpString; |
| 3471 EXPECT_TRUE(SdpDeserialize(sdp, &jsep_desc)); |
| 3472 |
| 3473 // Unsupported multicast IPv4 address. |
| 3474 sdp = kSdpFullString; |
| 3475 Replace("c=IN IP4 74.125.224.39\r\n", "c=IN IP4 74.125.224.39/127\r\n", &sdp); |
| 3476 EXPECT_FALSE(SdpDeserialize(sdp, &jsep_desc)); |
| 3477 |
| 3478 // Unsupported multicast IPv6 address. |
| 3479 sdp = kSdpFullString; |
| 3480 Replace("c=IN IP4 74.125.224.39\r\n", "c=IN IP6 ::1/3\r\n", &sdp); |
| 3481 EXPECT_FALSE(SdpDeserialize(sdp, &jsep_desc)); |
| 3482 |
| 3483 // Mismatched address type. |
| 3484 sdp = kSdpFullString; |
| 3485 Replace("c=IN IP4 74.125.224.39\r\n", "c=IN IP6 74.125.224.39\r\n", &sdp); |
| 3486 EXPECT_FALSE(SdpDeserialize(sdp, &jsep_desc)); |
| 3487 |
| 3488 sdp = kSdpFullString; |
| 3489 Replace("c=IN IP4 74.125.224.39\r\n", |
| 3490 "c=IN IP4 2001:0db8:85a3:0000:0000:8a2e:0370:7334\r\n", &sdp); |
| 3491 EXPECT_FALSE(SdpDeserialize(sdp, &jsep_desc)); |
| 3492 } |
| 3493 |
| 3494 TEST_F(WebRtcSdpTest, SerializeAndDeserializeWithConnectionAddress) { |
| 3495 JsepSessionDescription expected_jsep(kDummyString); |
| 3496 MakeDescriptionWithoutCandidates(&expected_jsep); |
| 3497 // Serialization. |
| 3498 std::string message = webrtc::SdpSerialize(expected_jsep, false); |
| 3499 // Deserialization. |
| 3500 JsepSessionDescription jdesc(kDummyString); |
| 3501 EXPECT_TRUE(SdpDeserialize(message, &jdesc)); |
| 3502 auto audio_desc = static_cast<cricket::MediaContentDescription*>( |
| 3503 jdesc.description()->GetContentByName(kAudioContentName)->description); |
| 3504 auto video_desc = static_cast<cricket::MediaContentDescription*>( |
| 3505 jdesc.description()->GetContentByName(kVideoContentName)->description); |
| 3506 EXPECT_EQ(audio_desc_->connection_address().ToString(), |
| 3507 audio_desc->connection_address().ToString()); |
| 3508 EXPECT_EQ(video_desc_->connection_address().ToString(), |
| 3509 video_desc->connection_address().ToString()); |
| 3510 } |
| OLD | NEW |