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 26 matching lines...) Expand all Loading... |
37 using cricket::CryptoParams; | 37 using cricket::CryptoParams; |
38 using cricket::ContentGroup; | 38 using cricket::ContentGroup; |
39 using cricket::DataCodec; | 39 using cricket::DataCodec; |
40 using cricket::DataContentDescription; | 40 using cricket::DataContentDescription; |
41 using cricket::ICE_CANDIDATE_COMPONENT_RTCP; | 41 using cricket::ICE_CANDIDATE_COMPONENT_RTCP; |
42 using cricket::ICE_CANDIDATE_COMPONENT_RTP; | 42 using cricket::ICE_CANDIDATE_COMPONENT_RTP; |
43 using cricket::kFecSsrcGroupSemantics; | 43 using cricket::kFecSsrcGroupSemantics; |
44 using cricket::LOCAL_PORT_TYPE; | 44 using cricket::LOCAL_PORT_TYPE; |
45 using cricket::NS_JINGLE_DRAFT_SCTP; | 45 using cricket::NS_JINGLE_DRAFT_SCTP; |
46 using cricket::NS_JINGLE_RTP; | 46 using cricket::NS_JINGLE_RTP; |
47 using cricket::RtpHeaderExtension; | |
48 using cricket::RELAY_PORT_TYPE; | 47 using cricket::RELAY_PORT_TYPE; |
49 using cricket::SessionDescription; | 48 using cricket::SessionDescription; |
50 using cricket::StreamParams; | 49 using cricket::StreamParams; |
51 using cricket::STUN_PORT_TYPE; | 50 using cricket::STUN_PORT_TYPE; |
52 using cricket::TransportDescription; | 51 using cricket::TransportDescription; |
53 using cricket::TransportInfo; | 52 using cricket::TransportInfo; |
54 using cricket::VideoCodec; | 53 using cricket::VideoCodec; |
55 using cricket::VideoContentDescription; | 54 using cricket::VideoContentDescription; |
56 using webrtc::IceCandidateCollection; | 55 using webrtc::IceCandidateCollection; |
57 using webrtc::IceCandidateInterface; | 56 using webrtc::IceCandidateInterface; |
58 using webrtc::JsepIceCandidate; | 57 using webrtc::JsepIceCandidate; |
59 using webrtc::JsepSessionDescription; | 58 using webrtc::JsepSessionDescription; |
| 59 using webrtc::RtpExtension; |
60 using webrtc::SdpParseError; | 60 using webrtc::SdpParseError; |
61 using webrtc::SessionDescriptionInterface; | 61 using webrtc::SessionDescriptionInterface; |
62 | 62 |
63 typedef std::vector<AudioCodec> AudioCodecs; | 63 typedef std::vector<AudioCodec> AudioCodecs; |
64 typedef std::vector<Candidate> Candidates; | 64 typedef std::vector<Candidate> Candidates; |
65 | 65 |
66 static const uint32_t kDefaultSctpPort = 5000; | 66 static const uint32_t kDefaultSctpPort = 5000; |
67 static const char kSessionTime[] = "t=0 0\r\n"; | 67 static const char kSessionTime[] = "t=0 0\r\n"; |
68 static const uint32_t kCandidatePriority = 2130706432U; // pref = 1.0 | 68 static const uint32_t kCandidatePriority = 2130706432U; // pref = 1.0 |
69 static const char kAttributeIceUfragVoice[] = "a=ice-ufrag:ufrag_voice\r\n"; | 69 static const char kAttributeIceUfragVoice[] = "a=ice-ufrag:ufrag_voice\r\n"; |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 // bandwidth | 1103 // bandwidth |
1104 EXPECT_EQ(cd1->bandwidth(), cd2->bandwidth()); | 1104 EXPECT_EQ(cd1->bandwidth(), cd2->bandwidth()); |
1105 | 1105 |
1106 // streams | 1106 // streams |
1107 EXPECT_EQ(cd1->streams(), cd2->streams()); | 1107 EXPECT_EQ(cd1->streams(), cd2->streams()); |
1108 | 1108 |
1109 // extmap | 1109 // extmap |
1110 ASSERT_EQ(cd1->rtp_header_extensions().size(), | 1110 ASSERT_EQ(cd1->rtp_header_extensions().size(), |
1111 cd2->rtp_header_extensions().size()); | 1111 cd2->rtp_header_extensions().size()); |
1112 for (size_t i = 0; i< cd1->rtp_header_extensions().size(); ++i) { | 1112 for (size_t i = 0; i< cd1->rtp_header_extensions().size(); ++i) { |
1113 const RtpHeaderExtension ext1 = cd1->rtp_header_extensions().at(i); | 1113 const RtpExtension ext1 = cd1->rtp_header_extensions().at(i); |
1114 const RtpHeaderExtension ext2 = cd2->rtp_header_extensions().at(i); | 1114 const RtpExtension ext2 = cd2->rtp_header_extensions().at(i); |
1115 EXPECT_EQ(ext1.uri, ext2.uri); | 1115 EXPECT_EQ(ext1.uri, ext2.uri); |
1116 EXPECT_EQ(ext1.id, ext2.id); | 1116 EXPECT_EQ(ext1.id, ext2.id); |
1117 } | 1117 } |
1118 } | 1118 } |
1119 | 1119 |
1120 | 1120 |
1121 void CompareSessionDescription(const SessionDescription& desc1, | 1121 void CompareSessionDescription(const SessionDescription& desc1, |
1122 const SessionDescription& desc2) { | 1122 const SessionDescription& desc2) { |
1123 // Compare content descriptions. | 1123 // Compare content descriptions. |
1124 if (desc1.contents().size() != desc2.contents().size()) { | 1124 if (desc1.contents().size() != desc2.contents().size()) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 TransportDescription(std::vector<std::string>(), kUfragVideo, kPwdVideo, | 1326 TransportDescription(std::vector<std::string>(), kUfragVideo, kPwdVideo, |
1327 cricket::ICEMODE_FULL, | 1327 cricket::ICEMODE_FULL, |
1328 cricket::CONNECTIONROLE_NONE, &fingerprint)))); | 1328 cricket::CONNECTIONROLE_NONE, &fingerprint)))); |
1329 } | 1329 } |
1330 | 1330 |
1331 void AddExtmap() { | 1331 void AddExtmap() { |
1332 audio_desc_ = static_cast<AudioContentDescription*>( | 1332 audio_desc_ = static_cast<AudioContentDescription*>( |
1333 audio_desc_->Copy()); | 1333 audio_desc_->Copy()); |
1334 video_desc_ = static_cast<VideoContentDescription*>( | 1334 video_desc_ = static_cast<VideoContentDescription*>( |
1335 video_desc_->Copy()); | 1335 video_desc_->Copy()); |
1336 audio_desc_->AddRtpHeaderExtension( | 1336 audio_desc_->AddRtpHeaderExtension(RtpExtension(kExtmapUri, kExtmapId)); |
1337 RtpHeaderExtension(kExtmapUri, kExtmapId)); | 1337 video_desc_->AddRtpHeaderExtension(RtpExtension(kExtmapUri, kExtmapId)); |
1338 video_desc_->AddRtpHeaderExtension( | |
1339 RtpHeaderExtension(kExtmapUri, kExtmapId)); | |
1340 desc_.RemoveContentByName(kAudioContentName); | 1338 desc_.RemoveContentByName(kAudioContentName); |
1341 desc_.RemoveContentByName(kVideoContentName); | 1339 desc_.RemoveContentByName(kVideoContentName); |
1342 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_); | 1340 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_); |
1343 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_desc_); | 1341 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_desc_); |
1344 } | 1342 } |
1345 | 1343 |
1346 void RemoveCryptos() { | 1344 void RemoveCryptos() { |
1347 audio_desc_->set_cryptos(std::vector<CryptoParams>()); | 1345 audio_desc_->set_cryptos(std::vector<CryptoParams>()); |
1348 video_desc_->set_cryptos(std::vector<CryptoParams>()); | 1346 video_desc_->set_cryptos(std::vector<CryptoParams>()); |
1349 } | 1347 } |
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3142 EXPECT_TRUE( | 3140 EXPECT_TRUE( |
3143 SdpDeserialize(kUnifiedPlanSdpFullString, &deserialized_description)); | 3141 SdpDeserialize(kUnifiedPlanSdpFullString, &deserialized_description)); |
3144 | 3142 |
3145 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description)); | 3143 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description)); |
3146 } | 3144 } |
3147 | 3145 |
3148 TEST_F(WebRtcSdpTest, SerializeUnifiedPlanSessionDescription) { | 3146 TEST_F(WebRtcSdpTest, SerializeUnifiedPlanSessionDescription) { |
3149 MakeUnifiedPlanDescription(); | 3147 MakeUnifiedPlanDescription(); |
3150 TestSerialize(jdesc_, true); | 3148 TestSerialize(jdesc_, true); |
3151 } | 3149 } |
OLD | NEW |