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

Side by Side Diff: webrtc/api/webrtcsdp_unittest.cc

Issue 1688383002: Implementing unified plan encoding of msid. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merging with master. Created 4 years, 10 months 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
« webrtc/api/webrtcsdp.cc ('K') | « webrtc/api/webrtcsdp.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 using webrtc::JsepSessionDescription; 57 using webrtc::JsepSessionDescription;
58 using webrtc::SdpParseError; 58 using webrtc::SdpParseError;
59 using webrtc::SessionDescriptionInterface; 59 using webrtc::SessionDescriptionInterface;
60 60
61 typedef std::vector<AudioCodec> AudioCodecs; 61 typedef std::vector<AudioCodec> AudioCodecs;
62 typedef std::vector<Candidate> Candidates; 62 typedef std::vector<Candidate> Candidates;
63 63
64 static const uint32_t kDefaultSctpPort = 5000; 64 static const uint32_t kDefaultSctpPort = 5000;
65 static const char kSessionTime[] = "t=0 0\r\n"; 65 static const char kSessionTime[] = "t=0 0\r\n";
66 static const uint32_t kCandidatePriority = 2130706432U; // pref = 1.0 66 static const uint32_t kCandidatePriority = 2130706432U; // pref = 1.0
67 static const char kCandidateUfragVoice[] = "ufrag_voice";
68 static const char kCandidatePwdVoice[] = "pwd_voice";
69 static const char kAttributeIceUfragVoice[] = "a=ice-ufrag:ufrag_voice\r\n"; 67 static const char kAttributeIceUfragVoice[] = "a=ice-ufrag:ufrag_voice\r\n";
70 static const char kAttributeIcePwdVoice[] = "a=ice-pwd:pwd_voice\r\n"; 68 static const char kAttributeIcePwdVoice[] = "a=ice-pwd:pwd_voice\r\n";
71 static const char kCandidateUfragVideo[] = "ufrag_video";
72 static const char kCandidatePwdVideo[] = "pwd_video";
73 static const char kCandidateUfragData[] = "ufrag_data";
74 static const char kCandidatePwdData[] = "pwd_data";
75 static const char kAttributeIceUfragVideo[] = "a=ice-ufrag:ufrag_video\r\n"; 69 static const char kAttributeIceUfragVideo[] = "a=ice-ufrag:ufrag_video\r\n";
76 static const char kAttributeIcePwdVideo[] = "a=ice-pwd:pwd_video\r\n"; 70 static const char kAttributeIcePwdVideo[] = "a=ice-pwd:pwd_video\r\n";
77 static const uint32_t kCandidateGeneration = 2; 71 static const uint32_t kCandidateGeneration = 2;
78 static const char kCandidateFoundation1[] = "a0+B/1"; 72 static const char kCandidateFoundation1[] = "a0+B/1";
79 static const char kCandidateFoundation2[] = "a0+B/2"; 73 static const char kCandidateFoundation2[] = "a0+B/2";
80 static const char kCandidateFoundation3[] = "a0+B/3"; 74 static const char kCandidateFoundation3[] = "a0+B/3";
81 static const char kCandidateFoundation4[] = "a0+B/4"; 75 static const char kCandidateFoundation4[] = "a0+B/4";
82 static const char kAttributeCryptoVoice[] = 76 static const char kAttributeCryptoVoice[] =
83 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " 77 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 "
84 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " 78 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 "
(...skipping 21 matching lines...) Expand all
106 struct CodecParams { 100 struct CodecParams {
107 int max_ptime; 101 int max_ptime;
108 int ptime; 102 int ptime;
109 int min_ptime; 103 int min_ptime;
110 int sprop_stereo; 104 int sprop_stereo;
111 int stereo; 105 int stereo;
112 int useinband; 106 int useinband;
113 int maxaveragebitrate; 107 int maxaveragebitrate;
114 }; 108 };
115 109
110 // TODO(deadbeef): In these reference strings, use "a=fingerprint" by default
111 // instead of "a=crypto", and have an explicit test for adding "a=crypto".
112 // Currently it's the other way around.
113
116 // Reference sdp string 114 // Reference sdp string
117 static const char kSdpFullString[] = 115 static const char kSdpFullString[] =
118 "v=0\r\n" 116 "v=0\r\n"
119 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 117 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
120 "s=-\r\n" 118 "s=-\r\n"
121 "t=0 0\r\n" 119 "t=0 0\r\n"
122 "a=msid-semantic: WMS local_stream_1 local_stream_2\r\n" 120 "a=msid-semantic: WMS local_stream_1\r\n"
123 "m=audio 2345 RTP/SAVPF 111 103 104\r\n" 121 "m=audio 2345 RTP/SAVPF 111 103 104\r\n"
124 "c=IN IP4 74.125.127.126\r\n" 122 "c=IN IP4 74.125.127.126\r\n"
125 "a=rtcp:2347 IN IP4 74.125.127.126\r\n" 123 "a=rtcp:2347 IN IP4 74.125.127.126\r\n"
126 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " 124 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host "
127 "generation 2\r\n" 125 "generation 2\r\n"
128 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host " 126 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host "
129 "generation 2\r\n" 127 "generation 2\r\n"
130 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host " 128 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host "
131 "generation 2\r\n" 129 "generation 2\r\n"
132 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host " 130 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host "
(...skipping 12 matching lines...) Expand all
145 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " 143 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 "
146 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " 144 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 "
147 "dummy_session_params\r\n" 145 "dummy_session_params\r\n"
148 "a=rtpmap:111 opus/48000/2\r\n" 146 "a=rtpmap:111 opus/48000/2\r\n"
149 "a=rtpmap:103 ISAC/16000\r\n" 147 "a=rtpmap:103 ISAC/16000\r\n"
150 "a=rtpmap:104 ISAC/32000\r\n" 148 "a=rtpmap:104 ISAC/32000\r\n"
151 "a=ssrc:1 cname:stream_1_cname\r\n" 149 "a=ssrc:1 cname:stream_1_cname\r\n"
152 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n" 150 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n"
153 "a=ssrc:1 mslabel:local_stream_1\r\n" 151 "a=ssrc:1 mslabel:local_stream_1\r\n"
154 "a=ssrc:1 label:audio_track_id_1\r\n" 152 "a=ssrc:1 label:audio_track_id_1\r\n"
155 "a=ssrc:4 cname:stream_2_cname\r\n"
156 "a=ssrc:4 msid:local_stream_2 audio_track_id_2\r\n"
157 "a=ssrc:4 mslabel:local_stream_2\r\n"
158 "a=ssrc:4 label:audio_track_id_2\r\n"
159 "m=video 3457 RTP/SAVPF 120\r\n" 153 "m=video 3457 RTP/SAVPF 120\r\n"
160 "c=IN IP4 74.125.224.39\r\n" 154 "c=IN IP4 74.125.224.39\r\n"
161 "a=rtcp:3456 IN IP4 74.125.224.39\r\n" 155 "a=rtcp:3456 IN IP4 74.125.224.39\r\n"
162 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host " 156 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host "
163 "generation 2\r\n" 157 "generation 2\r\n"
164 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host " 158 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host "
165 "generation 2\r\n" 159 "generation 2\r\n"
166 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host " 160 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host "
167 "generation 2\r\n" 161 "generation 2\r\n"
168 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host " 162 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host "
169 "generation 2\r\n" 163 "generation 2\r\n"
170 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay " 164 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay "
171 "generation 2\r\n" 165 "generation 2\r\n"
172 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay " 166 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay "
173 "generation 2\r\n" 167 "generation 2\r\n"
174 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" 168 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n"
175 "a=mid:video_content_name\r\n" 169 "a=mid:video_content_name\r\n"
176 "a=sendrecv\r\n" 170 "a=sendrecv\r\n"
177 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " 171 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
178 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" 172 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n"
179 "a=rtpmap:120 VP8/90000\r\n" 173 "a=rtpmap:120 VP8/90000\r\n"
174 "a=ssrc-group:FEC 2 3\r\n"
180 "a=ssrc:2 cname:stream_1_cname\r\n" 175 "a=ssrc:2 cname:stream_1_cname\r\n"
181 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n" 176 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n"
182 "a=ssrc:2 mslabel:local_stream_1\r\n" 177 "a=ssrc:2 mslabel:local_stream_1\r\n"
183 "a=ssrc:2 label:video_track_id_1\r\n" 178 "a=ssrc:2 label:video_track_id_1\r\n"
184 "a=ssrc:3 cname:stream_1_cname\r\n" 179 "a=ssrc:3 cname:stream_1_cname\r\n"
185 "a=ssrc:3 msid:local_stream_1 video_track_id_2\r\n" 180 "a=ssrc:3 msid:local_stream_1 video_track_id_1\r\n"
186 "a=ssrc:3 mslabel:local_stream_1\r\n" 181 "a=ssrc:3 mslabel:local_stream_1\r\n"
187 "a=ssrc:3 label:video_track_id_2\r\n" 182 "a=ssrc:3 label:video_track_id_1\r\n";
188 "a=ssrc-group:FEC 5 6\r\n"
189 "a=ssrc:5 cname:stream_2_cname\r\n"
190 "a=ssrc:5 msid:local_stream_2 video_track_id_3\r\n"
191 "a=ssrc:5 mslabel:local_stream_2\r\n"
192 "a=ssrc:5 label:video_track_id_3\r\n"
193 "a=ssrc:6 cname:stream_2_cname\r\n"
194 "a=ssrc:6 msid:local_stream_2 video_track_id_3\r\n"
195 "a=ssrc:6 mslabel:local_stream_2\r\n"
196 "a=ssrc:6 label:video_track_id_3\r\n";
197 183
198 // SDP reference string without the candidates. 184 // SDP reference string without the candidates.
199 static const char kSdpString[] = 185 static const char kSdpString[] =
200 "v=0\r\n" 186 "v=0\r\n"
201 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 187 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
202 "s=-\r\n" 188 "s=-\r\n"
203 "t=0 0\r\n" 189 "t=0 0\r\n"
204 "a=msid-semantic: WMS local_stream_1 local_stream_2\r\n" 190 "a=msid-semantic: WMS local_stream_1\r\n"
205 "m=audio 9 RTP/SAVPF 111 103 104\r\n" 191 "m=audio 9 RTP/SAVPF 111 103 104\r\n"
206 "c=IN IP4 0.0.0.0\r\n" 192 "c=IN IP4 0.0.0.0\r\n"
207 "a=rtcp:9 IN IP4 0.0.0.0\r\n" 193 "a=rtcp:9 IN IP4 0.0.0.0\r\n"
208 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n" 194 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n"
209 "a=mid:audio_content_name\r\n" 195 "a=mid:audio_content_name\r\n"
210 "a=sendrecv\r\n" 196 "a=sendrecv\r\n"
211 "a=rtcp-mux\r\n" 197 "a=rtcp-mux\r\n"
212 "a=rtcp-rsize\r\n" 198 "a=rtcp-rsize\r\n"
213 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " 199 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 "
214 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " 200 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 "
215 "dummy_session_params\r\n" 201 "dummy_session_params\r\n"
216 "a=rtpmap:111 opus/48000/2\r\n" 202 "a=rtpmap:111 opus/48000/2\r\n"
217 "a=rtpmap:103 ISAC/16000\r\n" 203 "a=rtpmap:103 ISAC/16000\r\n"
218 "a=rtpmap:104 ISAC/32000\r\n" 204 "a=rtpmap:104 ISAC/32000\r\n"
219 "a=ssrc:1 cname:stream_1_cname\r\n" 205 "a=ssrc:1 cname:stream_1_cname\r\n"
220 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n" 206 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n"
221 "a=ssrc:1 mslabel:local_stream_1\r\n" 207 "a=ssrc:1 mslabel:local_stream_1\r\n"
222 "a=ssrc:1 label:audio_track_id_1\r\n" 208 "a=ssrc:1 label:audio_track_id_1\r\n"
223 "a=ssrc:4 cname:stream_2_cname\r\n"
224 "a=ssrc:4 msid:local_stream_2 audio_track_id_2\r\n"
225 "a=ssrc:4 mslabel:local_stream_2\r\n"
226 "a=ssrc:4 label:audio_track_id_2\r\n"
227 "m=video 9 RTP/SAVPF 120\r\n" 209 "m=video 9 RTP/SAVPF 120\r\n"
228 "c=IN IP4 0.0.0.0\r\n" 210 "c=IN IP4 0.0.0.0\r\n"
229 "a=rtcp:9 IN IP4 0.0.0.0\r\n" 211 "a=rtcp:9 IN IP4 0.0.0.0\r\n"
230 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" 212 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n"
231 "a=mid:video_content_name\r\n" 213 "a=mid:video_content_name\r\n"
232 "a=sendrecv\r\n" 214 "a=sendrecv\r\n"
233 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " 215 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
234 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" 216 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n"
235 "a=rtpmap:120 VP8/90000\r\n" 217 "a=rtpmap:120 VP8/90000\r\n"
218 "a=ssrc-group:FEC 2 3\r\n"
236 "a=ssrc:2 cname:stream_1_cname\r\n" 219 "a=ssrc:2 cname:stream_1_cname\r\n"
237 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n" 220 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n"
238 "a=ssrc:2 mslabel:local_stream_1\r\n" 221 "a=ssrc:2 mslabel:local_stream_1\r\n"
239 "a=ssrc:2 label:video_track_id_1\r\n" 222 "a=ssrc:2 label:video_track_id_1\r\n"
240 "a=ssrc:3 cname:stream_1_cname\r\n" 223 "a=ssrc:3 cname:stream_1_cname\r\n"
241 "a=ssrc:3 msid:local_stream_1 video_track_id_2\r\n" 224 "a=ssrc:3 msid:local_stream_1 video_track_id_1\r\n"
242 "a=ssrc:3 mslabel:local_stream_1\r\n" 225 "a=ssrc:3 mslabel:local_stream_1\r\n"
243 "a=ssrc:3 label:video_track_id_2\r\n" 226 "a=ssrc:3 label:video_track_id_1\r\n";
244 "a=ssrc-group:FEC 5 6\r\n"
245 "a=ssrc:5 cname:stream_2_cname\r\n"
246 "a=ssrc:5 msid:local_stream_2 video_track_id_3\r\n"
247 "a=ssrc:5 mslabel:local_stream_2\r\n"
248 "a=ssrc:5 label:video_track_id_3\r\n"
249 "a=ssrc:6 cname:stream_2_cname\r\n"
250 "a=ssrc:6 msid:local_stream_2 video_track_id_3\r\n"
251 "a=ssrc:6 mslabel:local_stream_2\r\n"
252 "a=ssrc:6 label:video_track_id_3\r\n";
253 227
254 static const char kSdpRtpDataChannelString[] = 228 static const char kSdpRtpDataChannelString[] =
255 "m=application 9 RTP/SAVPF 101\r\n" 229 "m=application 9 RTP/SAVPF 101\r\n"
256 "c=IN IP4 0.0.0.0\r\n" 230 "c=IN IP4 0.0.0.0\r\n"
257 "a=rtcp:9 IN IP4 0.0.0.0\r\n" 231 "a=rtcp:9 IN IP4 0.0.0.0\r\n"
258 "a=ice-ufrag:ufrag_data\r\n" 232 "a=ice-ufrag:ufrag_data\r\n"
259 "a=ice-pwd:pwd_data\r\n" 233 "a=ice-pwd:pwd_data\r\n"
260 "a=mid:data_content_name\r\n" 234 "a=mid:data_content_name\r\n"
261 "a=sendrecv\r\n" 235 "a=sendrecv\r\n"
262 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " 236 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 "a=rtcp:9 IN IP4 0.0.0.0\r\n" 322 "a=rtcp:9 IN IP4 0.0.0.0\r\n"
349 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" 323 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n"
350 "a=mid:video_content_name\r\n" 324 "a=mid:video_content_name\r\n"
351 "a=sendrecv\r\n" 325 "a=sendrecv\r\n"
352 "a=rtpmap:120 VP8/90000\r\n" 326 "a=rtpmap:120 VP8/90000\r\n"
353 "a=ssrc:2 cname:stream_1_cname\r\n" 327 "a=ssrc:2 cname:stream_1_cname\r\n"
354 "a=ssrc:2 msid:local_stream video_track_id_1\r\n" 328 "a=ssrc:2 msid:local_stream video_track_id_1\r\n"
355 "a=ssrc:2 mslabel:local_stream\r\n" 329 "a=ssrc:2 mslabel:local_stream\r\n"
356 "a=ssrc:2 label:video_track_id_1\r\n"; 330 "a=ssrc:2 label:video_track_id_1\r\n";
357 331
332 // Plan B SDP reference string, with 2 streams, 2 audio tracks and 3 video
333 // tracks.
334 static const char kPlanBSdpFullString[] =
335 "v=0\r\n"
336 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
337 "s=-\r\n"
338 "t=0 0\r\n"
339 "a=msid-semantic: WMS local_stream_1 local_stream_2\r\n"
340 "m=audio 2345 RTP/SAVPF 111 103 104\r\n"
341 "c=IN IP4 74.125.127.126\r\n"
342 "a=rtcp:2347 IN IP4 74.125.127.126\r\n"
343 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host "
344 "generation 2\r\n"
345 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host "
346 "generation 2\r\n"
347 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host "
348 "generation 2\r\n"
349 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host "
350 "generation 2\r\n"
351 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx "
352 "raddr 192.168.1.5 rport 2346 "
353 "generation 2\r\n"
354 "a=candidate:a0+B/3 2 udp 2130706432 74.125.127.126 2347 typ srflx "
355 "raddr 192.168.1.5 rport 2348 "
356 "generation 2\r\n"
357 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n"
358 "a=mid:audio_content_name\r\n"
359 "a=sendrecv\r\n"
360 "a=rtcp-mux\r\n"
361 "a=rtcp-rsize\r\n"
362 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 "
363 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 "
364 "dummy_session_params\r\n"
365 "a=rtpmap:111 opus/48000/2\r\n"
366 "a=rtpmap:103 ISAC/16000\r\n"
367 "a=rtpmap:104 ISAC/32000\r\n"
368 "a=ssrc:1 cname:stream_1_cname\r\n"
369 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n"
370 "a=ssrc:1 mslabel:local_stream_1\r\n"
371 "a=ssrc:1 label:audio_track_id_1\r\n"
372 "a=ssrc:4 cname:stream_2_cname\r\n"
373 "a=ssrc:4 msid:local_stream_2 audio_track_id_2\r\n"
374 "a=ssrc:4 mslabel:local_stream_2\r\n"
375 "a=ssrc:4 label:audio_track_id_2\r\n"
376 "m=video 3457 RTP/SAVPF 120\r\n"
377 "c=IN IP4 74.125.224.39\r\n"
378 "a=rtcp:3456 IN IP4 74.125.224.39\r\n"
379 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host "
380 "generation 2\r\n"
381 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host "
382 "generation 2\r\n"
383 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host "
384 "generation 2\r\n"
385 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host "
386 "generation 2\r\n"
387 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay "
388 "generation 2\r\n"
389 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay "
390 "generation 2\r\n"
391 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n"
392 "a=mid:video_content_name\r\n"
393 "a=sendrecv\r\n"
394 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
395 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n"
396 "a=rtpmap:120 VP8/90000\r\n"
397 "a=ssrc-group:FEC 2 3\r\n"
398 "a=ssrc:2 cname:stream_1_cname\r\n"
399 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n"
400 "a=ssrc:2 mslabel:local_stream_1\r\n"
401 "a=ssrc:2 label:video_track_id_1\r\n"
402 "a=ssrc:3 cname:stream_1_cname\r\n"
403 "a=ssrc:3 msid:local_stream_1 video_track_id_1\r\n"
404 "a=ssrc:3 mslabel:local_stream_1\r\n"
405 "a=ssrc:3 label:video_track_id_1\r\n"
406 "a=ssrc:5 cname:stream_2_cname\r\n"
407 "a=ssrc:5 msid:local_stream_2 video_track_id_2\r\n"
408 "a=ssrc:5 mslabel:local_stream_2\r\n"
409 "a=ssrc:5 label:video_track_id_2\r\n"
410 "a=ssrc:6 cname:stream_2_cname\r\n"
411 "a=ssrc:6 msid:local_stream_2 video_track_id_3\r\n"
412 "a=ssrc:6 mslabel:local_stream_2\r\n"
413 "a=ssrc:6 label:video_track_id_3\r\n";
414
415 // Unified Plan SDP reference string, with 2 streams, 2 audio tracks and 3 video
416 // tracks.
417 static const char kUnifiedPlanSdpFullString[] =
418 "v=0\r\n"
419 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
420 "s=-\r\n"
421 "t=0 0\r\n"
422 "a=msid-semantic: WMS local_stream_1\r\n"
423 // Audio track 1, stream 1 (with candidates).
424 "m=audio 2345 RTP/SAVPF 111 103 104\r\n"
425 "c=IN IP4 74.125.127.126\r\n"
426 "a=rtcp:2347 IN IP4 74.125.127.126\r\n"
427 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host "
428 "generation 2\r\n"
429 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host "
430 "generation 2\r\n"
431 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host "
432 "generation 2\r\n"
433 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host "
434 "generation 2\r\n"
435 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx "
436 "raddr 192.168.1.5 rport 2346 "
437 "generation 2\r\n"
438 "a=candidate:a0+B/3 2 udp 2130706432 74.125.127.126 2347 typ srflx "
439 "raddr 192.168.1.5 rport 2348 "
440 "generation 2\r\n"
441 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n"
442 "a=mid:audio_content_name\r\n"
443 "a=msid:local_stream_1 audio_track_id_1\r\n"
444 "a=sendrecv\r\n"
445 "a=rtcp-mux\r\n"
446 "a=rtcp-rsize\r\n"
447 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 "
448 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 "
449 "dummy_session_params\r\n"
450 "a=rtpmap:111 opus/48000/2\r\n"
451 "a=rtpmap:103 ISAC/16000\r\n"
452 "a=rtpmap:104 ISAC/32000\r\n"
453 "a=ssrc:1 cname:stream_1_cname\r\n"
454 // Video track 1, stream 1 (with candidates).
455 "m=video 3457 RTP/SAVPF 120\r\n"
456 "c=IN IP4 74.125.224.39\r\n"
457 "a=rtcp:3456 IN IP4 74.125.224.39\r\n"
458 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host "
459 "generation 2\r\n"
460 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host "
461 "generation 2\r\n"
462 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host "
463 "generation 2\r\n"
464 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host "
465 "generation 2\r\n"
466 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay "
467 "generation 2\r\n"
468 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay "
469 "generation 2\r\n"
470 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n"
471 "a=mid:video_content_name\r\n"
472 "a=msid:local_stream_1 video_track_id_1\r\n"
473 "a=sendrecv\r\n"
474 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
475 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n"
476 "a=rtpmap:120 VP8/90000\r\n"
477 "a=ssrc-group:FEC 2 3\r\n"
478 "a=ssrc:2 cname:stream_1_cname\r\n"
479 "a=ssrc:3 cname:stream_1_cname\r\n"
480 // Audio track 2, stream 2.
481 "m=audio 9 RTP/SAVPF 111 103 104\r\n"
482 "c=IN IP4 0.0.0.0\r\n"
483 "a=rtcp:9 IN IP4 0.0.0.0\r\n"
484 "a=ice-ufrag:ufrag_voice_2\r\na=ice-pwd:pwd_voice_2\r\n"
485 "a=mid:audio_content_name_2\r\n"
486 "a=msid:local_stream_2 audio_track_id_2\r\n"
487 "a=sendrecv\r\n"
488 "a=rtcp-mux\r\n"
489 "a=rtcp-rsize\r\n"
490 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 "
491 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 "
492 "dummy_session_params\r\n"
493 "a=rtpmap:111 opus/48000/2\r\n"
494 "a=rtpmap:103 ISAC/16000\r\n"
495 "a=rtpmap:104 ISAC/32000\r\n"
496 "a=ssrc:4 cname:stream_2_cname\r\n"
497 // Video track 2, stream 2.
498 "m=video 9 RTP/SAVPF 120\r\n"
499 "c=IN IP4 0.0.0.0\r\n"
500 "a=rtcp:9 IN IP4 0.0.0.0\r\n"
501 "a=ice-ufrag:ufrag_video_2\r\na=ice-pwd:pwd_video_2\r\n"
502 "a=mid:video_content_name_2\r\n"
503 "a=msid:local_stream_2 video_track_id_2\r\n"
504 "a=sendrecv\r\n"
505 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
506 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n"
507 "a=rtpmap:120 VP8/90000\r\n"
508 "a=ssrc:5 cname:stream_2_cname\r\n"
509 // Video track 3, stream 2.
510 "m=video 9 RTP/SAVPF 120\r\n"
511 "c=IN IP4 0.0.0.0\r\n"
512 "a=rtcp:9 IN IP4 0.0.0.0\r\n"
513 "a=ice-ufrag:ufrag_video_3\r\na=ice-pwd:pwd_video_3\r\n"
514 "a=mid:video_content_name_3\r\n"
515 "a=msid:local_stream_2 video_track_id_3\r\n"
516 "a=sendrecv\r\n"
517 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
518 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n"
519 "a=rtpmap:120 VP8/90000\r\n"
520 "a=ssrc:6 cname:stream_2_cname\r\n";
358 521
359 // One candidate reference string as per W3c spec. 522 // One candidate reference string as per W3c spec.
360 // candidate:<blah> not a=candidate:<blah>CRLF 523 // candidate:<blah> not a=candidate:<blah>CRLF
361 static const char kRawCandidate[] = 524 static const char kRawCandidate[] =
362 "candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host generation 2"; 525 "candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host generation 2";
363 // One candidate reference string. 526 // One candidate reference string.
364 static const char kSdpOneCandidate[] = 527 static const char kSdpOneCandidate[] =
365 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " 528 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host "
366 "generation 2\r\n"; 529 "generation 2\r\n";
367 530
(...skipping 17 matching lines...) Expand all
385 548
386 // One candidate reference string. 549 // One candidate reference string.
387 static const char kSdpOneCandidateWithUfragPwd[] = 550 static const char kSdpOneCandidateWithUfragPwd[] =
388 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host network_name" 551 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host network_name"
389 " eth0 ufrag user_rtp pwd password_rtp generation 2\r\n"; 552 " eth0 ufrag user_rtp pwd password_rtp generation 2\r\n";
390 553
391 // Session id and version 554 // Session id and version
392 static const char kSessionId[] = "18446744069414584320"; 555 static const char kSessionId[] = "18446744069414584320";
393 static const char kSessionVersion[] = "18446462598732840960"; 556 static const char kSessionVersion[] = "18446462598732840960";
394 557
395 // Ice options 558 // ICE options.
396 static const char kIceOption1[] = "iceoption1"; 559 static const char kIceOption1[] = "iceoption1";
397 static const char kIceOption2[] = "iceoption2"; 560 static const char kIceOption2[] = "iceoption2";
398 static const char kIceOption3[] = "iceoption3"; 561 static const char kIceOption3[] = "iceoption3";
399 562
563 // ICE ufrags/passwords.
564 static const char kUfragVoice[] = "ufrag_voice";
565 static const char kPwdVoice[] = "pwd_voice";
566 static const char kUfragVideo[] = "ufrag_video";
567 static const char kPwdVideo[] = "pwd_video";
568 static const char kUfragData[] = "ufrag_data";
569 static const char kPwdData[] = "pwd_data";
570
571 // Extra ufrags/passwords for extra unified plan m= sections.
572 static const char kUfragVoice2[] = "ufrag_voice_2";
573 static const char kPwdVoice2[] = "pwd_voice_2";
574 static const char kUfragVideo2[] = "ufrag_video_2";
575 static const char kPwdVideo2[] = "pwd_video_2";
576 static const char kUfragVideo3[] = "ufrag_video_3";
577 static const char kPwdVideo3[] = "pwd_video_3";
578
400 // Content name 579 // Content name
401 static const char kAudioContentName[] = "audio_content_name"; 580 static const char kAudioContentName[] = "audio_content_name";
402 static const char kVideoContentName[] = "video_content_name"; 581 static const char kVideoContentName[] = "video_content_name";
403 static const char kDataContentName[] = "data_content_name"; 582 static const char kDataContentName[] = "data_content_name";
404 583
584 // Extra content names for extra unified plan m= sections.
585 static const char kAudioContentName2[] = "audio_content_name_2";
586 static const char kVideoContentName2[] = "video_content_name_2";
587 static const char kVideoContentName3[] = "video_content_name_3";
588
405 // MediaStream 1 589 // MediaStream 1
406 static const char kStreamLabel1[] = "local_stream_1"; 590 static const char kStreamLabel1[] = "local_stream_1";
407 static const char kStream1Cname[] = "stream_1_cname"; 591 static const char kStream1Cname[] = "stream_1_cname";
408 static const char kAudioTrackId1[] = "audio_track_id_1"; 592 static const char kAudioTrackId1[] = "audio_track_id_1";
409 static const uint32_t kAudioTrack1Ssrc = 1; 593 static const uint32_t kAudioTrack1Ssrc = 1;
410 static const char kVideoTrackId1[] = "video_track_id_1"; 594 static const char kVideoTrackId1[] = "video_track_id_1";
411 static const uint32_t kVideoTrack1Ssrc = 2; 595 static const uint32_t kVideoTrack1Ssrc1 = 2;
412 static const char kVideoTrackId2[] = "video_track_id_2"; 596 static const uint32_t kVideoTrack1Ssrc2 = 3;
413 static const uint32_t kVideoTrack2Ssrc = 3;
414 597
415 // MediaStream 2 598 // MediaStream 2
416 static const char kStreamLabel2[] = "local_stream_2"; 599 static const char kStreamLabel2[] = "local_stream_2";
417 static const char kStream2Cname[] = "stream_2_cname"; 600 static const char kStream2Cname[] = "stream_2_cname";
418 static const char kAudioTrackId2[] = "audio_track_id_2"; 601 static const char kAudioTrackId2[] = "audio_track_id_2";
419 static const uint32_t kAudioTrack2Ssrc = 4; 602 static const uint32_t kAudioTrack2Ssrc = 4;
603 static const char kVideoTrackId2[] = "video_track_id_2";
604 static const uint32_t kVideoTrack2Ssrc = 5;
420 static const char kVideoTrackId3[] = "video_track_id_3"; 605 static const char kVideoTrackId3[] = "video_track_id_3";
421 static const uint32_t kVideoTrack3Ssrc = 5; 606 static const uint32_t kVideoTrack3Ssrc = 6;
422 static const uint32_t kVideoTrack4Ssrc = 6;
423 607
424 // DataChannel 608 // DataChannel
425 static const char kDataChannelLabel[] = "data_channel"; 609 static const char kDataChannelLabel[] = "data_channel";
426 static const char kDataChannelMsid[] = "data_channeld0"; 610 static const char kDataChannelMsid[] = "data_channeld0";
427 static const char kDataChannelCname[] = "data_channel_cname"; 611 static const char kDataChannelCname[] = "data_channel_cname";
428 static const uint32_t kDataChannelSsrc = 10; 612 static const uint32_t kDataChannelSsrc = 10;
429 613
430 // Candidate 614 // Candidate
431 static const char kDummyMid[] = "dummy_mid"; 615 static const char kDummyMid[] = "dummy_mid";
432 static const int kDummyIndex = 123; 616 static const int kDummyIndex = 123;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 712
529 class WebRtcSdpTest : public testing::Test { 713 class WebRtcSdpTest : public testing::Test {
530 public: 714 public:
531 WebRtcSdpTest() 715 WebRtcSdpTest()
532 : jdesc_(kDummyString) { 716 : jdesc_(kDummyString) {
533 #ifdef WEBRTC_ANDROID 717 #ifdef WEBRTC_ANDROID
534 webrtc::InitializeAndroidObjects(); 718 webrtc::InitializeAndroidObjects();
535 #endif 719 #endif
536 // AudioContentDescription 720 // AudioContentDescription
537 audio_desc_ = CreateAudioContentDescription(); 721 audio_desc_ = CreateAudioContentDescription();
538 AudioCodec opus(111, "opus", 48000, 0, 2, 3); 722 StreamParams audio_stream;
539 audio_desc_->AddCodec(opus); 723 audio_stream.id = kAudioTrackId1;
540 audio_desc_->AddCodec(AudioCodec(103, "ISAC", 16000, 32000, 1, 2)); 724 audio_stream.cname = kStream1Cname;
541 audio_desc_->AddCodec(AudioCodec(104, "ISAC", 32000, 56000, 1, 1)); 725 audio_stream.sync_label = kStreamLabel1;
726 audio_stream.ssrcs.push_back(kAudioTrack1Ssrc);
727 audio_desc_->AddStream(audio_stream);
542 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_); 728 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_);
543 729
544 // VideoContentDescription 730 // VideoContentDescription
545 rtc::scoped_ptr<VideoContentDescription> video( 731 video_desc_ = CreateVideoContentDescription();
546 new VideoContentDescription()); 732 StreamParams video_stream;
547 video_desc_ = video.get(); 733 video_stream.id = kVideoTrackId1;
548 StreamParams video_stream1; 734 video_stream.cname = kStream1Cname;
549 video_stream1.id = kVideoTrackId1; 735 video_stream.sync_label = kStreamLabel1;
550 video_stream1.cname = kStream1Cname; 736 video_stream.ssrcs.push_back(kVideoTrack1Ssrc1);
551 video_stream1.sync_label = kStreamLabel1; 737 video_stream.ssrcs.push_back(kVideoTrack1Ssrc2);
552 video_stream1.ssrcs.push_back(kVideoTrack1Ssrc); 738 cricket::SsrcGroup ssrc_group(kFecSsrcGroupSemantics, video_stream.ssrcs);
553 video->AddStream(video_stream1); 739 video_stream.ssrc_groups.push_back(ssrc_group);
554 StreamParams video_stream2; 740 video_desc_->AddStream(video_stream);
555 video_stream2.id = kVideoTrackId2; 741 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_desc_);
556 video_stream2.cname = kStream1Cname;
557 video_stream2.sync_label = kStreamLabel1;
558 video_stream2.ssrcs.push_back(kVideoTrack2Ssrc);
559 video->AddStream(video_stream2);
560 StreamParams video_stream3;
561 video_stream3.id = kVideoTrackId3;
562 video_stream3.cname = kStream2Cname;
563 video_stream3.sync_label = kStreamLabel2;
564 video_stream3.ssrcs.push_back(kVideoTrack3Ssrc);
565 video_stream3.ssrcs.push_back(kVideoTrack4Ssrc);
566 cricket::SsrcGroup ssrc_group(kFecSsrcGroupSemantics, video_stream3.ssrcs);
567 video_stream3.ssrc_groups.push_back(ssrc_group);
568 video->AddStream(video_stream3);
569 video->AddCrypto(CryptoParams(1, "AES_CM_128_HMAC_SHA1_80",
570 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32", ""));
571 video->set_protocol(cricket::kMediaProtocolSavpf);
572 video->AddCodec(VideoCodec(
573 120,
574 JsepSessionDescription::kDefaultVideoCodecName,
575 JsepSessionDescription::kMaxVideoCodecWidth,
576 JsepSessionDescription::kMaxVideoCodecHeight,
577 JsepSessionDescription::kDefaultVideoCodecFramerate,
578 JsepSessionDescription::kDefaultVideoCodecPreference));
579
580 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP,
581 video.release());
582 742
583 // TransportInfo 743 // TransportInfo
584 EXPECT_TRUE(desc_.AddTransportInfo( 744 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo(
585 TransportInfo(kAudioContentName, 745 kAudioContentName, TransportDescription(kUfragVoice, kPwdVoice))));
586 TransportDescription(kCandidateUfragVoice, 746 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo(
587 kCandidatePwdVoice)))); 747 kVideoContentName, TransportDescription(kUfragVideo, kPwdVideo))));
588 EXPECT_TRUE(desc_.AddTransportInfo(
589 TransportInfo(kVideoContentName,
590 TransportDescription(kCandidateUfragVideo,
591 kCandidatePwdVideo))));
592 748
593 // v4 host 749 // v4 host
594 int port = 1234; 750 int port = 1234;
595 rtc::SocketAddress address("192.168.1.5", port++); 751 rtc::SocketAddress address("192.168.1.5", port++);
596 Candidate candidate1(ICE_CANDIDATE_COMPONENT_RTP, "udp", address, 752 Candidate candidate1(ICE_CANDIDATE_COMPONENT_RTP, "udp", address,
597 kCandidatePriority, "", "", LOCAL_PORT_TYPE, 753 kCandidatePriority, "", "", LOCAL_PORT_TYPE,
598 kCandidateGeneration, kCandidateFoundation1); 754 kCandidateGeneration, kCandidateFoundation1);
599 address.SetPort(port++); 755 address.SetPort(port++);
600 Candidate candidate2(ICE_CANDIDATE_COMPONENT_RTCP, "udp", address, 756 Candidate candidate2(ICE_CANDIDATE_COMPONENT_RTCP, "udp", address,
601 kCandidatePriority, "", "", LOCAL_PORT_TYPE, 757 kCandidatePriority, "", "", LOCAL_PORT_TYPE,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 bool is_video = (i > 5); 847 bool is_video = (i > 5);
692 mline_id = is_video ? "video_content_name" : "audio_content_name"; 848 mline_id = is_video ? "video_content_name" : "audio_content_name";
693 mline_index = is_video ? 1 : 0; 849 mline_index = is_video ? 1 : 0;
694 JsepIceCandidate jice(mline_id, 850 JsepIceCandidate jice(mline_id,
695 mline_index, 851 mline_index,
696 candidates_.at(i)); 852 candidates_.at(i));
697 jdesc_.AddCandidate(&jice); 853 jdesc_.AddCandidate(&jice);
698 } 854 }
699 } 855 }
700 856
857 // Turns the existing reference description into a plan B description,
858 // with 2 audio tracks and 3 video tracks.
859 void MakePlanBDescription() {
860 audio_desc_ = static_cast<AudioContentDescription*>(audio_desc_->Copy());
861 video_desc_ = static_cast<VideoContentDescription*>(video_desc_->Copy());
862
863 StreamParams audio_track_2;
864 audio_track_2.id = kAudioTrackId2;
865 audio_track_2.cname = kStream2Cname;
866 audio_track_2.sync_label = kStreamLabel2;
867 audio_track_2.ssrcs.push_back(kAudioTrack2Ssrc);
868 audio_desc_->AddStream(audio_track_2);
869
870 StreamParams video_track_2;
871 video_track_2.id = kVideoTrackId2;
872 video_track_2.cname = kStream2Cname;
873 video_track_2.sync_label = kStreamLabel2;
874 video_track_2.ssrcs.push_back(kVideoTrack2Ssrc);
875 video_desc_->AddStream(video_track_2);
876
877 StreamParams video_track_3;
878 video_track_3.id = kVideoTrackId3;
879 video_track_3.cname = kStream2Cname;
880 video_track_3.sync_label = kStreamLabel2;
881 video_track_3.ssrcs.push_back(kVideoTrack3Ssrc);
882 video_desc_->AddStream(video_track_3);
883
884 desc_.RemoveContentByName(kAudioContentName);
885 desc_.RemoveContentByName(kVideoContentName);
886 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_);
887 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_desc_);
888
889 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), jdesc_.session_id(),
890 jdesc_.session_version()));
891 }
892
893 // Turns the existing reference description into a unified plan description,
894 // with 2 audio tracks and 3 video tracks.
895 void MakeUnifiedPlanDescription() {
896 // Audio track 2.
897 AudioContentDescription* audio_desc_2 = CreateAudioContentDescription();
898 StreamParams audio_track_2;
899 audio_track_2.id = kAudioTrackId2;
900 audio_track_2.cname = kStream2Cname;
901 audio_track_2.sync_label = kStreamLabel2;
902 audio_track_2.ssrcs.push_back(kAudioTrack2Ssrc);
903 audio_desc_2->AddStream(audio_track_2);
904 desc_.AddContent(kAudioContentName2, NS_JINGLE_RTP, audio_desc_2);
905 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo(
906 kAudioContentName2, TransportDescription(kUfragVoice2, kPwdVoice2))));
907
908 // Video track 2, in stream 2.
909 VideoContentDescription* video_desc_2 = CreateVideoContentDescription();
910 StreamParams video_track_2;
911 video_track_2.id = kVideoTrackId2;
912 video_track_2.cname = kStream2Cname;
913 video_track_2.sync_label = kStreamLabel2;
914 video_track_2.ssrcs.push_back(kVideoTrack2Ssrc);
915 video_desc_2->AddStream(video_track_2);
916 desc_.AddContent(kVideoContentName2, NS_JINGLE_RTP, video_desc_2);
917 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo(
918 kVideoContentName2, TransportDescription(kUfragVideo2, kPwdVideo2))));
919
920 // Video track 3, in stream 2.
921 VideoContentDescription* video_desc_3 = CreateVideoContentDescription();
922 StreamParams video_track_3;
923 video_track_3.id = kVideoTrackId3;
924 video_track_3.cname = kStream2Cname;
925 video_track_3.sync_label = kStreamLabel2;
926 video_track_3.ssrcs.push_back(kVideoTrack3Ssrc);
927 video_desc_3->AddStream(video_track_3);
928 desc_.AddContent(kVideoContentName3, NS_JINGLE_RTP, video_desc_3);
929 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo(
930 kVideoContentName3, TransportDescription(kUfragVideo3, kPwdVideo3))));
931
932 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), jdesc_.session_id(),
933 jdesc_.session_version()));
934 }
935
936 // Creates an audio content description with no streams, and some default
937 // configuration.
701 AudioContentDescription* CreateAudioContentDescription() { 938 AudioContentDescription* CreateAudioContentDescription() {
702 AudioContentDescription* audio = new AudioContentDescription(); 939 AudioContentDescription* audio = new AudioContentDescription();
703 audio->set_rtcp_mux(true); 940 audio->set_rtcp_mux(true);
704 audio->set_rtcp_reduced_size(true); 941 audio->set_rtcp_reduced_size(true);
705 StreamParams audio_stream1;
706 audio_stream1.id = kAudioTrackId1;
707 audio_stream1.cname = kStream1Cname;
708 audio_stream1.sync_label = kStreamLabel1;
709 audio_stream1.ssrcs.push_back(kAudioTrack1Ssrc);
710 audio->AddStream(audio_stream1);
711 StreamParams audio_stream2;
712 audio_stream2.id = kAudioTrackId2;
713 audio_stream2.cname = kStream2Cname;
714 audio_stream2.sync_label = kStreamLabel2;
715 audio_stream2.ssrcs.push_back(kAudioTrack2Ssrc);
716 audio->AddStream(audio_stream2);
717 audio->AddCrypto(CryptoParams(1, "AES_CM_128_HMAC_SHA1_32", 942 audio->AddCrypto(CryptoParams(1, "AES_CM_128_HMAC_SHA1_32",
718 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32", 943 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32",
719 "dummy_session_params")); 944 "dummy_session_params"));
720 audio->set_protocol(cricket::kMediaProtocolSavpf); 945 audio->set_protocol(cricket::kMediaProtocolSavpf);
946 AudioCodec opus(111, "opus", 48000, 0, 2, 3);
947 audio->AddCodec(opus);
948 audio->AddCodec(AudioCodec(103, "ISAC", 16000, 32000, 1, 2));
949 audio->AddCodec(AudioCodec(104, "ISAC", 32000, 56000, 1, 1));
721 return audio; 950 return audio;
722 } 951 }
723 952
953 // Creates a video content description with no streams, and some default
954 // configuration.
955 VideoContentDescription* CreateVideoContentDescription() {
956 VideoContentDescription* video = new VideoContentDescription();
957 video->AddCrypto(CryptoParams(
958 1, "AES_CM_128_HMAC_SHA1_80",
959 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32", ""));
960 video->set_protocol(cricket::kMediaProtocolSavpf);
961 video->AddCodec(
962 VideoCodec(120, JsepSessionDescription::kDefaultVideoCodecName,
963 JsepSessionDescription::kMaxVideoCodecWidth,
964 JsepSessionDescription::kMaxVideoCodecHeight,
965 JsepSessionDescription::kDefaultVideoCodecFramerate,
966 JsepSessionDescription::kDefaultVideoCodecPreference));
967 return video;
968 }
969
724 template <class MCD> 970 template <class MCD>
725 void CompareMediaContentDescription(const MCD* cd1, 971 void CompareMediaContentDescription(const MCD* cd1,
726 const MCD* cd2) { 972 const MCD* cd2) {
727 // type 973 // type
728 EXPECT_EQ(cd1->type(), cd1->type()); 974 EXPECT_EQ(cd1->type(), cd1->type());
729 975
730 // content direction 976 // content direction
731 EXPECT_EQ(cd1->direction(), cd2->direction()); 977 EXPECT_EQ(cd1->direction(), cd2->direction());
732 978
733 // rtcp_mux 979 // rtcp_mux
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 } 1225 }
980 1226
981 void AddFingerprint() { 1227 void AddFingerprint() {
982 desc_.RemoveTransportInfoByName(kAudioContentName); 1228 desc_.RemoveTransportInfoByName(kAudioContentName);
983 desc_.RemoveTransportInfoByName(kVideoContentName); 1229 desc_.RemoveTransportInfoByName(kVideoContentName);
984 rtc::SSLFingerprint fingerprint(rtc::DIGEST_SHA_1, 1230 rtc::SSLFingerprint fingerprint(rtc::DIGEST_SHA_1,
985 kIdentityDigest, 1231 kIdentityDigest,
986 sizeof(kIdentityDigest)); 1232 sizeof(kIdentityDigest));
987 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( 1233 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo(
988 kAudioContentName, 1234 kAudioContentName,
989 TransportDescription(std::vector<std::string>(), kCandidateUfragVoice, 1235 TransportDescription(std::vector<std::string>(), kUfragVoice, kPwdVoice,
990 kCandidatePwdVoice, cricket::ICEMODE_FULL, 1236 cricket::ICEMODE_FULL,
991 cricket::CONNECTIONROLE_NONE, &fingerprint)))); 1237 cricket::CONNECTIONROLE_NONE, &fingerprint))));
992 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( 1238 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo(
993 kVideoContentName, 1239 kVideoContentName,
994 TransportDescription(std::vector<std::string>(), kCandidateUfragVideo, 1240 TransportDescription(std::vector<std::string>(), kUfragVideo, kPwdVideo,
995 kCandidatePwdVideo, cricket::ICEMODE_FULL, 1241 cricket::ICEMODE_FULL,
996 cricket::CONNECTIONROLE_NONE, &fingerprint)))); 1242 cricket::CONNECTIONROLE_NONE, &fingerprint))));
997 } 1243 }
998 1244
999 void AddExtmap() { 1245 void AddExtmap() {
1000 audio_desc_ = static_cast<AudioContentDescription*>( 1246 audio_desc_ = static_cast<AudioContentDescription*>(
1001 audio_desc_->Copy()); 1247 audio_desc_->Copy());
1002 video_desc_ = static_cast<VideoContentDescription*>( 1248 video_desc_ = static_cast<VideoContentDescription*>(
1003 video_desc_->Copy()); 1249 video_desc_->Copy());
1004 audio_desc_->AddRtpHeaderExtension( 1250 audio_desc_->AddRtpHeaderExtension(
1005 RtpHeaderExtension(kExtmapUri, kExtmapId)); 1251 RtpHeaderExtension(kExtmapUri, kExtmapId));
(...skipping 14 matching lines...) Expand all
1020 audio_desc_->set_direction(direction); 1266 audio_desc_->set_direction(direction);
1021 video_desc_->set_direction(direction); 1267 video_desc_->set_direction(direction);
1022 std::string new_sdp = kSdpFullString; 1268 std::string new_sdp = kSdpFullString;
1023 ReplaceDirection(direction, &new_sdp); 1269 ReplaceDirection(direction, &new_sdp);
1024 1270
1025 if (!jdesc_.Initialize(desc_.Copy(), 1271 if (!jdesc_.Initialize(desc_.Copy(),
1026 jdesc_.session_id(), 1272 jdesc_.session_id(),
1027 jdesc_.session_version())) { 1273 jdesc_.session_version())) {
1028 return false; 1274 return false;
1029 } 1275 }
1030 std::string message = webrtc::SdpSerialize(jdesc_); 1276 std::string message = webrtc::SdpSerialize(jdesc_, false);
1031 EXPECT_EQ(new_sdp, message); 1277 EXPECT_EQ(new_sdp, message);
1032 return true; 1278 return true;
1033 } 1279 }
1034 1280
1035 bool TestSerializeRejected(bool audio_rejected, bool video_rejected) { 1281 bool TestSerializeRejected(bool audio_rejected, bool video_rejected) {
1036 audio_desc_ = static_cast<AudioContentDescription*>( 1282 audio_desc_ = static_cast<AudioContentDescription*>(
1037 audio_desc_->Copy()); 1283 audio_desc_->Copy());
1038 video_desc_ = static_cast<VideoContentDescription*>( 1284 video_desc_ = static_cast<VideoContentDescription*>(
1039 video_desc_->Copy()); 1285 video_desc_->Copy());
1040 desc_.RemoveContentByName(kAudioContentName); 1286 desc_.RemoveContentByName(kAudioContentName);
1041 desc_.RemoveContentByName(kVideoContentName); 1287 desc_.RemoveContentByName(kVideoContentName);
1042 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_rejected, 1288 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_rejected,
1043 audio_desc_); 1289 audio_desc_);
1044 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_rejected, 1290 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_rejected,
1045 video_desc_); 1291 video_desc_);
1046 SetIceUfragPwd(kAudioContentName, 1292 SetIceUfragPwd(kAudioContentName, audio_rejected ? "" : kUfragVoice,
1047 audio_rejected ? "" : kCandidateUfragVoice, 1293 audio_rejected ? "" : kPwdVoice);
1048 audio_rejected ? "" : kCandidatePwdVoice); 1294 SetIceUfragPwd(kVideoContentName, video_rejected ? "" : kUfragVideo,
1049 SetIceUfragPwd(kVideoContentName, 1295 video_rejected ? "" : kPwdVideo);
1050 video_rejected ? "" : kCandidateUfragVideo,
1051 video_rejected ? "" : kCandidatePwdVideo);
1052 1296
1053 std::string new_sdp = kSdpString; 1297 std::string new_sdp = kSdpString;
1054 ReplaceRejected(audio_rejected, video_rejected, &new_sdp); 1298 ReplaceRejected(audio_rejected, video_rejected, &new_sdp);
1055 1299
1056 JsepSessionDescription jdesc_no_candidates(kDummyString); 1300 JsepSessionDescription jdesc_no_candidates(kDummyString);
1057 if (!jdesc_no_candidates.Initialize(desc_.Copy(), kSessionId, 1301 if (!jdesc_no_candidates.Initialize(desc_.Copy(), kSessionId,
1058 kSessionVersion)) { 1302 kSessionVersion)) {
1059 return false; 1303 return false;
1060 } 1304 }
1061 std::string message = webrtc::SdpSerialize(jdesc_no_candidates); 1305 std::string message = webrtc::SdpSerialize(jdesc_no_candidates, false);
1062 EXPECT_EQ(new_sdp, message); 1306 EXPECT_EQ(new_sdp, message);
1063 return true; 1307 return true;
1064 } 1308 }
1065 1309
1066 void AddSctpDataChannel() { 1310 void AddSctpDataChannel() {
1067 rtc::scoped_ptr<DataContentDescription> data( 1311 rtc::scoped_ptr<DataContentDescription> data(
1068 new DataContentDescription()); 1312 new DataContentDescription());
1069 data_desc_ = data.get(); 1313 data_desc_ = data.get();
1070 data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp); 1314 data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp);
1071 DataCodec codec(cricket::kGoogleSctpDataCodecId, 1315 DataCodec codec(cricket::kGoogleSctpDataCodecId,
1072 cricket::kGoogleSctpDataCodecName, 0); 1316 cricket::kGoogleSctpDataCodecName, 0);
1073 codec.SetParam(cricket::kCodecParamPort, kDefaultSctpPort); 1317 codec.SetParam(cricket::kCodecParamPort, kDefaultSctpPort);
1074 data_desc_->AddCodec(codec); 1318 data_desc_->AddCodec(codec);
1075 desc_.AddContent(kDataContentName, NS_JINGLE_DRAFT_SCTP, data.release()); 1319 desc_.AddContent(kDataContentName, NS_JINGLE_DRAFT_SCTP, data.release());
1076 EXPECT_TRUE(desc_.AddTransportInfo( 1320 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo(
1077 TransportInfo(kDataContentName, 1321 kDataContentName, TransportDescription(kUfragData, kPwdData))));
1078 TransportDescription(kCandidateUfragData,
1079 kCandidatePwdData))));
1080 } 1322 }
1081 1323
1082 void AddRtpDataChannel() { 1324 void AddRtpDataChannel() {
1083 rtc::scoped_ptr<DataContentDescription> data( 1325 rtc::scoped_ptr<DataContentDescription> data(
1084 new DataContentDescription()); 1326 new DataContentDescription());
1085 data_desc_ = data.get(); 1327 data_desc_ = data.get();
1086 1328
1087 data_desc_->AddCodec(DataCodec(101, "google-data", 1)); 1329 data_desc_->AddCodec(DataCodec(101, "google-data", 1));
1088 StreamParams data_stream; 1330 StreamParams data_stream;
1089 data_stream.id = kDataChannelMsid; 1331 data_stream.id = kDataChannelMsid;
1090 data_stream.cname = kDataChannelCname; 1332 data_stream.cname = kDataChannelCname;
1091 data_stream.sync_label = kDataChannelLabel; 1333 data_stream.sync_label = kDataChannelLabel;
1092 data_stream.ssrcs.push_back(kDataChannelSsrc); 1334 data_stream.ssrcs.push_back(kDataChannelSsrc);
1093 data_desc_->AddStream(data_stream); 1335 data_desc_->AddStream(data_stream);
1094 data_desc_->AddCrypto(CryptoParams( 1336 data_desc_->AddCrypto(CryptoParams(
1095 1, "AES_CM_128_HMAC_SHA1_80", 1337 1, "AES_CM_128_HMAC_SHA1_80",
1096 "inline:FvLcvU2P3ZWmQxgPAgcDu7Zl9vftYElFOjEzhWs5", "")); 1338 "inline:FvLcvU2P3ZWmQxgPAgcDu7Zl9vftYElFOjEzhWs5", ""));
1097 data_desc_->set_protocol(cricket::kMediaProtocolSavpf); 1339 data_desc_->set_protocol(cricket::kMediaProtocolSavpf);
1098 desc_.AddContent(kDataContentName, NS_JINGLE_RTP, data.release()); 1340 desc_.AddContent(kDataContentName, NS_JINGLE_RTP, data.release());
1099 EXPECT_TRUE(desc_.AddTransportInfo( 1341 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo(
1100 TransportInfo(kDataContentName, 1342 kDataContentName, TransportDescription(kUfragData, kPwdData))));
1101 TransportDescription(kCandidateUfragData,
1102 kCandidatePwdData))));
1103 } 1343 }
1104 1344
1105 bool TestDeserializeDirection(cricket::MediaContentDirection direction) { 1345 bool TestDeserializeDirection(cricket::MediaContentDirection direction) {
1106 std::string new_sdp = kSdpFullString; 1346 std::string new_sdp = kSdpFullString;
1107 ReplaceDirection(direction, &new_sdp); 1347 ReplaceDirection(direction, &new_sdp);
1108 JsepSessionDescription new_jdesc(kDummyString); 1348 JsepSessionDescription new_jdesc(kDummyString);
1109 1349
1110 EXPECT_TRUE(SdpDeserialize(new_sdp, &new_jdesc)); 1350 EXPECT_TRUE(SdpDeserialize(new_sdp, &new_jdesc));
1111 1351
1112 audio_desc_->set_direction(direction); 1352 audio_desc_->set_direction(direction);
(...skipping 16 matching lines...) Expand all
1129 audio_desc_ = static_cast<AudioContentDescription*>( 1369 audio_desc_ = static_cast<AudioContentDescription*>(
1130 audio_desc_->Copy()); 1370 audio_desc_->Copy());
1131 video_desc_ = static_cast<VideoContentDescription*>( 1371 video_desc_ = static_cast<VideoContentDescription*>(
1132 video_desc_->Copy()); 1372 video_desc_->Copy());
1133 desc_.RemoveContentByName(kAudioContentName); 1373 desc_.RemoveContentByName(kAudioContentName);
1134 desc_.RemoveContentByName(kVideoContentName); 1374 desc_.RemoveContentByName(kVideoContentName);
1135 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_rejected, 1375 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_rejected,
1136 audio_desc_); 1376 audio_desc_);
1137 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_rejected, 1377 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_rejected,
1138 video_desc_); 1378 video_desc_);
1139 SetIceUfragPwd(kAudioContentName, 1379 SetIceUfragPwd(kAudioContentName, audio_rejected ? "" : kUfragVoice,
1140 audio_rejected ? "" : kCandidateUfragVoice, 1380 audio_rejected ? "" : kPwdVoice);
1141 audio_rejected ? "" : kCandidatePwdVoice); 1381 SetIceUfragPwd(kVideoContentName, video_rejected ? "" : kUfragVideo,
1142 SetIceUfragPwd(kVideoContentName, 1382 video_rejected ? "" : kPwdVideo);
1143 video_rejected ? "" : kCandidateUfragVideo,
1144 video_rejected ? "" : kCandidatePwdVideo);
1145 JsepSessionDescription jdesc_no_candidates(kDummyString); 1383 JsepSessionDescription jdesc_no_candidates(kDummyString);
1146 if (!jdesc_no_candidates.Initialize(desc_.Copy(), jdesc_.session_id(), 1384 if (!jdesc_no_candidates.Initialize(desc_.Copy(), jdesc_.session_id(),
1147 jdesc_.session_version())) { 1385 jdesc_.session_version())) {
1148 return false; 1386 return false;
1149 } 1387 }
1150 EXPECT_TRUE(CompareSessionDescription(jdesc_no_candidates, new_jdesc)); 1388 EXPECT_TRUE(CompareSessionDescription(jdesc_no_candidates, new_jdesc));
1151 return true; 1389 return true;
1152 } 1390 }
1153 1391
1154 void TestDeserializeExtmap(bool session_level, bool media_level) { 1392 void TestDeserializeExtmap(bool session_level, bool media_level) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 cricket::FeedbackParam(cricket::kRtcpFbParamCcm, 1571 cricket::FeedbackParam(cricket::kRtcpFbParamCcm,
1334 cricket::kRtcpFbCcmParamFir))); 1572 cricket::kRtcpFbCcmParamFir)));
1335 } 1573 }
1336 1574
1337 // Two SDP messages can mean the same thing but be different strings, e.g. 1575 // Two SDP messages can mean the same thing but be different strings, e.g.
1338 // some of the lines can be serialized in different order. 1576 // some of the lines can be serialized in different order.
1339 // However, a deserialized description can be compared field by field and has 1577 // However, a deserialized description can be compared field by field and has
1340 // no order. If deserializer has already been tested, serializing then 1578 // no order. If deserializer has already been tested, serializing then
1341 // deserializing and comparing JsepSessionDescription will test 1579 // deserializing and comparing JsepSessionDescription will test
1342 // the serializer sufficiently. 1580 // the serializer sufficiently.
1343 void TestSerialize(const JsepSessionDescription& jdesc) { 1581 void TestSerialize(const JsepSessionDescription& jdesc,
1344 std::string message = webrtc::SdpSerialize(jdesc); 1582 bool unified_plan_sdp) {
1583 std::string message = webrtc::SdpSerialize(jdesc, unified_plan_sdp);
1345 JsepSessionDescription jdesc_output_des(kDummyString); 1584 JsepSessionDescription jdesc_output_des(kDummyString);
1346 SdpParseError error; 1585 SdpParseError error;
1347 EXPECT_TRUE(webrtc::SdpDeserialize(message, &jdesc_output_des, &error)); 1586 EXPECT_TRUE(webrtc::SdpDeserialize(message, &jdesc_output_des, &error));
1348 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output_des)); 1587 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output_des));
1349 } 1588 }
1350 1589
1351 protected: 1590 protected:
1352 SessionDescription desc_; 1591 SessionDescription desc_;
1353 AudioContentDescription* audio_desc_; 1592 AudioContentDescription* audio_desc_;
1354 VideoContentDescription* video_desc_; 1593 VideoContentDescription* video_desc_;
(...skipping 12 matching lines...) Expand all
1367 } 1606 }
1368 } 1607 }
1369 EXPECT_EQ(0, position) << "Strings mismatch at the " << position 1608 EXPECT_EQ(0, position) << "Strings mismatch at the " << position
1370 << " character\n" 1609 << " character\n"
1371 << " 1: " << string1.substr(position, 20) << "\n" 1610 << " 1: " << string1.substr(position, 20) << "\n"
1372 << " 2: " << string2.substr(position, 20) << "\n"; 1611 << " 2: " << string2.substr(position, 20) << "\n";
1373 } 1612 }
1374 1613
1375 TEST_F(WebRtcSdpTest, SerializeSessionDescription) { 1614 TEST_F(WebRtcSdpTest, SerializeSessionDescription) {
1376 // SessionDescription with desc and candidates. 1615 // SessionDescription with desc and candidates.
1377 std::string message = webrtc::SdpSerialize(jdesc_); 1616 std::string message = webrtc::SdpSerialize(jdesc_, false);
1378 TestMismatch(std::string(kSdpFullString), message); 1617 TestMismatch(std::string(kSdpFullString), message);
1379 } 1618 }
1380 1619
1381 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionEmpty) { 1620 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionEmpty) {
1382 JsepSessionDescription jdesc_empty(kDummyString); 1621 JsepSessionDescription jdesc_empty(kDummyString);
1383 EXPECT_EQ("", webrtc::SdpSerialize(jdesc_empty)); 1622 EXPECT_EQ("", webrtc::SdpSerialize(jdesc_empty, false));
1384 } 1623 }
1385 1624
1386 // This tests serialization of SDP with only IPv6 candidates and verifies that 1625 // This tests serialization of SDP with only IPv6 candidates and verifies that
1387 // IPv6 is used as default address in c line according to preference. 1626 // IPv6 is used as default address in c line according to preference.
1388 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithIPv6Only) { 1627 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithIPv6Only) {
1389 // Only test 1 m line. 1628 // Only test 1 m line.
1390 desc_.RemoveContentByName("video_content_name"); 1629 desc_.RemoveContentByName("video_content_name");
1391 // Stun has a high preference than local host. 1630 // Stun has a high preference than local host.
1392 cricket::Candidate candidate1( 1631 cricket::Candidate candidate1(
1393 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp", 1632 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp",
1394 rtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", 1633 rtc::SocketAddress("::1", 1234), kCandidatePriority, "", "",
1395 cricket::STUN_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); 1634 cricket::STUN_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1);
1396 cricket::Candidate candidate2( 1635 cricket::Candidate candidate2(
1397 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp", 1636 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp",
1398 rtc::SocketAddress("::2", 1235), kCandidatePriority, "", "", 1637 rtc::SocketAddress("::2", 1235), kCandidatePriority, "", "",
1399 cricket::LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); 1638 cricket::LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1);
1400 JsepSessionDescription jdesc(kDummyString); 1639 JsepSessionDescription jdesc(kDummyString);
1401 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); 1640 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion));
1402 1641
1403 // Only add the candidates to audio m line. 1642 // Only add the candidates to audio m line.
1404 JsepIceCandidate jice1("audio_content_name", 0, candidate1); 1643 JsepIceCandidate jice1("audio_content_name", 0, candidate1);
1405 JsepIceCandidate jice2("audio_content_name", 0, candidate2); 1644 JsepIceCandidate jice2("audio_content_name", 0, candidate2);
1406 ASSERT_TRUE(jdesc.AddCandidate(&jice1)); 1645 ASSERT_TRUE(jdesc.AddCandidate(&jice1));
1407 ASSERT_TRUE(jdesc.AddCandidate(&jice2)); 1646 ASSERT_TRUE(jdesc.AddCandidate(&jice2));
1408 std::string message = webrtc::SdpSerialize(jdesc); 1647 std::string message = webrtc::SdpSerialize(jdesc, false);
1409 1648
1410 // Audio line should have a c line like this one. 1649 // Audio line should have a c line like this one.
1411 EXPECT_NE(message.find("c=IN IP6 ::1"), std::string::npos); 1650 EXPECT_NE(message.find("c=IN IP6 ::1"), std::string::npos);
1412 // Shouldn't have a IP4 c line. 1651 // Shouldn't have a IP4 c line.
1413 EXPECT_EQ(message.find("c=IN IP4"), std::string::npos); 1652 EXPECT_EQ(message.find("c=IN IP4"), std::string::npos);
1414 } 1653 }
1415 1654
1416 // This tests serialization of SDP with both IPv4 and IPv6 candidates and 1655 // This tests serialization of SDP with both IPv4 and IPv6 candidates and
1417 // verifies that IPv4 is used as default address in c line even if the 1656 // verifies that IPv4 is used as default address in c line even if the
1418 // preference of IPv4 is lower. 1657 // preference of IPv4 is lower.
1419 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBothIPFamilies) { 1658 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBothIPFamilies) {
1420 // Only test 1 m line. 1659 // Only test 1 m line.
1421 desc_.RemoveContentByName("video_content_name"); 1660 desc_.RemoveContentByName("video_content_name");
1422 cricket::Candidate candidate_v4( 1661 cricket::Candidate candidate_v4(
1423 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp", 1662 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp",
1424 rtc::SocketAddress("192.168.1.5", 1234), kCandidatePriority, "", "", 1663 rtc::SocketAddress("192.168.1.5", 1234), kCandidatePriority, "", "",
1425 cricket::STUN_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); 1664 cricket::STUN_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1);
1426 cricket::Candidate candidate_v6( 1665 cricket::Candidate candidate_v6(
1427 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp", 1666 cricket::ICE_CANDIDATE_COMPONENT_RTP, "udp",
1428 rtc::SocketAddress("::1", 1234), kCandidatePriority, "", "", 1667 rtc::SocketAddress("::1", 1234), kCandidatePriority, "", "",
1429 cricket::LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); 1668 cricket::LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1);
1430 JsepSessionDescription jdesc(kDummyString); 1669 JsepSessionDescription jdesc(kDummyString);
1431 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); 1670 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion));
1432 1671
1433 // Only add the candidates to audio m line. 1672 // Only add the candidates to audio m line.
1434 JsepIceCandidate jice_v4("audio_content_name", 0, candidate_v4); 1673 JsepIceCandidate jice_v4("audio_content_name", 0, candidate_v4);
1435 JsepIceCandidate jice_v6("audio_content_name", 0, candidate_v6); 1674 JsepIceCandidate jice_v6("audio_content_name", 0, candidate_v6);
1436 ASSERT_TRUE(jdesc.AddCandidate(&jice_v4)); 1675 ASSERT_TRUE(jdesc.AddCandidate(&jice_v4));
1437 ASSERT_TRUE(jdesc.AddCandidate(&jice_v6)); 1676 ASSERT_TRUE(jdesc.AddCandidate(&jice_v6));
1438 std::string message = webrtc::SdpSerialize(jdesc); 1677 std::string message = webrtc::SdpSerialize(jdesc, false);
1439 1678
1440 // Audio line should have a c line like this one. 1679 // Audio line should have a c line like this one.
1441 EXPECT_NE(message.find("c=IN IP4 192.168.1.5"), std::string::npos); 1680 EXPECT_NE(message.find("c=IN IP4 192.168.1.5"), std::string::npos);
1442 // Shouldn't have a IP6 c line. 1681 // Shouldn't have a IP6 c line.
1443 EXPECT_EQ(message.find("c=IN IP6"), std::string::npos); 1682 EXPECT_EQ(message.find("c=IN IP6"), std::string::npos);
1444 } 1683 }
1445 1684
1446 // This tests serialization of SDP with both UDP and TCP candidates and 1685 // This tests serialization of SDP with both UDP and TCP candidates and
1447 // verifies that UDP is used as default address in c line even if the 1686 // verifies that UDP is used as default address in c line even if the
1448 // preference of UDP is lower. 1687 // preference of UDP is lower.
(...skipping 11 matching lines...) Expand all
1460 "", "", cricket::LOCAL_PORT_TYPE, kCandidateGeneration, 1699 "", "", cricket::LOCAL_PORT_TYPE, kCandidateGeneration,
1461 kCandidateFoundation1); 1700 kCandidateFoundation1);
1462 JsepSessionDescription jdesc(kDummyString); 1701 JsepSessionDescription jdesc(kDummyString);
1463 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); 1702 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion));
1464 1703
1465 // Only add the candidates to audio m line. 1704 // Only add the candidates to audio m line.
1466 JsepIceCandidate jice1("audio_content_name", 0, candidate1); 1705 JsepIceCandidate jice1("audio_content_name", 0, candidate1);
1467 JsepIceCandidate jice2("audio_content_name", 0, candidate2); 1706 JsepIceCandidate jice2("audio_content_name", 0, candidate2);
1468 ASSERT_TRUE(jdesc.AddCandidate(&jice1)); 1707 ASSERT_TRUE(jdesc.AddCandidate(&jice1));
1469 ASSERT_TRUE(jdesc.AddCandidate(&jice2)); 1708 ASSERT_TRUE(jdesc.AddCandidate(&jice2));
1470 std::string message = webrtc::SdpSerialize(jdesc); 1709 std::string message = webrtc::SdpSerialize(jdesc, false);
1471 1710
1472 // Audio line should have a c line like this one. 1711 // Audio line should have a c line like this one.
1473 EXPECT_NE(message.find("c=IN IP6 fe80::1234:5678:abcd:ef12"), 1712 EXPECT_NE(message.find("c=IN IP6 fe80::1234:5678:abcd:ef12"),
1474 std::string::npos); 1713 std::string::npos);
1475 // Shouldn't have a IP4 c line. 1714 // Shouldn't have a IP4 c line.
1476 EXPECT_EQ(message.find("c=IN IP4"), std::string::npos); 1715 EXPECT_EQ(message.find("c=IN IP4"), std::string::npos);
1477 } 1716 }
1478 1717
1479 // This tests serialization of SDP with only TCP candidates and verifies that 1718 // This tests serialization of SDP with only TCP candidates and verifies that
1480 // null IPv4 is used as default address in c line. 1719 // null IPv4 is used as default address in c line.
(...skipping 10 matching lines...) Expand all
1491 rtc::SocketAddress("::2", 1235), kCandidatePriority, "", "", 1730 rtc::SocketAddress("::2", 1235), kCandidatePriority, "", "",
1492 cricket::LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1); 1731 cricket::LOCAL_PORT_TYPE, kCandidateGeneration, kCandidateFoundation1);
1493 JsepSessionDescription jdesc(kDummyString); 1732 JsepSessionDescription jdesc(kDummyString);
1494 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); 1733 ASSERT_TRUE(jdesc.Initialize(desc_.Copy(), kSessionId, kSessionVersion));
1495 1734
1496 // Only add the candidates to audio m line. 1735 // Only add the candidates to audio m line.
1497 JsepIceCandidate jice1("audio_content_name", 0, candidate1); 1736 JsepIceCandidate jice1("audio_content_name", 0, candidate1);
1498 JsepIceCandidate jice2("audio_content_name", 0, candidate2); 1737 JsepIceCandidate jice2("audio_content_name", 0, candidate2);
1499 ASSERT_TRUE(jdesc.AddCandidate(&jice1)); 1738 ASSERT_TRUE(jdesc.AddCandidate(&jice1));
1500 ASSERT_TRUE(jdesc.AddCandidate(&jice2)); 1739 ASSERT_TRUE(jdesc.AddCandidate(&jice2));
1501 std::string message = webrtc::SdpSerialize(jdesc); 1740 std::string message = webrtc::SdpSerialize(jdesc, false);
1502 1741
1503 // Audio line should have a c line like this one when no any default exists. 1742 // Audio line should have a c line like this one when no any default exists.
1504 EXPECT_NE(message.find("c=IN IP4 0.0.0.0"), std::string::npos); 1743 EXPECT_NE(message.find("c=IN IP4 0.0.0.0"), std::string::npos);
1505 } 1744 }
1506 1745
1507 // This tests serialization of SDP with a=crypto and a=fingerprint, as would be 1746 // This tests serialization of SDP with a=crypto and a=fingerprint, as would be
1508 // the case in a DTLS offer. 1747 // the case in a DTLS offer.
1509 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithFingerprint) { 1748 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithFingerprint) {
1510 AddFingerprint(); 1749 AddFingerprint();
1511 JsepSessionDescription jdesc_with_fingerprint(kDummyString); 1750 JsepSessionDescription jdesc_with_fingerprint(kDummyString);
1512 ASSERT_TRUE(jdesc_with_fingerprint.Initialize(desc_.Copy(), 1751 ASSERT_TRUE(jdesc_with_fingerprint.Initialize(desc_.Copy(),
1513 kSessionId, kSessionVersion)); 1752 kSessionId, kSessionVersion));
1514 std::string message = webrtc::SdpSerialize(jdesc_with_fingerprint); 1753 std::string message = webrtc::SdpSerialize(jdesc_with_fingerprint, false);
1515 1754
1516 std::string sdp_with_fingerprint = kSdpString; 1755 std::string sdp_with_fingerprint = kSdpString;
1517 InjectAfter(kAttributeIcePwdVoice, 1756 InjectAfter(kAttributeIcePwdVoice,
1518 kFingerprint, &sdp_with_fingerprint); 1757 kFingerprint, &sdp_with_fingerprint);
1519 InjectAfter(kAttributeIcePwdVideo, 1758 InjectAfter(kAttributeIcePwdVideo,
1520 kFingerprint, &sdp_with_fingerprint); 1759 kFingerprint, &sdp_with_fingerprint);
1521 1760
1522 EXPECT_EQ(sdp_with_fingerprint, message); 1761 EXPECT_EQ(sdp_with_fingerprint, message);
1523 } 1762 }
1524 1763
1525 // This tests serialization of SDP with a=fingerprint with no a=crypto, as would 1764 // This tests serialization of SDP with a=fingerprint with no a=crypto, as would
1526 // be the case in a DTLS answer. 1765 // be the case in a DTLS answer.
1527 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithFingerprintNoCryptos) { 1766 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithFingerprintNoCryptos) {
1528 AddFingerprint(); 1767 AddFingerprint();
1529 RemoveCryptos(); 1768 RemoveCryptos();
1530 JsepSessionDescription jdesc_with_fingerprint(kDummyString); 1769 JsepSessionDescription jdesc_with_fingerprint(kDummyString);
1531 ASSERT_TRUE(jdesc_with_fingerprint.Initialize(desc_.Copy(), 1770 ASSERT_TRUE(jdesc_with_fingerprint.Initialize(desc_.Copy(),
1532 kSessionId, kSessionVersion)); 1771 kSessionId, kSessionVersion));
1533 std::string message = webrtc::SdpSerialize(jdesc_with_fingerprint); 1772 std::string message = webrtc::SdpSerialize(jdesc_with_fingerprint, false);
1534 1773
1535 std::string sdp_with_fingerprint = kSdpString; 1774 std::string sdp_with_fingerprint = kSdpString;
1536 Replace(kAttributeCryptoVoice, "", &sdp_with_fingerprint); 1775 Replace(kAttributeCryptoVoice, "", &sdp_with_fingerprint);
1537 Replace(kAttributeCryptoVideo, "", &sdp_with_fingerprint); 1776 Replace(kAttributeCryptoVideo, "", &sdp_with_fingerprint);
1538 InjectAfter(kAttributeIcePwdVoice, 1777 InjectAfter(kAttributeIcePwdVoice,
1539 kFingerprint, &sdp_with_fingerprint); 1778 kFingerprint, &sdp_with_fingerprint);
1540 InjectAfter(kAttributeIcePwdVideo, 1779 InjectAfter(kAttributeIcePwdVideo,
1541 kFingerprint, &sdp_with_fingerprint); 1780 kFingerprint, &sdp_with_fingerprint);
1542 1781
1543 EXPECT_EQ(sdp_with_fingerprint, message); 1782 EXPECT_EQ(sdp_with_fingerprint, message);
1544 } 1783 }
1545 1784
1546 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithoutCandidates) { 1785 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithoutCandidates) {
1547 // JsepSessionDescription with desc but without candidates. 1786 // JsepSessionDescription with desc but without candidates.
1548 JsepSessionDescription jdesc_no_candidates(kDummyString); 1787 JsepSessionDescription jdesc_no_candidates(kDummyString);
1549 ASSERT_TRUE(jdesc_no_candidates.Initialize(desc_.Copy(), kSessionId, 1788 ASSERT_TRUE(jdesc_no_candidates.Initialize(desc_.Copy(), kSessionId,
1550 kSessionVersion)); 1789 kSessionVersion));
1551 std::string message = webrtc::SdpSerialize(jdesc_no_candidates); 1790 std::string message = webrtc::SdpSerialize(jdesc_no_candidates, false);
1552 EXPECT_EQ(std::string(kSdpString), message); 1791 EXPECT_EQ(std::string(kSdpString), message);
1553 } 1792 }
1554 1793
1555 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBundle) { 1794 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBundle) {
1556 ContentGroup group(cricket::GROUP_TYPE_BUNDLE); 1795 ContentGroup group(cricket::GROUP_TYPE_BUNDLE);
1557 group.AddContentName(kAudioContentName); 1796 group.AddContentName(kAudioContentName);
1558 group.AddContentName(kVideoContentName); 1797 group.AddContentName(kVideoContentName);
1559 desc_.AddGroup(group); 1798 desc_.AddGroup(group);
1560 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), 1799 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
1561 jdesc_.session_id(), 1800 jdesc_.session_id(),
1562 jdesc_.session_version())); 1801 jdesc_.session_version()));
1563 std::string message = webrtc::SdpSerialize(jdesc_); 1802 std::string message = webrtc::SdpSerialize(jdesc_, false);
1564 std::string sdp_with_bundle = kSdpFullString; 1803 std::string sdp_with_bundle = kSdpFullString;
1565 InjectAfter(kSessionTime, 1804 InjectAfter(kSessionTime,
1566 "a=group:BUNDLE audio_content_name video_content_name\r\n", 1805 "a=group:BUNDLE audio_content_name video_content_name\r\n",
1567 &sdp_with_bundle); 1806 &sdp_with_bundle);
1568 EXPECT_EQ(sdp_with_bundle, message); 1807 EXPECT_EQ(sdp_with_bundle, message);
1569 } 1808 }
1570 1809
1571 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBandwidth) { 1810 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithBandwidth) {
1572 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( 1811 VideoContentDescription* vcd = static_cast<VideoContentDescription*>(
1573 GetFirstVideoContent(&desc_)->description); 1812 GetFirstVideoContent(&desc_)->description);
1574 vcd->set_bandwidth(100 * 1000); 1813 vcd->set_bandwidth(100 * 1000);
1575 AudioContentDescription* acd = static_cast<AudioContentDescription*>( 1814 AudioContentDescription* acd = static_cast<AudioContentDescription*>(
1576 GetFirstAudioContent(&desc_)->description); 1815 GetFirstAudioContent(&desc_)->description);
1577 acd->set_bandwidth(50 * 1000); 1816 acd->set_bandwidth(50 * 1000);
1578 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), 1817 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
1579 jdesc_.session_id(), 1818 jdesc_.session_id(),
1580 jdesc_.session_version())); 1819 jdesc_.session_version()));
1581 std::string message = webrtc::SdpSerialize(jdesc_); 1820 std::string message = webrtc::SdpSerialize(jdesc_, false);
1582 std::string sdp_with_bandwidth = kSdpFullString; 1821 std::string sdp_with_bandwidth = kSdpFullString;
1583 InjectAfter("c=IN IP4 74.125.224.39\r\n", 1822 InjectAfter("c=IN IP4 74.125.224.39\r\n",
1584 "b=AS:100\r\n", 1823 "b=AS:100\r\n",
1585 &sdp_with_bandwidth); 1824 &sdp_with_bandwidth);
1586 InjectAfter("c=IN IP4 74.125.127.126\r\n", 1825 InjectAfter("c=IN IP4 74.125.127.126\r\n",
1587 "b=AS:50\r\n", 1826 "b=AS:50\r\n",
1588 &sdp_with_bandwidth); 1827 &sdp_with_bandwidth);
1589 EXPECT_EQ(sdp_with_bandwidth, message); 1828 EXPECT_EQ(sdp_with_bandwidth, message);
1590 } 1829 }
1591 1830
1592 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithIceOptions) { 1831 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithIceOptions) {
1593 std::vector<std::string> transport_options; 1832 std::vector<std::string> transport_options;
1594 transport_options.push_back(kIceOption1); 1833 transport_options.push_back(kIceOption1);
1595 transport_options.push_back(kIceOption3); 1834 transport_options.push_back(kIceOption3);
1596 AddIceOptions(kAudioContentName, transport_options); 1835 AddIceOptions(kAudioContentName, transport_options);
1597 transport_options.clear(); 1836 transport_options.clear();
1598 transport_options.push_back(kIceOption2); 1837 transport_options.push_back(kIceOption2);
1599 transport_options.push_back(kIceOption3); 1838 transport_options.push_back(kIceOption3);
1600 AddIceOptions(kVideoContentName, transport_options); 1839 AddIceOptions(kVideoContentName, transport_options);
1601 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), 1840 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
1602 jdesc_.session_id(), 1841 jdesc_.session_id(),
1603 jdesc_.session_version())); 1842 jdesc_.session_version()));
1604 std::string message = webrtc::SdpSerialize(jdesc_); 1843 std::string message = webrtc::SdpSerialize(jdesc_, false);
1605 std::string sdp_with_ice_options = kSdpFullString; 1844 std::string sdp_with_ice_options = kSdpFullString;
1606 InjectAfter(kAttributeIcePwdVoice, 1845 InjectAfter(kAttributeIcePwdVoice,
1607 "a=ice-options:iceoption1 iceoption3\r\n", 1846 "a=ice-options:iceoption1 iceoption3\r\n",
1608 &sdp_with_ice_options); 1847 &sdp_with_ice_options);
1609 InjectAfter(kAttributeIcePwdVideo, 1848 InjectAfter(kAttributeIcePwdVideo,
1610 "a=ice-options:iceoption2 iceoption3\r\n", 1849 "a=ice-options:iceoption2 iceoption3\r\n",
1611 &sdp_with_ice_options); 1850 &sdp_with_ice_options);
1612 EXPECT_EQ(sdp_with_ice_options, message); 1851 EXPECT_EQ(sdp_with_ice_options, message);
1613 } 1852 }
1614 1853
(...skipping 19 matching lines...) Expand all
1634 1873
1635 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithAudioVideoRejected) { 1874 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithAudioVideoRejected) {
1636 EXPECT_TRUE(TestSerializeRejected(true, true)); 1875 EXPECT_TRUE(TestSerializeRejected(true, true));
1637 } 1876 }
1638 1877
1639 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithRtpDataChannel) { 1878 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithRtpDataChannel) {
1640 AddRtpDataChannel(); 1879 AddRtpDataChannel();
1641 JsepSessionDescription jsep_desc(kDummyString); 1880 JsepSessionDescription jsep_desc(kDummyString);
1642 1881
1643 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); 1882 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion));
1644 std::string message = webrtc::SdpSerialize(jsep_desc); 1883 std::string message = webrtc::SdpSerialize(jsep_desc, false);
1645 1884
1646 std::string expected_sdp = kSdpString; 1885 std::string expected_sdp = kSdpString;
1647 expected_sdp.append(kSdpRtpDataChannelString); 1886 expected_sdp.append(kSdpRtpDataChannelString);
1648 EXPECT_EQ(expected_sdp, message); 1887 EXPECT_EQ(expected_sdp, message);
1649 } 1888 }
1650 1889
1651 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithSctpDataChannel) { 1890 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithSctpDataChannel) {
1652 AddSctpDataChannel(); 1891 AddSctpDataChannel();
1653 JsepSessionDescription jsep_desc(kDummyString); 1892 JsepSessionDescription jsep_desc(kDummyString);
1654 1893
1655 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); 1894 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion));
1656 std::string message = webrtc::SdpSerialize(jsep_desc); 1895 std::string message = webrtc::SdpSerialize(jsep_desc, false);
1657 1896
1658 std::string expected_sdp = kSdpString; 1897 std::string expected_sdp = kSdpString;
1659 expected_sdp.append(kSdpSctpDataChannelString); 1898 expected_sdp.append(kSdpSctpDataChannelString);
1660 EXPECT_EQ(message, expected_sdp); 1899 EXPECT_EQ(message, expected_sdp);
1661 } 1900 }
1662 1901
1663 TEST_F(WebRtcSdpTest, SerializeWithSctpDataChannelAndNewPort) { 1902 TEST_F(WebRtcSdpTest, SerializeWithSctpDataChannelAndNewPort) {
1664 AddSctpDataChannel(); 1903 AddSctpDataChannel();
1665 JsepSessionDescription jsep_desc(kDummyString); 1904 JsepSessionDescription jsep_desc(kDummyString);
1666 1905
1667 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); 1906 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion));
1668 DataContentDescription* dcdesc = static_cast<DataContentDescription*>( 1907 DataContentDescription* dcdesc = static_cast<DataContentDescription*>(
1669 jsep_desc.description()->GetContentDescriptionByName(kDataContentName)); 1908 jsep_desc.description()->GetContentDescriptionByName(kDataContentName));
1670 1909
1671 const int kNewPort = 1234; 1910 const int kNewPort = 1234;
1672 cricket::DataCodec codec( 1911 cricket::DataCodec codec(
1673 cricket::kGoogleSctpDataCodecId, cricket::kGoogleSctpDataCodecName, 0); 1912 cricket::kGoogleSctpDataCodecId, cricket::kGoogleSctpDataCodecName, 0);
1674 codec.SetParam(cricket::kCodecParamPort, kNewPort); 1913 codec.SetParam(cricket::kCodecParamPort, kNewPort);
1675 dcdesc->AddOrReplaceCodec(codec); 1914 dcdesc->AddOrReplaceCodec(codec);
1676 1915
1677 std::string message = webrtc::SdpSerialize(jsep_desc); 1916 std::string message = webrtc::SdpSerialize(jsep_desc, false);
1678 1917
1679 std::string expected_sdp = kSdpString; 1918 std::string expected_sdp = kSdpString;
1680 expected_sdp.append(kSdpSctpDataChannelString); 1919 expected_sdp.append(kSdpSctpDataChannelString);
1681 1920
1682 char default_portstr[16]; 1921 char default_portstr[16];
1683 char new_portstr[16]; 1922 char new_portstr[16];
1684 rtc::sprintfn(default_portstr, sizeof(default_portstr), "%d", 1923 rtc::sprintfn(default_portstr, sizeof(default_portstr), "%d",
1685 kDefaultSctpPort); 1924 kDefaultSctpPort);
1686 rtc::sprintfn(new_portstr, sizeof(new_portstr), "%d", kNewPort); 1925 rtc::sprintfn(new_portstr, sizeof(new_portstr), "%d", kNewPort);
1687 rtc::replace_substrs(default_portstr, strlen(default_portstr), 1926 rtc::replace_substrs(default_portstr, strlen(default_portstr),
1688 new_portstr, strlen(new_portstr), 1927 new_portstr, strlen(new_portstr),
1689 &expected_sdp); 1928 &expected_sdp);
1690 1929
1691 EXPECT_EQ(expected_sdp, message); 1930 EXPECT_EQ(expected_sdp, message);
1692 } 1931 }
1693 1932
1694 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithDataChannelAndBandwidth) { 1933 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithDataChannelAndBandwidth) {
1695 AddRtpDataChannel(); 1934 AddRtpDataChannel();
1696 data_desc_->set_bandwidth(100*1000); 1935 data_desc_->set_bandwidth(100*1000);
1697 JsepSessionDescription jsep_desc(kDummyString); 1936 JsepSessionDescription jsep_desc(kDummyString);
1698 1937
1699 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion)); 1938 ASSERT_TRUE(jsep_desc.Initialize(desc_.Copy(), kSessionId, kSessionVersion));
1700 std::string message = webrtc::SdpSerialize(jsep_desc); 1939 std::string message = webrtc::SdpSerialize(jsep_desc, false);
1701 1940
1702 std::string expected_sdp = kSdpString; 1941 std::string expected_sdp = kSdpString;
1703 expected_sdp.append(kSdpRtpDataChannelString); 1942 expected_sdp.append(kSdpRtpDataChannelString);
1704 // Serializing data content shouldn't ignore bandwidth settings. 1943 // Serializing data content shouldn't ignore bandwidth settings.
1705 InjectAfter("m=application 9 RTP/SAVPF 101\r\nc=IN IP4 0.0.0.0\r\n", 1944 InjectAfter("m=application 9 RTP/SAVPF 101\r\nc=IN IP4 0.0.0.0\r\n",
1706 "b=AS:100\r\n", 1945 "b=AS:100\r\n",
1707 &expected_sdp); 1946 &expected_sdp);
1708 EXPECT_EQ(expected_sdp, message); 1947 EXPECT_EQ(expected_sdp, message);
1709 } 1948 }
1710 1949
1711 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithExtmap) { 1950 TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithExtmap) {
1712 AddExtmap(); 1951 AddExtmap();
1713 JsepSessionDescription desc_with_extmap("dummy"); 1952 JsepSessionDescription desc_with_extmap("dummy");
1714 ASSERT_TRUE(desc_with_extmap.Initialize(desc_.Copy(), 1953 ASSERT_TRUE(desc_with_extmap.Initialize(desc_.Copy(),
1715 kSessionId, kSessionVersion)); 1954 kSessionId, kSessionVersion));
1716 std::string message = webrtc::SdpSerialize(desc_with_extmap); 1955 std::string message = webrtc::SdpSerialize(desc_with_extmap, false);
1717 1956
1718 std::string sdp_with_extmap = kSdpString; 1957 std::string sdp_with_extmap = kSdpString;
1719 InjectAfter("a=mid:audio_content_name\r\n", 1958 InjectAfter("a=mid:audio_content_name\r\n",
1720 kExtmap, &sdp_with_extmap); 1959 kExtmap, &sdp_with_extmap);
1721 InjectAfter("a=mid:video_content_name\r\n", 1960 InjectAfter("a=mid:video_content_name\r\n",
1722 kExtmap, &sdp_with_extmap); 1961 kExtmap, &sdp_with_extmap);
1723 1962
1724 EXPECT_EQ(sdp_with_extmap, message); 1963 EXPECT_EQ(sdp_with_extmap, message);
1725 } 1964 }
1726 1965
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 TestDeserializeExtmap(true, true); 2544 TestDeserializeExtmap(true, true);
2306 } 2545 }
2307 2546
2308 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutEndLineBreak) { 2547 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutEndLineBreak) {
2309 JsepSessionDescription jdesc(kDummyString); 2548 JsepSessionDescription jdesc(kDummyString);
2310 std::string sdp = kSdpFullString; 2549 std::string sdp = kSdpFullString;
2311 sdp = sdp.substr(0, sdp.size() - 2); // Remove \r\n at the end. 2550 sdp = sdp.substr(0, sdp.size() - 2); // Remove \r\n at the end.
2312 // Deserialize 2551 // Deserialize
2313 SdpParseError error; 2552 SdpParseError error;
2314 EXPECT_FALSE(webrtc::SdpDeserialize(sdp, &jdesc, &error)); 2553 EXPECT_FALSE(webrtc::SdpDeserialize(sdp, &jdesc, &error));
2315 const std::string lastline = "a=ssrc:6 label:video_track_id_3"; 2554 const std::string lastline = "a=ssrc:3 label:video_track_id_1";
2316 EXPECT_EQ(lastline, error.line); 2555 EXPECT_EQ(lastline, error.line);
2317 EXPECT_EQ("Invalid SDP line.", error.description); 2556 EXPECT_EQ("Invalid SDP line.", error.description);
2318 } 2557 }
2319 2558
2320 TEST_F(WebRtcSdpTest, DeserializeCandidateWithDifferentTransport) { 2559 TEST_F(WebRtcSdpTest, DeserializeCandidateWithDifferentTransport) {
2321 JsepIceCandidate jcandidate(kDummyMid, kDummyIndex); 2560 JsepIceCandidate jcandidate(kDummyMid, kDummyIndex);
2322 std::string new_sdp = kSdpOneCandidate; 2561 std::string new_sdp = kSdpOneCandidate;
2323 Replace("udp", "unsupported_transport", &new_sdp); 2562 Replace("udp", "unsupported_transport", &new_sdp);
2324 EXPECT_FALSE(SdpDeserializeCandidate(new_sdp, &jcandidate)); 2563 EXPECT_FALSE(SdpDeserializeCandidate(new_sdp, &jcandidate));
2325 new_sdp = kSdpOneCandidate; 2564 new_sdp = kSdpOneCandidate;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2405 ExpectParseFailure("a=sendrecv", kSdpMd5); 2644 ExpectParseFailure("a=sendrecv", kSdpMd5);
2406 2645
2407 // Empty Line 2646 // Empty Line
2408 ExpectParseFailure("a=rtcp:2347 IN IP4 74.125.127.126", kSdpEmptyLine); 2647 ExpectParseFailure("a=rtcp:2347 IN IP4 74.125.127.126", kSdpEmptyLine);
2409 ExpectParseFailure("a=rtcp:2347 IN IP4 74.125.127.126", kSdpMissingValue); 2648 ExpectParseFailure("a=rtcp:2347 IN IP4 74.125.127.126", kSdpMissingValue);
2410 } 2649 }
2411 2650
2412 TEST_F(WebRtcSdpTest, DeserializeSdpWithInvalidAttributeValue) { 2651 TEST_F(WebRtcSdpTest, DeserializeSdpWithInvalidAttributeValue) {
2413 // ssrc 2652 // ssrc
2414 ExpectParseFailure("a=ssrc:1", "a=ssrc:badvalue"); 2653 ExpectParseFailure("a=ssrc:1", "a=ssrc:badvalue");
2415 ExpectParseFailure("a=ssrc-group:FEC 5 6", "a=ssrc-group:FEC badvalue 6"); 2654 ExpectParseFailure("a=ssrc-group:FEC 2 3", "a=ssrc-group:FEC badvalue 3");
2416 // crypto 2655 // crypto
2417 ExpectParseFailure("a=crypto:1 ", "a=crypto:badvalue "); 2656 ExpectParseFailure("a=crypto:1 ", "a=crypto:badvalue ");
2418 // rtpmap 2657 // rtpmap
2419 ExpectParseFailure("a=rtpmap:111 ", "a=rtpmap:badvalue "); 2658 ExpectParseFailure("a=rtpmap:111 ", "a=rtpmap:badvalue ");
2420 ExpectParseFailure("opus/48000/2", "opus/badvalue/2"); 2659 ExpectParseFailure("opus/48000/2", "opus/badvalue/2");
2421 ExpectParseFailure("opus/48000/2", "opus/48000/badvalue"); 2660 ExpectParseFailure("opus/48000/2", "opus/48000/badvalue");
2422 // candidate 2661 // candidate
2423 ExpectParseFailure("1 udp 2130706432", "badvalue udp 2130706432"); 2662 ExpectParseFailure("1 udp 2130706432", "badvalue udp 2130706432");
2424 ExpectParseFailure("1 udp 2130706432", "1 udp badvalue"); 2663 ExpectParseFailure("1 udp 2130706432", "1 udp badvalue");
2425 ExpectParseFailure("192.168.1.5 1234", "192.168.1.5 badvalue"); 2664 ExpectParseFailure("192.168.1.5 1234", "192.168.1.5 badvalue");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 JsepSessionDescription jdesc_output(kDummyString); 2714 JsepSessionDescription jdesc_output(kDummyString);
2476 CodecParams params; 2715 CodecParams params;
2477 params.max_ptime = 40; 2716 params.max_ptime = 40;
2478 params.ptime = 30; 2717 params.ptime = 30;
2479 params.min_ptime = 10; 2718 params.min_ptime = 10;
2480 params.sprop_stereo = 1; 2719 params.sprop_stereo = 1;
2481 params.stereo = 1; 2720 params.stereo = 1;
2482 params.useinband = 1; 2721 params.useinband = 1;
2483 params.maxaveragebitrate = 128000; 2722 params.maxaveragebitrate = 128000;
2484 TestDeserializeCodecParams(params, &jdesc_output); 2723 TestDeserializeCodecParams(params, &jdesc_output);
2485 TestSerialize(jdesc_output); 2724 TestSerialize(jdesc_output, false);
2486 } 2725 }
2487 2726
2488 TEST_F(WebRtcSdpTest, DeserializeSerializeRtcpFb) { 2727 TEST_F(WebRtcSdpTest, DeserializeSerializeRtcpFb) {
2489 const bool kUseWildcard = false; 2728 const bool kUseWildcard = false;
2490 JsepSessionDescription jdesc_output(kDummyString); 2729 JsepSessionDescription jdesc_output(kDummyString);
2491 TestDeserializeRtcpFb(&jdesc_output, kUseWildcard); 2730 TestDeserializeRtcpFb(&jdesc_output, kUseWildcard);
2492 TestSerialize(jdesc_output); 2731 TestSerialize(jdesc_output, false);
2493 } 2732 }
2494 2733
2495 TEST_F(WebRtcSdpTest, DeserializeSerializeRtcpFbWildcard) { 2734 TEST_F(WebRtcSdpTest, DeserializeSerializeRtcpFbWildcard) {
2496 const bool kUseWildcard = true; 2735 const bool kUseWildcard = true;
2497 JsepSessionDescription jdesc_output(kDummyString); 2736 JsepSessionDescription jdesc_output(kDummyString);
2498 TestDeserializeRtcpFb(&jdesc_output, kUseWildcard); 2737 TestDeserializeRtcpFb(&jdesc_output, kUseWildcard);
2499 TestSerialize(jdesc_output); 2738 TestSerialize(jdesc_output, false);
2500 } 2739 }
2501 2740
2502 TEST_F(WebRtcSdpTest, DeserializeVideoFmtp) { 2741 TEST_F(WebRtcSdpTest, DeserializeVideoFmtp) {
2503 JsepSessionDescription jdesc_output(kDummyString); 2742 JsepSessionDescription jdesc_output(kDummyString);
2504 2743
2505 const char kSdpWithFmtpString[] = 2744 const char kSdpWithFmtpString[] =
2506 "v=0\r\n" 2745 "v=0\r\n"
2507 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 2746 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
2508 "s=-\r\n" 2747 "s=-\r\n"
2509 "t=0 0\r\n" 2748 "t=0 0\r\n"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 VideoContentDescription* vcd = static_cast<VideoContentDescription*>( 2810 VideoContentDescription* vcd = static_cast<VideoContentDescription*>(
2572 GetFirstVideoContent(&desc_)->description); 2811 GetFirstVideoContent(&desc_)->description);
2573 2812
2574 cricket::VideoCodecs codecs = vcd->codecs(); 2813 cricket::VideoCodecs codecs = vcd->codecs();
2575 codecs[0].params["x-google-min-bitrate"] = "10"; 2814 codecs[0].params["x-google-min-bitrate"] = "10";
2576 vcd->set_codecs(codecs); 2815 vcd->set_codecs(codecs);
2577 2816
2578 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), 2817 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
2579 jdesc_.session_id(), 2818 jdesc_.session_id(),
2580 jdesc_.session_version())); 2819 jdesc_.session_version()));
2581 std::string message = webrtc::SdpSerialize(jdesc_); 2820 std::string message = webrtc::SdpSerialize(jdesc_, false);
2582 std::string sdp_with_fmtp = kSdpFullString; 2821 std::string sdp_with_fmtp = kSdpFullString;
2583 InjectAfter("a=rtpmap:120 VP8/90000\r\n", 2822 InjectAfter("a=rtpmap:120 VP8/90000\r\n",
2584 "a=fmtp:120 x-google-min-bitrate=10\r\n", 2823 "a=fmtp:120 x-google-min-bitrate=10\r\n",
2585 &sdp_with_fmtp); 2824 &sdp_with_fmtp);
2586 EXPECT_EQ(sdp_with_fmtp, message); 2825 EXPECT_EQ(sdp_with_fmtp, message);
2587 } 2826 }
2588 2827
2589 TEST_F(WebRtcSdpTest, DeserializeSdpWithIceLite) { 2828 TEST_F(WebRtcSdpTest, DeserializeSdpWithIceLite) {
2590 JsepSessionDescription jdesc_with_icelite(kDummyString); 2829 JsepSessionDescription jdesc_with_icelite(kDummyString);
2591 std::string sdp_with_icelite = kSdpFullString; 2830 std::string sdp_with_icelite = kSdpFullString;
(...skipping 19 matching lines...) Expand all
2611 } 2850 }
2612 2851
2613 // Verifies that the candidates in the input SDP are parsed and serialized 2852 // Verifies that the candidates in the input SDP are parsed and serialized
2614 // correctly in the output SDP. 2853 // correctly in the output SDP.
2615 TEST_F(WebRtcSdpTest, RoundTripSdpWithSctpDataChannelsWithCandidates) { 2854 TEST_F(WebRtcSdpTest, RoundTripSdpWithSctpDataChannelsWithCandidates) {
2616 std::string sdp_with_data = kSdpString; 2855 std::string sdp_with_data = kSdpString;
2617 sdp_with_data.append(kSdpSctpDataChannelWithCandidatesString); 2856 sdp_with_data.append(kSdpSctpDataChannelWithCandidatesString);
2618 JsepSessionDescription jdesc_output(kDummyString); 2857 JsepSessionDescription jdesc_output(kDummyString);
2619 2858
2620 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output)); 2859 EXPECT_TRUE(SdpDeserialize(sdp_with_data, &jdesc_output));
2621 EXPECT_EQ(sdp_with_data, webrtc::SdpSerialize(jdesc_output)); 2860 EXPECT_EQ(sdp_with_data, webrtc::SdpSerialize(jdesc_output, false));
2622 } 2861 }
2623 2862
2624 TEST_F(WebRtcSdpTest, SerializeDtlsSetupAttribute) { 2863 TEST_F(WebRtcSdpTest, SerializeDtlsSetupAttribute) {
2625 AddFingerprint(); 2864 AddFingerprint();
2626 TransportInfo audio_transport_info = 2865 TransportInfo audio_transport_info =
2627 *(desc_.GetTransportInfoByName(kAudioContentName)); 2866 *(desc_.GetTransportInfoByName(kAudioContentName));
2628 EXPECT_EQ(cricket::CONNECTIONROLE_NONE, 2867 EXPECT_EQ(cricket::CONNECTIONROLE_NONE,
2629 audio_transport_info.description.connection_role); 2868 audio_transport_info.description.connection_role);
2630 audio_transport_info.description.connection_role = 2869 audio_transport_info.description.connection_role =
2631 cricket::CONNECTIONROLE_ACTIVE; 2870 cricket::CONNECTIONROLE_ACTIVE;
2632 2871
2633 TransportInfo video_transport_info = 2872 TransportInfo video_transport_info =
2634 *(desc_.GetTransportInfoByName(kVideoContentName)); 2873 *(desc_.GetTransportInfoByName(kVideoContentName));
2635 EXPECT_EQ(cricket::CONNECTIONROLE_NONE, 2874 EXPECT_EQ(cricket::CONNECTIONROLE_NONE,
2636 video_transport_info.description.connection_role); 2875 video_transport_info.description.connection_role);
2637 video_transport_info.description.connection_role = 2876 video_transport_info.description.connection_role =
2638 cricket::CONNECTIONROLE_ACTIVE; 2877 cricket::CONNECTIONROLE_ACTIVE;
2639 2878
2640 desc_.RemoveTransportInfoByName(kAudioContentName); 2879 desc_.RemoveTransportInfoByName(kAudioContentName);
2641 desc_.RemoveTransportInfoByName(kVideoContentName); 2880 desc_.RemoveTransportInfoByName(kVideoContentName);
2642 2881
2643 desc_.AddTransportInfo(audio_transport_info); 2882 desc_.AddTransportInfo(audio_transport_info);
2644 desc_.AddTransportInfo(video_transport_info); 2883 desc_.AddTransportInfo(video_transport_info);
2645 2884
2646 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), 2885 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(),
2647 jdesc_.session_id(), 2886 jdesc_.session_id(),
2648 jdesc_.session_version())); 2887 jdesc_.session_version()));
2649 std::string message = webrtc::SdpSerialize(jdesc_); 2888 std::string message = webrtc::SdpSerialize(jdesc_, false);
2650 std::string sdp_with_dtlssetup = kSdpFullString; 2889 std::string sdp_with_dtlssetup = kSdpFullString;
2651 2890
2652 // Fingerprint attribute is necessary to add DTLS setup attribute. 2891 // Fingerprint attribute is necessary to add DTLS setup attribute.
2653 InjectAfter(kAttributeIcePwdVoice, 2892 InjectAfter(kAttributeIcePwdVoice,
2654 kFingerprint, &sdp_with_dtlssetup); 2893 kFingerprint, &sdp_with_dtlssetup);
2655 InjectAfter(kAttributeIcePwdVideo, 2894 InjectAfter(kAttributeIcePwdVideo,
2656 kFingerprint, &sdp_with_dtlssetup); 2895 kFingerprint, &sdp_with_dtlssetup);
2657 // Now adding |setup| attribute. 2896 // Now adding |setup| attribute.
2658 InjectAfter(kFingerprint, 2897 InjectAfter(kFingerprint,
2659 "a=setup:active\r\n", &sdp_with_dtlssetup); 2898 "a=setup:active\r\n", &sdp_with_dtlssetup);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2711 cricket::SessionDescription* desc = jdesc.description(); 2950 cricket::SessionDescription* desc = jdesc.description();
2712 EXPECT_EQ(3u, desc->contents().size()); 2951 EXPECT_EQ(3u, desc->contents().size());
2713 2952
2714 for (size_t i = 0; i < 3; ++i) { 2953 for (size_t i = 0; i < 3; ++i) {
2715 const cricket::MediaContentDescription* mdesc = 2954 const cricket::MediaContentDescription* mdesc =
2716 static_cast<const cricket::MediaContentDescription*>( 2955 static_cast<const cricket::MediaContentDescription*>(
2717 desc->contents()[i].description); 2956 desc->contents()[i].description);
2718 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); 2957 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type());
2719 } 2958 }
2720 2959
2721 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); 2960 std::string serialized_sdp = webrtc::SdpSerialize(jdesc, false);
2722 EXPECT_EQ(sdp_string, serialized_sdp); 2961 EXPECT_EQ(sdp_string, serialized_sdp);
2723 } 2962 }
2724 } 2963 }
2964
2965 TEST_F(WebRtcSdpTest, DeserializePlanBSessionDescription) {
2966 MakePlanBDescription();
2967
2968 JsepSessionDescription deserialized_description(kDummyString);
2969 EXPECT_TRUE(SdpDeserialize(kPlanBSdpFullString, &deserialized_description));
2970
2971 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description));
2972 }
2973
2974 TEST_F(WebRtcSdpTest, SerializePlanBSessionDescription) {
2975 MakePlanBDescription();
2976 TestSerialize(jdesc_, false);
2977 }
2978
2979 TEST_F(WebRtcSdpTest, DeserializeUnifiedPlanSessionDescription) {
2980 MakeUnifiedPlanDescription();
2981
2982 JsepSessionDescription deserialized_description(kDummyString);
2983 EXPECT_TRUE(
2984 SdpDeserialize(kUnifiedPlanSdpFullString, &deserialized_description));
2985
2986 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description));
2987 }
2988
2989 TEST_F(WebRtcSdpTest, SerializeUnifiedPlanSessionDescription) {
2990 MakeUnifiedPlanDescription();
2991 TestSerialize(jdesc_, true);
2992 }
OLDNEW
« webrtc/api/webrtcsdp.cc ('K') | « webrtc/api/webrtcsdp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698