Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: talk/app/webrtc/webrtcsdp_unittest.cc

Issue 1498993002: Add ufrag to the ICE candidate signaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 static const char kSdpFullString[] = 129 static const char kSdpFullString[] =
130 "v=0\r\n" 130 "v=0\r\n"
131 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 131 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
132 "s=-\r\n" 132 "s=-\r\n"
133 "t=0 0\r\n" 133 "t=0 0\r\n"
134 "a=msid-semantic: WMS local_stream_1 local_stream_2\r\n" 134 "a=msid-semantic: WMS local_stream_1 local_stream_2\r\n"
135 "m=audio 2345 RTP/SAVPF 111 103 104\r\n" 135 "m=audio 2345 RTP/SAVPF 111 103 104\r\n"
136 "c=IN IP4 74.125.127.126\r\n" 136 "c=IN IP4 74.125.127.126\r\n"
137 "a=rtcp:2347 IN IP4 74.125.127.126\r\n" 137 "a=rtcp:2347 IN IP4 74.125.127.126\r\n"
138 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " 138 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host "
139 "generation 2\r\n" 139 "generation 2 username ufrag_voice\r\n"
140 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host " 140 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host "
141 "generation 2\r\n" 141 "generation 2 username ufrag_voice\r\n"
142 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host " 142 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host "
143 "generation 2\r\n" 143 "generation 2 username ufrag_voice\r\n"
144 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host " 144 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host "
145 "generation 2\r\n" 145 "generation 2 username ufrag_voice\r\n"
146 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx " 146 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx "
147 "raddr 192.168.1.5 rport 2346 " 147 "raddr 192.168.1.5 rport 2346 "
148 "generation 2\r\n" 148 "generation 2 username ufrag_voice\r\n"
149 "a=candidate:a0+B/3 2 udp 2130706432 74.125.127.126 2347 typ srflx " 149 "a=candidate:a0+B/3 2 udp 2130706432 74.125.127.126 2347 typ srflx "
150 "raddr 192.168.1.5 rport 2348 " 150 "raddr 192.168.1.5 rport 2348 "
151 "generation 2\r\n" 151 "generation 2 username ufrag_voice\r\n"
152 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n" 152 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n"
153 "a=mid:audio_content_name\r\n" 153 "a=mid:audio_content_name\r\n"
154 "a=sendrecv\r\n" 154 "a=sendrecv\r\n"
155 "a=rtcp-mux\r\n" 155 "a=rtcp-mux\r\n"
156 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " 156 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 "
157 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " 157 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 "
158 "dummy_session_params\r\n" 158 "dummy_session_params\r\n"
159 "a=rtpmap:111 opus/48000/2\r\n" 159 "a=rtpmap:111 opus/48000/2\r\n"
160 "a=rtpmap:103 ISAC/16000\r\n" 160 "a=rtpmap:103 ISAC/16000\r\n"
161 "a=rtpmap:104 ISAC/32000\r\n" 161 "a=rtpmap:104 ISAC/32000\r\n"
162 "a=ssrc:1 cname:stream_1_cname\r\n" 162 "a=ssrc:1 cname:stream_1_cname\r\n"
163 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n" 163 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n"
164 "a=ssrc:1 mslabel:local_stream_1\r\n" 164 "a=ssrc:1 mslabel:local_stream_1\r\n"
165 "a=ssrc:1 label:audio_track_id_1\r\n" 165 "a=ssrc:1 label:audio_track_id_1\r\n"
166 "a=ssrc:4 cname:stream_2_cname\r\n" 166 "a=ssrc:4 cname:stream_2_cname\r\n"
167 "a=ssrc:4 msid:local_stream_2 audio_track_id_2\r\n" 167 "a=ssrc:4 msid:local_stream_2 audio_track_id_2\r\n"
168 "a=ssrc:4 mslabel:local_stream_2\r\n" 168 "a=ssrc:4 mslabel:local_stream_2\r\n"
169 "a=ssrc:4 label:audio_track_id_2\r\n" 169 "a=ssrc:4 label:audio_track_id_2\r\n"
170 "m=video 3457 RTP/SAVPF 120\r\n" 170 "m=video 3457 RTP/SAVPF 120\r\n"
171 "c=IN IP4 74.125.224.39\r\n" 171 "c=IN IP4 74.125.224.39\r\n"
172 "a=rtcp:3456 IN IP4 74.125.224.39\r\n" 172 "a=rtcp:3456 IN IP4 74.125.224.39\r\n"
173 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host " 173 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host "
174 "generation 2\r\n" 174 "generation 2 username ufrag_video\r\n"
175 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host " 175 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host "
176 "generation 2\r\n" 176 "generation 2 username ufrag_video\r\n"
177 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host " 177 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host "
178 "generation 2\r\n" 178 "generation 2 username ufrag_video\r\n"
179 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host " 179 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host "
180 "generation 2\r\n" 180 "generation 2 username ufrag_video\r\n"
181 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay " 181 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay "
182 "generation 2\r\n" 182 "generation 2 username ufrag_video\r\n"
183 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay " 183 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay "
184 "generation 2\r\n" 184 "generation 2 username ufrag_video\r\n"
185 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" 185 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n"
186 "a=mid:video_content_name\r\n" 186 "a=mid:video_content_name\r\n"
187 "a=sendrecv\r\n" 187 "a=sendrecv\r\n"
188 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " 188 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
189 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" 189 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n"
190 "a=rtpmap:120 VP8/90000\r\n" 190 "a=rtpmap:120 VP8/90000\r\n"
191 "a=ssrc:2 cname:stream_1_cname\r\n" 191 "a=ssrc:2 cname:stream_1_cname\r\n"
192 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n" 192 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n"
193 "a=ssrc:2 mslabel:local_stream_1\r\n" 193 "a=ssrc:2 mslabel:local_stream_1\r\n"
194 "a=ssrc:2 label:video_track_id_1\r\n" 194 "a=ssrc:2 label:video_track_id_1\r\n"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 "a=sctp-port:5000\r\n" 301 "a=sctp-port:5000\r\n"
302 "c=IN IP4 0.0.0.0\r\n" 302 "c=IN IP4 0.0.0.0\r\n"
303 "a=ice-ufrag:ufrag_data\r\n" 303 "a=ice-ufrag:ufrag_data\r\n"
304 "a=ice-pwd:pwd_data\r\n" 304 "a=ice-pwd:pwd_data\r\n"
305 "a=mid:data_content_name\r\n"; 305 "a=mid:data_content_name\r\n";
306 306
307 static const char kSdpSctpDataChannelWithCandidatesString[] = 307 static const char kSdpSctpDataChannelWithCandidatesString[] =
308 "m=application 2345 DTLS/SCTP 5000\r\n" 308 "m=application 2345 DTLS/SCTP 5000\r\n"
309 "c=IN IP4 74.125.127.126\r\n" 309 "c=IN IP4 74.125.127.126\r\n"
310 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " 310 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host "
311 "generation 2\r\n" 311 "generation 2 username ufrag_data\r\n"
312 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host " 312 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host "
313 "generation 2\r\n" 313 "generation 2 username ufrag_data\r\n"
314 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx " 314 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx "
315 "raddr 192.168.1.5 rport 2346 " 315 "raddr 192.168.1.5 rport 2346 "
316 "generation 2\r\n" 316 "generation 2 username ufrag_data\r\n"
317 "a=ice-ufrag:ufrag_data\r\n" 317 "a=ice-ufrag:ufrag_data\r\n"
318 "a=ice-pwd:pwd_data\r\n" 318 "a=ice-pwd:pwd_data\r\n"
319 "a=mid:data_content_name\r\n" 319 "a=mid:data_content_name\r\n"
320 "a=sctpmap:5000 webrtc-datachannel 1024\r\n"; 320 "a=sctpmap:5000 webrtc-datachannel 1024\r\n";
321 321
322 static const char kSdpConferenceString[] = 322 static const char kSdpConferenceString[] =
323 "v=0\r\n" 323 "v=0\r\n"
324 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 324 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
325 "s=-\r\n" 325 "s=-\r\n"
326 "t=0 0\r\n" 326 "t=0 0\r\n"
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 kExtmap, &sdp_with_extmap); 1714 kExtmap, &sdp_with_extmap);
1715 InjectAfter("a=mid:video_content_name\r\n", 1715 InjectAfter("a=mid:video_content_name\r\n",
1716 kExtmap, &sdp_with_extmap); 1716 kExtmap, &sdp_with_extmap);
1717 1717
1718 EXPECT_EQ(sdp_with_extmap, message); 1718 EXPECT_EQ(sdp_with_extmap, message);
1719 } 1719 }
1720 1720
1721 TEST_F(WebRtcSdpTest, SerializeCandidates) { 1721 TEST_F(WebRtcSdpTest, SerializeCandidates) {
1722 std::string message = webrtc::SdpSerializeCandidate(*jcandidate_); 1722 std::string message = webrtc::SdpSerializeCandidate(*jcandidate_);
1723 EXPECT_EQ(std::string(kRawCandidate), message); 1723 EXPECT_EQ(std::string(kRawCandidate), message);
1724
1725 Candidate candidate_with_ufrag(candidates_.front());
1726 candidate_with_ufrag.set_username("ABC");
1727 jcandidate_.reset(new JsepIceCandidate(std::string("audio_content_name"), 0,
1728 candidate_with_ufrag));
1729 message = webrtc::SdpSerializeCandidate(*jcandidate_);
1730 EXPECT_EQ(std::string(kRawCandidate) + " username ABC", message);
1724 } 1731 }
1725 1732
1726 // TODO(mallinath) : Enable this test once WebRTCSdp capable of parsing 1733 // TODO(mallinath) : Enable this test once WebRTCSdp capable of parsing
1727 // RFC 6544. 1734 // RFC 6544.
1728 TEST_F(WebRtcSdpTest, SerializeTcpCandidates) { 1735 TEST_F(WebRtcSdpTest, SerializeTcpCandidates) {
1729 Candidate candidate(ICE_CANDIDATE_COMPONENT_RTP, "tcp", 1736 Candidate candidate(ICE_CANDIDATE_COMPONENT_RTP, "tcp",
1730 rtc::SocketAddress("192.168.1.5", 9), kCandidatePriority, 1737 rtc::SocketAddress("192.168.1.5", 9), kCandidatePriority,
1731 "", "", LOCAL_PORT_TYPE, kCandidateGeneration, 1738 "", "", LOCAL_PORT_TYPE, kCandidateGeneration,
1732 kCandidateFoundation1); 1739 kCandidateFoundation1);
1733 candidate.set_tcptype(cricket::TCPTYPE_ACTIVE_STR); 1740 candidate.set_tcptype(cricket::TCPTYPE_ACTIVE_STR);
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 const cricket::MediaContentDescription* mdesc = 2708 const cricket::MediaContentDescription* mdesc =
2702 static_cast<const cricket::MediaContentDescription*>( 2709 static_cast<const cricket::MediaContentDescription*>(
2703 desc->contents()[i].description); 2710 desc->contents()[i].description);
2704 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); 2711 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type());
2705 } 2712 }
2706 2713
2707 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); 2714 std::string serialized_sdp = webrtc::SdpSerialize(jdesc);
2708 EXPECT_EQ(sdp_string, serialized_sdp); 2715 EXPECT_EQ(sdp_string, serialized_sdp);
2709 } 2716 }
2710 } 2717 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698