OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 using webrtc::JsepSessionDescription; | 74 using webrtc::JsepSessionDescription; |
75 using webrtc::SdpParseError; | 75 using webrtc::SdpParseError; |
76 using webrtc::SessionDescriptionInterface; | 76 using webrtc::SessionDescriptionInterface; |
77 | 77 |
78 typedef std::vector<AudioCodec> AudioCodecs; | 78 typedef std::vector<AudioCodec> AudioCodecs; |
79 typedef std::vector<Candidate> Candidates; | 79 typedef std::vector<Candidate> Candidates; |
80 | 80 |
81 static const uint32_t kDefaultSctpPort = 5000; | 81 static const uint32_t kDefaultSctpPort = 5000; |
82 static const char kSessionTime[] = "t=0 0\r\n"; | 82 static const char kSessionTime[] = "t=0 0\r\n"; |
83 static const uint32_t kCandidatePriority = 2130706432U; // pref = 1.0 | 83 static const uint32_t kCandidatePriority = 2130706432U; // pref = 1.0 |
84 static const char kCandidateUfragVoice[] = "ufrag_voice"; | |
85 static const char kCandidatePwdVoice[] = "pwd_voice"; | |
86 static const char kAttributeIceUfragVoice[] = "a=ice-ufrag:ufrag_voice\r\n"; | 84 static const char kAttributeIceUfragVoice[] = "a=ice-ufrag:ufrag_voice\r\n"; |
87 static const char kAttributeIcePwdVoice[] = "a=ice-pwd:pwd_voice\r\n"; | 85 static const char kAttributeIcePwdVoice[] = "a=ice-pwd:pwd_voice\r\n"; |
88 static const char kCandidateUfragVideo[] = "ufrag_video"; | |
89 static const char kCandidatePwdVideo[] = "pwd_video"; | |
90 static const char kCandidateUfragData[] = "ufrag_data"; | |
91 static const char kCandidatePwdData[] = "pwd_data"; | |
92 static const char kAttributeIceUfragVideo[] = "a=ice-ufrag:ufrag_video\r\n"; | 86 static const char kAttributeIceUfragVideo[] = "a=ice-ufrag:ufrag_video\r\n"; |
93 static const char kAttributeIcePwdVideo[] = "a=ice-pwd:pwd_video\r\n"; | 87 static const char kAttributeIcePwdVideo[] = "a=ice-pwd:pwd_video\r\n"; |
94 static const uint32_t kCandidateGeneration = 2; | 88 static const uint32_t kCandidateGeneration = 2; |
95 static const char kCandidateFoundation1[] = "a0+B/1"; | 89 static const char kCandidateFoundation1[] = "a0+B/1"; |
96 static const char kCandidateFoundation2[] = "a0+B/2"; | 90 static const char kCandidateFoundation2[] = "a0+B/2"; |
97 static const char kCandidateFoundation3[] = "a0+B/3"; | 91 static const char kCandidateFoundation3[] = "a0+B/3"; |
98 static const char kCandidateFoundation4[] = "a0+B/4"; | 92 static const char kCandidateFoundation4[] = "a0+B/4"; |
99 static const char kAttributeCryptoVoice[] = | 93 static const char kAttributeCryptoVoice[] = |
100 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " | 94 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " |
101 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " | 95 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " |
(...skipping 21 matching lines...) Expand all Loading... | |
123 struct CodecParams { | 117 struct CodecParams { |
124 int max_ptime; | 118 int max_ptime; |
125 int ptime; | 119 int ptime; |
126 int min_ptime; | 120 int min_ptime; |
127 int sprop_stereo; | 121 int sprop_stereo; |
128 int stereo; | 122 int stereo; |
129 int useinband; | 123 int useinband; |
130 int maxaveragebitrate; | 124 int maxaveragebitrate; |
131 }; | 125 }; |
132 | 126 |
127 // TODO(deadbeef): In these reference strings, use "a=fingerprint" by default | |
128 // instead of "a=crypto", and have an explicit test for adding "a=crypto". | |
129 // Currently it's the other way around. | |
130 | |
133 // Reference sdp string | 131 // Reference sdp string |
134 static const char kSdpFullString[] = | 132 static const char kSdpFullString[] = |
135 "v=0\r\n" | 133 "v=0\r\n" |
136 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" | 134 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" |
137 "s=-\r\n" | 135 "s=-\r\n" |
138 "t=0 0\r\n" | 136 "t=0 0\r\n" |
139 "a=msid-semantic: WMS local_stream_1 local_stream_2\r\n" | 137 "a=msid-semantic: WMS local_stream_1\r\n" |
140 "m=audio 2345 RTP/SAVPF 111 103 104\r\n" | 138 "m=audio 2345 RTP/SAVPF 111 103 104\r\n" |
141 "c=IN IP4 74.125.127.126\r\n" | 139 "c=IN IP4 74.125.127.126\r\n" |
142 "a=rtcp:2347 IN IP4 74.125.127.126\r\n" | 140 "a=rtcp:2347 IN IP4 74.125.127.126\r\n" |
143 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " | 141 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " |
144 "generation 2\r\n" | 142 "generation 2\r\n" |
145 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host " | 143 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host " |
146 "generation 2\r\n" | 144 "generation 2\r\n" |
147 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host " | 145 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host " |
148 "generation 2\r\n" | 146 "generation 2\r\n" |
149 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host " | 147 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host " |
(...skipping 12 matching lines...) Expand all Loading... | |
162 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " | 160 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " |
163 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " | 161 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " |
164 "dummy_session_params\r\n" | 162 "dummy_session_params\r\n" |
165 "a=rtpmap:111 opus/48000/2\r\n" | 163 "a=rtpmap:111 opus/48000/2\r\n" |
166 "a=rtpmap:103 ISAC/16000\r\n" | 164 "a=rtpmap:103 ISAC/16000\r\n" |
167 "a=rtpmap:104 ISAC/32000\r\n" | 165 "a=rtpmap:104 ISAC/32000\r\n" |
168 "a=ssrc:1 cname:stream_1_cname\r\n" | 166 "a=ssrc:1 cname:stream_1_cname\r\n" |
169 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n" | 167 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n" |
170 "a=ssrc:1 mslabel:local_stream_1\r\n" | 168 "a=ssrc:1 mslabel:local_stream_1\r\n" |
171 "a=ssrc:1 label:audio_track_id_1\r\n" | 169 "a=ssrc:1 label:audio_track_id_1\r\n" |
172 "a=ssrc:4 cname:stream_2_cname\r\n" | |
173 "a=ssrc:4 msid:local_stream_2 audio_track_id_2\r\n" | |
174 "a=ssrc:4 mslabel:local_stream_2\r\n" | |
175 "a=ssrc:4 label:audio_track_id_2\r\n" | |
Taylor Brandstetter
2016/02/12 02:20:10
I removed the extra tracks from the base reference
| |
176 "m=video 3457 RTP/SAVPF 120\r\n" | 170 "m=video 3457 RTP/SAVPF 120\r\n" |
177 "c=IN IP4 74.125.224.39\r\n" | 171 "c=IN IP4 74.125.224.39\r\n" |
178 "a=rtcp:3456 IN IP4 74.125.224.39\r\n" | 172 "a=rtcp:3456 IN IP4 74.125.224.39\r\n" |
179 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host " | 173 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host " |
180 "generation 2\r\n" | 174 "generation 2\r\n" |
181 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host " | 175 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host " |
182 "generation 2\r\n" | 176 "generation 2\r\n" |
183 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host " | 177 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host " |
184 "generation 2\r\n" | 178 "generation 2\r\n" |
185 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host " | 179 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host " |
186 "generation 2\r\n" | 180 "generation 2\r\n" |
187 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay " | 181 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay " |
188 "generation 2\r\n" | 182 "generation 2\r\n" |
189 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay " | 183 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay " |
190 "generation 2\r\n" | 184 "generation 2\r\n" |
191 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" | 185 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" |
192 "a=mid:video_content_name\r\n" | 186 "a=mid:video_content_name\r\n" |
193 "a=sendrecv\r\n" | 187 "a=sendrecv\r\n" |
194 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " | 188 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " |
195 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" | 189 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" |
196 "a=rtpmap:120 VP8/90000\r\n" | 190 "a=rtpmap:120 VP8/90000\r\n" |
191 "a=ssrc-group:FEC 2 3\r\n" | |
197 "a=ssrc:2 cname:stream_1_cname\r\n" | 192 "a=ssrc:2 cname:stream_1_cname\r\n" |
198 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n" | 193 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n" |
199 "a=ssrc:2 mslabel:local_stream_1\r\n" | 194 "a=ssrc:2 mslabel:local_stream_1\r\n" |
200 "a=ssrc:2 label:video_track_id_1\r\n" | 195 "a=ssrc:2 label:video_track_id_1\r\n" |
201 "a=ssrc:3 cname:stream_1_cname\r\n" | 196 "a=ssrc:3 cname:stream_1_cname\r\n" |
202 "a=ssrc:3 msid:local_stream_1 video_track_id_2\r\n" | 197 "a=ssrc:3 msid:local_stream_1 video_track_id_1\r\n" |
203 "a=ssrc:3 mslabel:local_stream_1\r\n" | 198 "a=ssrc:3 mslabel:local_stream_1\r\n" |
204 "a=ssrc:3 label:video_track_id_2\r\n" | 199 "a=ssrc:3 label:video_track_id_1\r\n"; |
205 "a=ssrc-group:FEC 5 6\r\n" | |
206 "a=ssrc:5 cname:stream_2_cname\r\n" | |
207 "a=ssrc:5 msid:local_stream_2 video_track_id_3\r\n" | |
208 "a=ssrc:5 mslabel:local_stream_2\r\n" | |
209 "a=ssrc:5 label:video_track_id_3\r\n" | |
210 "a=ssrc:6 cname:stream_2_cname\r\n" | |
211 "a=ssrc:6 msid:local_stream_2 video_track_id_3\r\n" | |
212 "a=ssrc:6 mslabel:local_stream_2\r\n" | |
213 "a=ssrc:6 label:video_track_id_3\r\n"; | |
214 | 200 |
215 // SDP reference string without the candidates. | 201 // SDP reference string without the candidates. |
216 static const char kSdpString[] = | 202 static const char kSdpString[] = |
217 "v=0\r\n" | 203 "v=0\r\n" |
218 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" | 204 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" |
219 "s=-\r\n" | 205 "s=-\r\n" |
220 "t=0 0\r\n" | 206 "t=0 0\r\n" |
221 "a=msid-semantic: WMS local_stream_1 local_stream_2\r\n" | 207 "a=msid-semantic: WMS local_stream_1\r\n" |
222 "m=audio 9 RTP/SAVPF 111 103 104\r\n" | 208 "m=audio 9 RTP/SAVPF 111 103 104\r\n" |
223 "c=IN IP4 0.0.0.0\r\n" | 209 "c=IN IP4 0.0.0.0\r\n" |
224 "a=rtcp:9 IN IP4 0.0.0.0\r\n" | 210 "a=rtcp:9 IN IP4 0.0.0.0\r\n" |
225 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n" | 211 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n" |
226 "a=mid:audio_content_name\r\n" | 212 "a=mid:audio_content_name\r\n" |
227 "a=sendrecv\r\n" | 213 "a=sendrecv\r\n" |
228 "a=rtcp-mux\r\n" | 214 "a=rtcp-mux\r\n" |
229 "a=rtcp-rsize\r\n" | 215 "a=rtcp-rsize\r\n" |
230 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " | 216 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " |
231 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " | 217 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " |
232 "dummy_session_params\r\n" | 218 "dummy_session_params\r\n" |
233 "a=rtpmap:111 opus/48000/2\r\n" | 219 "a=rtpmap:111 opus/48000/2\r\n" |
234 "a=rtpmap:103 ISAC/16000\r\n" | 220 "a=rtpmap:103 ISAC/16000\r\n" |
235 "a=rtpmap:104 ISAC/32000\r\n" | 221 "a=rtpmap:104 ISAC/32000\r\n" |
236 "a=ssrc:1 cname:stream_1_cname\r\n" | 222 "a=ssrc:1 cname:stream_1_cname\r\n" |
237 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n" | 223 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n" |
238 "a=ssrc:1 mslabel:local_stream_1\r\n" | 224 "a=ssrc:1 mslabel:local_stream_1\r\n" |
239 "a=ssrc:1 label:audio_track_id_1\r\n" | 225 "a=ssrc:1 label:audio_track_id_1\r\n" |
240 "a=ssrc:4 cname:stream_2_cname\r\n" | |
241 "a=ssrc:4 msid:local_stream_2 audio_track_id_2\r\n" | |
242 "a=ssrc:4 mslabel:local_stream_2\r\n" | |
243 "a=ssrc:4 label:audio_track_id_2\r\n" | |
244 "m=video 9 RTP/SAVPF 120\r\n" | 226 "m=video 9 RTP/SAVPF 120\r\n" |
245 "c=IN IP4 0.0.0.0\r\n" | 227 "c=IN IP4 0.0.0.0\r\n" |
246 "a=rtcp:9 IN IP4 0.0.0.0\r\n" | 228 "a=rtcp:9 IN IP4 0.0.0.0\r\n" |
247 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" | 229 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" |
248 "a=mid:video_content_name\r\n" | 230 "a=mid:video_content_name\r\n" |
249 "a=sendrecv\r\n" | 231 "a=sendrecv\r\n" |
250 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " | 232 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " |
251 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" | 233 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" |
252 "a=rtpmap:120 VP8/90000\r\n" | 234 "a=rtpmap:120 VP8/90000\r\n" |
235 "a=ssrc-group:FEC 2 3\r\n" | |
253 "a=ssrc:2 cname:stream_1_cname\r\n" | 236 "a=ssrc:2 cname:stream_1_cname\r\n" |
254 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n" | 237 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n" |
255 "a=ssrc:2 mslabel:local_stream_1\r\n" | 238 "a=ssrc:2 mslabel:local_stream_1\r\n" |
256 "a=ssrc:2 label:video_track_id_1\r\n" | 239 "a=ssrc:2 label:video_track_id_1\r\n" |
257 "a=ssrc:3 cname:stream_1_cname\r\n" | 240 "a=ssrc:3 cname:stream_1_cname\r\n" |
258 "a=ssrc:3 msid:local_stream_1 video_track_id_2\r\n" | 241 "a=ssrc:3 msid:local_stream_1 video_track_id_1\r\n" |
259 "a=ssrc:3 mslabel:local_stream_1\r\n" | 242 "a=ssrc:3 mslabel:local_stream_1\r\n" |
260 "a=ssrc:3 label:video_track_id_2\r\n" | 243 "a=ssrc:3 label:video_track_id_1\r\n"; |
261 "a=ssrc-group:FEC 5 6\r\n" | |
262 "a=ssrc:5 cname:stream_2_cname\r\n" | |
263 "a=ssrc:5 msid:local_stream_2 video_track_id_3\r\n" | |
264 "a=ssrc:5 mslabel:local_stream_2\r\n" | |
265 "a=ssrc:5 label:video_track_id_3\r\n" | |
266 "a=ssrc:6 cname:stream_2_cname\r\n" | |
267 "a=ssrc:6 msid:local_stream_2 video_track_id_3\r\n" | |
268 "a=ssrc:6 mslabel:local_stream_2\r\n" | |
269 "a=ssrc:6 label:video_track_id_3\r\n"; | |
270 | 244 |
271 static const char kSdpRtpDataChannelString[] = | 245 static const char kSdpRtpDataChannelString[] = |
272 "m=application 9 RTP/SAVPF 101\r\n" | 246 "m=application 9 RTP/SAVPF 101\r\n" |
273 "c=IN IP4 0.0.0.0\r\n" | 247 "c=IN IP4 0.0.0.0\r\n" |
274 "a=rtcp:9 IN IP4 0.0.0.0\r\n" | 248 "a=rtcp:9 IN IP4 0.0.0.0\r\n" |
275 "a=ice-ufrag:ufrag_data\r\n" | 249 "a=ice-ufrag:ufrag_data\r\n" |
276 "a=ice-pwd:pwd_data\r\n" | 250 "a=ice-pwd:pwd_data\r\n" |
277 "a=mid:data_content_name\r\n" | 251 "a=mid:data_content_name\r\n" |
278 "a=sendrecv\r\n" | 252 "a=sendrecv\r\n" |
279 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " | 253 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 "a=rtcp:9 IN IP4 0.0.0.0\r\n" | 339 "a=rtcp:9 IN IP4 0.0.0.0\r\n" |
366 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" | 340 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" |
367 "a=mid:video_content_name\r\n" | 341 "a=mid:video_content_name\r\n" |
368 "a=sendrecv\r\n" | 342 "a=sendrecv\r\n" |
369 "a=rtpmap:120 VP8/90000\r\n" | 343 "a=rtpmap:120 VP8/90000\r\n" |
370 "a=ssrc:2 cname:stream_1_cname\r\n" | 344 "a=ssrc:2 cname:stream_1_cname\r\n" |
371 "a=ssrc:2 msid:local_stream video_track_id_1\r\n" | 345 "a=ssrc:2 msid:local_stream video_track_id_1\r\n" |
372 "a=ssrc:2 mslabel:local_stream\r\n" | 346 "a=ssrc:2 mslabel:local_stream\r\n" |
373 "a=ssrc:2 label:video_track_id_1\r\n"; | 347 "a=ssrc:2 label:video_track_id_1\r\n"; |
374 | 348 |
349 // Plan B SDP reference string, with 2 streams, 2 audio tracks and 3 video | |
350 // tracks. | |
351 static const char kPlanBSdpFullString[] = | |
352 "v=0\r\n" | |
353 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" | |
354 "s=-\r\n" | |
355 "t=0 0\r\n" | |
356 "a=msid-semantic: WMS local_stream_1 local_stream_2\r\n" | |
357 "m=audio 2345 RTP/SAVPF 111 103 104\r\n" | |
358 "c=IN IP4 74.125.127.126\r\n" | |
359 "a=rtcp:2347 IN IP4 74.125.127.126\r\n" | |
360 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " | |
361 "generation 2\r\n" | |
362 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host " | |
363 "generation 2\r\n" | |
364 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host " | |
365 "generation 2\r\n" | |
366 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host " | |
367 "generation 2\r\n" | |
368 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx " | |
369 "raddr 192.168.1.5 rport 2346 " | |
370 "generation 2\r\n" | |
371 "a=candidate:a0+B/3 2 udp 2130706432 74.125.127.126 2347 typ srflx " | |
372 "raddr 192.168.1.5 rport 2348 " | |
373 "generation 2\r\n" | |
374 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n" | |
375 "a=mid:audio_content_name\r\n" | |
376 "a=sendrecv\r\n" | |
377 "a=rtcp-mux\r\n" | |
378 "a=rtcp-rsize\r\n" | |
379 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " | |
380 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " | |
381 "dummy_session_params\r\n" | |
382 "a=rtpmap:111 opus/48000/2\r\n" | |
383 "a=rtpmap:103 ISAC/16000\r\n" | |
384 "a=rtpmap:104 ISAC/32000\r\n" | |
385 "a=ssrc:1 cname:stream_1_cname\r\n" | |
386 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n" | |
387 "a=ssrc:1 mslabel:local_stream_1\r\n" | |
388 "a=ssrc:1 label:audio_track_id_1\r\n" | |
389 "a=ssrc:4 cname:stream_2_cname\r\n" | |
390 "a=ssrc:4 msid:local_stream_2 audio_track_id_2\r\n" | |
391 "a=ssrc:4 mslabel:local_stream_2\r\n" | |
392 "a=ssrc:4 label:audio_track_id_2\r\n" | |
393 "m=video 3457 RTP/SAVPF 120\r\n" | |
394 "c=IN IP4 74.125.224.39\r\n" | |
395 "a=rtcp:3456 IN IP4 74.125.224.39\r\n" | |
396 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host " | |
397 "generation 2\r\n" | |
398 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host " | |
399 "generation 2\r\n" | |
400 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host " | |
401 "generation 2\r\n" | |
402 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host " | |
403 "generation 2\r\n" | |
404 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay " | |
405 "generation 2\r\n" | |
406 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay " | |
407 "generation 2\r\n" | |
408 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" | |
409 "a=mid:video_content_name\r\n" | |
410 "a=sendrecv\r\n" | |
411 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " | |
412 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" | |
413 "a=rtpmap:120 VP8/90000\r\n" | |
414 "a=ssrc-group:FEC 2 3\r\n" | |
415 "a=ssrc:2 cname:stream_1_cname\r\n" | |
416 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n" | |
417 "a=ssrc:2 mslabel:local_stream_1\r\n" | |
418 "a=ssrc:2 label:video_track_id_1\r\n" | |
419 "a=ssrc:3 cname:stream_1_cname\r\n" | |
420 "a=ssrc:3 msid:local_stream_1 video_track_id_1\r\n" | |
421 "a=ssrc:3 mslabel:local_stream_1\r\n" | |
422 "a=ssrc:3 label:video_track_id_1\r\n" | |
423 "a=ssrc:5 cname:stream_2_cname\r\n" | |
424 "a=ssrc:5 msid:local_stream_2 video_track_id_2\r\n" | |
425 "a=ssrc:5 mslabel:local_stream_2\r\n" | |
426 "a=ssrc:5 label:video_track_id_2\r\n" | |
427 "a=ssrc:6 cname:stream_2_cname\r\n" | |
428 "a=ssrc:6 msid:local_stream_2 video_track_id_3\r\n" | |
429 "a=ssrc:6 mslabel:local_stream_2\r\n" | |
430 "a=ssrc:6 label:video_track_id_3\r\n"; | |
431 | |
432 // Unified Plan SDP reference string, with 2 streams, 2 audio tracks and 3 video | |
433 // tracks. | |
434 static const char kUnifiedPlanSdpFullString[] = | |
435 "v=0\r\n" | |
436 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" | |
437 "s=-\r\n" | |
438 "t=0 0\r\n" | |
439 "a=msid-semantic: WMS local_stream_1\r\n" | |
440 // Audio track 1, stream 1 (with candidates). | |
441 "m=audio 2345 RTP/SAVPF 111 103 104\r\n" | |
442 "c=IN IP4 74.125.127.126\r\n" | |
443 "a=rtcp:2347 IN IP4 74.125.127.126\r\n" | |
444 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " | |
445 "generation 2\r\n" | |
446 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host " | |
447 "generation 2\r\n" | |
448 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host " | |
449 "generation 2\r\n" | |
450 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host " | |
451 "generation 2\r\n" | |
452 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx " | |
453 "raddr 192.168.1.5 rport 2346 " | |
454 "generation 2\r\n" | |
455 "a=candidate:a0+B/3 2 udp 2130706432 74.125.127.126 2347 typ srflx " | |
456 "raddr 192.168.1.5 rport 2348 " | |
457 "generation 2\r\n" | |
458 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n" | |
459 "a=mid:audio_content_name\r\n" | |
460 "a=msid:local_stream_1 audio_track_id_1\r\n" | |
461 "a=sendrecv\r\n" | |
462 "a=rtcp-mux\r\n" | |
463 "a=rtcp-rsize\r\n" | |
464 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " | |
465 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " | |
466 "dummy_session_params\r\n" | |
467 "a=rtpmap:111 opus/48000/2\r\n" | |
468 "a=rtpmap:103 ISAC/16000\r\n" | |
469 "a=rtpmap:104 ISAC/32000\r\n" | |
470 "a=ssrc:1 cname:stream_1_cname\r\n" | |
471 // Video track 1, stream 1 (with candidates). | |
472 "m=video 3457 RTP/SAVPF 120\r\n" | |
473 "c=IN IP4 74.125.224.39\r\n" | |
474 "a=rtcp:3456 IN IP4 74.125.224.39\r\n" | |
475 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host " | |
476 "generation 2\r\n" | |
477 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host " | |
478 "generation 2\r\n" | |
479 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host " | |
480 "generation 2\r\n" | |
481 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host " | |
482 "generation 2\r\n" | |
483 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay " | |
484 "generation 2\r\n" | |
485 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay " | |
486 "generation 2\r\n" | |
487 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n" | |
488 "a=mid:video_content_name\r\n" | |
489 "a=msid:local_stream_1 video_track_id_1\r\n" | |
490 "a=sendrecv\r\n" | |
491 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " | |
492 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" | |
493 "a=rtpmap:120 VP8/90000\r\n" | |
494 "a=ssrc-group:FEC 2 3\r\n" | |
495 "a=ssrc:2 cname:stream_1_cname\r\n" | |
496 "a=ssrc:3 cname:stream_1_cname\r\n" | |
497 // Audio track 2, stream 2. | |
498 "m=audio 9 RTP/SAVPF 111 103 104\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_voice_2\r\na=ice-pwd:pwd_voice_2\r\n" | |
502 "a=mid:audio_content_name_2\r\n" | |
503 "a=msid:local_stream_2 audio_track_id_2\r\n" | |
504 "a=sendrecv\r\n" | |
505 "a=rtcp-mux\r\n" | |
506 "a=rtcp-rsize\r\n" | |
507 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 " | |
508 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 " | |
509 "dummy_session_params\r\n" | |
510 "a=rtpmap:111 opus/48000/2\r\n" | |
511 "a=rtpmap:103 ISAC/16000\r\n" | |
512 "a=rtpmap:104 ISAC/32000\r\n" | |
513 "a=ssrc:4 cname:stream_2_cname\r\n" | |
514 // Video track 2, stream 2. | |
515 "m=video 9 RTP/SAVPF 120\r\n" | |
516 "c=IN IP4 0.0.0.0\r\n" | |
517 "a=rtcp:9 IN IP4 0.0.0.0\r\n" | |
518 "a=ice-ufrag:ufrag_video_2\r\na=ice-pwd:pwd_video_2\r\n" | |
519 "a=mid:video_content_name_2\r\n" | |
520 "a=msid:local_stream_2 video_track_id_2\r\n" | |
521 "a=sendrecv\r\n" | |
522 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " | |
523 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" | |
524 "a=rtpmap:120 VP8/90000\r\n" | |
525 "a=ssrc:5 cname:stream_2_cname\r\n" | |
526 // Video track 3, stream 2. | |
527 "m=video 9 RTP/SAVPF 120\r\n" | |
528 "c=IN IP4 0.0.0.0\r\n" | |
529 "a=rtcp:9 IN IP4 0.0.0.0\r\n" | |
530 "a=ice-ufrag:ufrag_video_3\r\na=ice-pwd:pwd_video_3\r\n" | |
531 "a=mid:video_content_name_3\r\n" | |
532 "a=msid:local_stream_2 video_track_id_3\r\n" | |
533 "a=sendrecv\r\n" | |
534 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " | |
535 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n" | |
536 "a=rtpmap:120 VP8/90000\r\n" | |
537 "a=ssrc:6 cname:stream_2_cname\r\n"; | |
375 | 538 |
376 // One candidate reference string as per W3c spec. | 539 // One candidate reference string as per W3c spec. |
377 // candidate:<blah> not a=candidate:<blah>CRLF | 540 // candidate:<blah> not a=candidate:<blah>CRLF |
378 static const char kRawCandidate[] = | 541 static const char kRawCandidate[] = |
379 "candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host generation 2"; | 542 "candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host generation 2"; |
380 // One candidate reference string. | 543 // One candidate reference string. |
381 static const char kSdpOneCandidate[] = | 544 static const char kSdpOneCandidate[] = |
382 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " | 545 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host " |
383 "generation 2\r\n"; | 546 "generation 2\r\n"; |
384 | 547 |
(...skipping 17 matching lines...) Expand all Loading... | |
402 | 565 |
403 // One candidate reference string. | 566 // One candidate reference string. |
404 static const char kSdpOneCandidateWithUfragPwd[] = | 567 static const char kSdpOneCandidateWithUfragPwd[] = |
405 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host network_name" | 568 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host network_name" |
406 " eth0 ufrag user_rtp pwd password_rtp generation 2\r\n"; | 569 " eth0 ufrag user_rtp pwd password_rtp generation 2\r\n"; |
407 | 570 |
408 // Session id and version | 571 // Session id and version |
409 static const char kSessionId[] = "18446744069414584320"; | 572 static const char kSessionId[] = "18446744069414584320"; |
410 static const char kSessionVersion[] = "18446462598732840960"; | 573 static const char kSessionVersion[] = "18446462598732840960"; |
411 | 574 |
412 // Ice options | 575 // ICE options. |
413 static const char kIceOption1[] = "iceoption1"; | 576 static const char kIceOption1[] = "iceoption1"; |
414 static const char kIceOption2[] = "iceoption2"; | 577 static const char kIceOption2[] = "iceoption2"; |
415 static const char kIceOption3[] = "iceoption3"; | 578 static const char kIceOption3[] = "iceoption3"; |
416 | 579 |
580 // ICE ufrags/passwords. | |
581 static const char kUfragVoice[] = "ufrag_voice"; | |
582 static const char kPwdVoice[] = "pwd_voice"; | |
583 static const char kUfragVideo[] = "ufrag_video"; | |
584 static const char kPwdVideo[] = "pwd_video"; | |
585 static const char kUfragData[] = "ufrag_data"; | |
586 static const char kPwdData[] = "pwd_data"; | |
587 | |
588 // Extra ufrags/passwords for extra unified plan m= sections. | |
589 static const char kUfragVoice2[] = "ufrag_voice_2"; | |
590 static const char kPwdVoice2[] = "pwd_voice_2"; | |
591 static const char kUfragVideo2[] = "ufrag_video_2"; | |
592 static const char kPwdVideo2[] = "pwd_video_2"; | |
593 static const char kUfragVideo3[] = "ufrag_video_3"; | |
594 static const char kPwdVideo3[] = "pwd_video_3"; | |
595 | |
417 // Content name | 596 // Content name |
418 static const char kAudioContentName[] = "audio_content_name"; | 597 static const char kAudioContentName[] = "audio_content_name"; |
419 static const char kVideoContentName[] = "video_content_name"; | 598 static const char kVideoContentName[] = "video_content_name"; |
420 static const char kDataContentName[] = "data_content_name"; | 599 static const char kDataContentName[] = "data_content_name"; |
421 | 600 |
601 // Extra content names for extra unified plan m= sections. | |
602 static const char kAudioContentName2[] = "audio_content_name_2"; | |
603 static const char kVideoContentName2[] = "video_content_name_2"; | |
604 static const char kVideoContentName3[] = "video_content_name_3"; | |
605 | |
422 // MediaStream 1 | 606 // MediaStream 1 |
423 static const char kStreamLabel1[] = "local_stream_1"; | 607 static const char kStreamLabel1[] = "local_stream_1"; |
424 static const char kStream1Cname[] = "stream_1_cname"; | 608 static const char kStream1Cname[] = "stream_1_cname"; |
425 static const char kAudioTrackId1[] = "audio_track_id_1"; | 609 static const char kAudioTrackId1[] = "audio_track_id_1"; |
426 static const uint32_t kAudioTrack1Ssrc = 1; | 610 static const uint32_t kAudioTrack1Ssrc = 1; |
427 static const char kVideoTrackId1[] = "video_track_id_1"; | 611 static const char kVideoTrackId1[] = "video_track_id_1"; |
428 static const uint32_t kVideoTrack1Ssrc = 2; | 612 static const uint32_t kVideoTrack1Ssrc1 = 2; |
429 static const char kVideoTrackId2[] = "video_track_id_2"; | 613 static const uint32_t kVideoTrack1Ssrc2 = 3; |
430 static const uint32_t kVideoTrack2Ssrc = 3; | |
431 | 614 |
432 // MediaStream 2 | 615 // MediaStream 2 |
433 static const char kStreamLabel2[] = "local_stream_2"; | 616 static const char kStreamLabel2[] = "local_stream_2"; |
434 static const char kStream2Cname[] = "stream_2_cname"; | 617 static const char kStream2Cname[] = "stream_2_cname"; |
435 static const char kAudioTrackId2[] = "audio_track_id_2"; | 618 static const char kAudioTrackId2[] = "audio_track_id_2"; |
436 static const uint32_t kAudioTrack2Ssrc = 4; | 619 static const uint32_t kAudioTrack2Ssrc = 4; |
620 static const char kVideoTrackId2[] = "video_track_id_2"; | |
621 static const uint32_t kVideoTrack2Ssrc = 5; | |
437 static const char kVideoTrackId3[] = "video_track_id_3"; | 622 static const char kVideoTrackId3[] = "video_track_id_3"; |
438 static const uint32_t kVideoTrack3Ssrc = 5; | 623 static const uint32_t kVideoTrack3Ssrc = 6; |
439 static const uint32_t kVideoTrack4Ssrc = 6; | |
440 | 624 |
441 // DataChannel | 625 // DataChannel |
442 static const char kDataChannelLabel[] = "data_channel"; | 626 static const char kDataChannelLabel[] = "data_channel"; |
443 static const char kDataChannelMsid[] = "data_channeld0"; | 627 static const char kDataChannelMsid[] = "data_channeld0"; |
444 static const char kDataChannelCname[] = "data_channel_cname"; | 628 static const char kDataChannelCname[] = "data_channel_cname"; |
445 static const uint32_t kDataChannelSsrc = 10; | 629 static const uint32_t kDataChannelSsrc = 10; |
446 | 630 |
447 // Candidate | 631 // Candidate |
448 static const char kDummyMid[] = "dummy_mid"; | 632 static const char kDummyMid[] = "dummy_mid"; |
449 static const int kDummyIndex = 123; | 633 static const int kDummyIndex = 123; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 | 729 |
546 class WebRtcSdpTest : public testing::Test { | 730 class WebRtcSdpTest : public testing::Test { |
547 public: | 731 public: |
548 WebRtcSdpTest() | 732 WebRtcSdpTest() |
549 : jdesc_(kDummyString) { | 733 : jdesc_(kDummyString) { |
550 #ifdef WEBRTC_ANDROID | 734 #ifdef WEBRTC_ANDROID |
551 webrtc::InitializeAndroidObjects(); | 735 webrtc::InitializeAndroidObjects(); |
552 #endif | 736 #endif |
553 // AudioContentDescription | 737 // AudioContentDescription |
554 audio_desc_ = CreateAudioContentDescription(); | 738 audio_desc_ = CreateAudioContentDescription(); |
555 AudioCodec opus(111, "opus", 48000, 0, 2, 3); | 739 StreamParams audio_stream; |
556 audio_desc_->AddCodec(opus); | 740 audio_stream.id = kAudioTrackId1; |
557 audio_desc_->AddCodec(AudioCodec(103, "ISAC", 16000, 32000, 1, 2)); | 741 audio_stream.cname = kStream1Cname; |
558 audio_desc_->AddCodec(AudioCodec(104, "ISAC", 32000, 56000, 1, 1)); | 742 audio_stream.sync_label = kStreamLabel1; |
743 audio_stream.ssrcs.push_back(kAudioTrack1Ssrc); | |
744 audio_desc_->AddStream(audio_stream); | |
559 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_); | 745 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_); |
560 | 746 |
561 // VideoContentDescription | 747 // VideoContentDescription |
562 rtc::scoped_ptr<VideoContentDescription> video( | 748 video_desc_ = CreateVideoContentDescription(); |
563 new VideoContentDescription()); | 749 StreamParams video_stream; |
564 video_desc_ = video.get(); | 750 video_stream.id = kVideoTrackId1; |
565 StreamParams video_stream1; | 751 video_stream.cname = kStream1Cname; |
566 video_stream1.id = kVideoTrackId1; | 752 video_stream.sync_label = kStreamLabel1; |
567 video_stream1.cname = kStream1Cname; | 753 video_stream.ssrcs.push_back(kVideoTrack1Ssrc1); |
568 video_stream1.sync_label = kStreamLabel1; | 754 video_stream.ssrcs.push_back(kVideoTrack1Ssrc2); |
569 video_stream1.ssrcs.push_back(kVideoTrack1Ssrc); | 755 cricket::SsrcGroup ssrc_group(kFecSsrcGroupSemantics, video_stream.ssrcs); |
570 video->AddStream(video_stream1); | 756 video_stream.ssrc_groups.push_back(ssrc_group); |
571 StreamParams video_stream2; | 757 video_desc_->AddStream(video_stream); |
572 video_stream2.id = kVideoTrackId2; | 758 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_desc_); |
573 video_stream2.cname = kStream1Cname; | |
574 video_stream2.sync_label = kStreamLabel1; | |
575 video_stream2.ssrcs.push_back(kVideoTrack2Ssrc); | |
576 video->AddStream(video_stream2); | |
577 StreamParams video_stream3; | |
578 video_stream3.id = kVideoTrackId3; | |
579 video_stream3.cname = kStream2Cname; | |
580 video_stream3.sync_label = kStreamLabel2; | |
581 video_stream3.ssrcs.push_back(kVideoTrack3Ssrc); | |
582 video_stream3.ssrcs.push_back(kVideoTrack4Ssrc); | |
583 cricket::SsrcGroup ssrc_group(kFecSsrcGroupSemantics, video_stream3.ssrcs); | |
584 video_stream3.ssrc_groups.push_back(ssrc_group); | |
585 video->AddStream(video_stream3); | |
586 video->AddCrypto(CryptoParams(1, "AES_CM_128_HMAC_SHA1_80", | |
587 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32", "")); | |
588 video->set_protocol(cricket::kMediaProtocolSavpf); | |
589 video->AddCodec(VideoCodec( | |
590 120, | |
591 JsepSessionDescription::kDefaultVideoCodecName, | |
592 JsepSessionDescription::kMaxVideoCodecWidth, | |
593 JsepSessionDescription::kMaxVideoCodecHeight, | |
594 JsepSessionDescription::kDefaultVideoCodecFramerate, | |
595 JsepSessionDescription::kDefaultVideoCodecPreference)); | |
596 | |
597 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, | |
598 video.release()); | |
599 | 759 |
600 // TransportInfo | 760 // TransportInfo |
601 EXPECT_TRUE(desc_.AddTransportInfo( | 761 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
602 TransportInfo(kAudioContentName, | 762 kAudioContentName, TransportDescription(kUfragVoice, kPwdVoice)))); |
603 TransportDescription(kCandidateUfragVoice, | 763 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
604 kCandidatePwdVoice)))); | 764 kVideoContentName, TransportDescription(kUfragVideo, kPwdVideo)))); |
605 EXPECT_TRUE(desc_.AddTransportInfo( | |
606 TransportInfo(kVideoContentName, | |
607 TransportDescription(kCandidateUfragVideo, | |
608 kCandidatePwdVideo)))); | |
609 | 765 |
610 // v4 host | 766 // v4 host |
611 int port = 1234; | 767 int port = 1234; |
612 rtc::SocketAddress address("192.168.1.5", port++); | 768 rtc::SocketAddress address("192.168.1.5", port++); |
613 Candidate candidate1(ICE_CANDIDATE_COMPONENT_RTP, "udp", address, | 769 Candidate candidate1(ICE_CANDIDATE_COMPONENT_RTP, "udp", address, |
614 kCandidatePriority, "", "", LOCAL_PORT_TYPE, | 770 kCandidatePriority, "", "", LOCAL_PORT_TYPE, |
615 kCandidateGeneration, kCandidateFoundation1); | 771 kCandidateGeneration, kCandidateFoundation1); |
616 address.SetPort(port++); | 772 address.SetPort(port++); |
617 Candidate candidate2(ICE_CANDIDATE_COMPONENT_RTCP, "udp", address, | 773 Candidate candidate2(ICE_CANDIDATE_COMPONENT_RTCP, "udp", address, |
618 kCandidatePriority, "", "", LOCAL_PORT_TYPE, | 774 kCandidatePriority, "", "", LOCAL_PORT_TYPE, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
708 bool is_video = (i > 5); | 864 bool is_video = (i > 5); |
709 mline_id = is_video ? "video_content_name" : "audio_content_name"; | 865 mline_id = is_video ? "video_content_name" : "audio_content_name"; |
710 mline_index = is_video ? 1 : 0; | 866 mline_index = is_video ? 1 : 0; |
711 JsepIceCandidate jice(mline_id, | 867 JsepIceCandidate jice(mline_id, |
712 mline_index, | 868 mline_index, |
713 candidates_.at(i)); | 869 candidates_.at(i)); |
714 jdesc_.AddCandidate(&jice); | 870 jdesc_.AddCandidate(&jice); |
715 } | 871 } |
716 } | 872 } |
717 | 873 |
874 // Turns the existing reference description into a plan B description, | |
875 // with 2 audio tracks and 3 video tracks. | |
876 void MakePlanBDescription() { | |
877 audio_desc_ = static_cast<AudioContentDescription*>(audio_desc_->Copy()); | |
878 video_desc_ = static_cast<VideoContentDescription*>(video_desc_->Copy()); | |
879 | |
880 StreamParams audio_track_2; | |
881 audio_track_2.id = kAudioTrackId2; | |
882 audio_track_2.cname = kStream2Cname; | |
883 audio_track_2.sync_label = kStreamLabel2; | |
884 audio_track_2.ssrcs.push_back(kAudioTrack2Ssrc); | |
885 audio_desc_->AddStream(audio_track_2); | |
886 | |
887 StreamParams video_track_2; | |
888 video_track_2.id = kVideoTrackId2; | |
889 video_track_2.cname = kStream2Cname; | |
890 video_track_2.sync_label = kStreamLabel2; | |
891 video_track_2.ssrcs.push_back(kVideoTrack2Ssrc); | |
892 video_desc_->AddStream(video_track_2); | |
893 | |
894 StreamParams video_track_3; | |
895 video_track_3.id = kVideoTrackId3; | |
896 video_track_3.cname = kStream2Cname; | |
897 video_track_3.sync_label = kStreamLabel2; | |
898 video_track_3.ssrcs.push_back(kVideoTrack3Ssrc); | |
899 video_desc_->AddStream(video_track_3); | |
900 | |
901 desc_.RemoveContentByName(kAudioContentName); | |
902 desc_.RemoveContentByName(kVideoContentName); | |
903 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_); | |
904 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_desc_); | |
905 | |
906 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), jdesc_.session_id(), | |
907 jdesc_.session_version())); | |
908 } | |
909 | |
910 // Turns the existing reference description into a unified plan description, | |
911 // with 2 audio tracks and 3 video tracks. | |
912 void MakeUnifiedPlanDescription() { | |
913 // Audio track 2. | |
914 AudioContentDescription* audio_desc_2 = CreateAudioContentDescription(); | |
915 StreamParams audio_track_2; | |
916 audio_track_2.id = kAudioTrackId2; | |
917 audio_track_2.cname = kStream2Cname; | |
918 audio_track_2.sync_label = kStreamLabel2; | |
919 audio_track_2.ssrcs.push_back(kAudioTrack2Ssrc); | |
920 audio_desc_2->AddStream(audio_track_2); | |
921 desc_.AddContent(kAudioContentName2, NS_JINGLE_RTP, audio_desc_2); | |
922 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( | |
923 kAudioContentName2, TransportDescription(kUfragVoice2, kPwdVoice2)))); | |
924 | |
925 // Video track 2, in stream 2. | |
926 VideoContentDescription* video_desc_2 = CreateVideoContentDescription(); | |
927 StreamParams video_track_2; | |
928 video_track_2.id = kVideoTrackId2; | |
929 video_track_2.cname = kStream2Cname; | |
930 video_track_2.sync_label = kStreamLabel2; | |
931 video_track_2.ssrcs.push_back(kVideoTrack2Ssrc); | |
932 video_desc_2->AddStream(video_track_2); | |
933 desc_.AddContent(kVideoContentName2, NS_JINGLE_RTP, video_desc_2); | |
934 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( | |
935 kVideoContentName2, TransportDescription(kUfragVideo2, kPwdVideo2)))); | |
936 | |
937 // Video track 3, in stream 2. | |
938 VideoContentDescription* video_desc_3 = CreateVideoContentDescription(); | |
939 StreamParams video_track_3; | |
940 video_track_3.id = kVideoTrackId3; | |
941 video_track_3.cname = kStream2Cname; | |
942 video_track_3.sync_label = kStreamLabel2; | |
943 video_track_3.ssrcs.push_back(kVideoTrack3Ssrc); | |
944 video_desc_3->AddStream(video_track_3); | |
945 desc_.AddContent(kVideoContentName3, NS_JINGLE_RTP, video_desc_3); | |
946 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( | |
947 kVideoContentName3, TransportDescription(kUfragVideo3, kPwdVideo3)))); | |
948 | |
949 ASSERT_TRUE(jdesc_.Initialize(desc_.Copy(), jdesc_.session_id(), | |
950 jdesc_.session_version())); | |
951 } | |
952 | |
953 // Creates an audio content description with no streams, and some default | |
954 // configuration. | |
718 AudioContentDescription* CreateAudioContentDescription() { | 955 AudioContentDescription* CreateAudioContentDescription() { |
719 AudioContentDescription* audio = new AudioContentDescription(); | 956 AudioContentDescription* audio = new AudioContentDescription(); |
720 audio->set_rtcp_mux(true); | 957 audio->set_rtcp_mux(true); |
721 audio->set_rtcp_reduced_size(true); | 958 audio->set_rtcp_reduced_size(true); |
722 StreamParams audio_stream1; | |
723 audio_stream1.id = kAudioTrackId1; | |
724 audio_stream1.cname = kStream1Cname; | |
725 audio_stream1.sync_label = kStreamLabel1; | |
726 audio_stream1.ssrcs.push_back(kAudioTrack1Ssrc); | |
727 audio->AddStream(audio_stream1); | |
728 StreamParams audio_stream2; | |
729 audio_stream2.id = kAudioTrackId2; | |
730 audio_stream2.cname = kStream2Cname; | |
731 audio_stream2.sync_label = kStreamLabel2; | |
732 audio_stream2.ssrcs.push_back(kAudioTrack2Ssrc); | |
733 audio->AddStream(audio_stream2); | |
734 audio->AddCrypto(CryptoParams(1, "AES_CM_128_HMAC_SHA1_32", | 959 audio->AddCrypto(CryptoParams(1, "AES_CM_128_HMAC_SHA1_32", |
735 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32", | 960 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32", |
736 "dummy_session_params")); | 961 "dummy_session_params")); |
737 audio->set_protocol(cricket::kMediaProtocolSavpf); | 962 audio->set_protocol(cricket::kMediaProtocolSavpf); |
963 AudioCodec opus(111, "opus", 48000, 0, 2, 3); | |
964 audio->AddCodec(opus); | |
965 audio->AddCodec(AudioCodec(103, "ISAC", 16000, 32000, 1, 2)); | |
966 audio->AddCodec(AudioCodec(104, "ISAC", 32000, 56000, 1, 1)); | |
738 return audio; | 967 return audio; |
739 } | 968 } |
740 | 969 |
970 // Creates a video content description with no streams, and some default | |
971 // configuration. | |
972 VideoContentDescription* CreateVideoContentDescription() { | |
973 VideoContentDescription* video = new VideoContentDescription(); | |
974 video->AddCrypto(CryptoParams( | |
975 1, "AES_CM_128_HMAC_SHA1_80", | |
976 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32", "")); | |
977 video->set_protocol(cricket::kMediaProtocolSavpf); | |
978 video->AddCodec( | |
979 VideoCodec(120, JsepSessionDescription::kDefaultVideoCodecName, | |
980 JsepSessionDescription::kMaxVideoCodecWidth, | |
981 JsepSessionDescription::kMaxVideoCodecHeight, | |
982 JsepSessionDescription::kDefaultVideoCodecFramerate, | |
983 JsepSessionDescription::kDefaultVideoCodecPreference)); | |
984 return video; | |
985 } | |
986 | |
741 template <class MCD> | 987 template <class MCD> |
742 void CompareMediaContentDescription(const MCD* cd1, | 988 void CompareMediaContentDescription(const MCD* cd1, |
743 const MCD* cd2) { | 989 const MCD* cd2) { |
744 // type | 990 // type |
745 EXPECT_EQ(cd1->type(), cd1->type()); | 991 EXPECT_EQ(cd1->type(), cd1->type()); |
746 | 992 |
747 // content direction | 993 // content direction |
748 EXPECT_EQ(cd1->direction(), cd2->direction()); | 994 EXPECT_EQ(cd1->direction(), cd2->direction()); |
749 | 995 |
750 // rtcp_mux | 996 // rtcp_mux |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
996 } | 1242 } |
997 | 1243 |
998 void AddFingerprint() { | 1244 void AddFingerprint() { |
999 desc_.RemoveTransportInfoByName(kAudioContentName); | 1245 desc_.RemoveTransportInfoByName(kAudioContentName); |
1000 desc_.RemoveTransportInfoByName(kVideoContentName); | 1246 desc_.RemoveTransportInfoByName(kVideoContentName); |
1001 rtc::SSLFingerprint fingerprint(rtc::DIGEST_SHA_1, | 1247 rtc::SSLFingerprint fingerprint(rtc::DIGEST_SHA_1, |
1002 kIdentityDigest, | 1248 kIdentityDigest, |
1003 sizeof(kIdentityDigest)); | 1249 sizeof(kIdentityDigest)); |
1004 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( | 1250 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
1005 kAudioContentName, | 1251 kAudioContentName, |
1006 TransportDescription(std::vector<std::string>(), kCandidateUfragVoice, | 1252 TransportDescription(std::vector<std::string>(), kUfragVoice, kPwdVoice, |
1007 kCandidatePwdVoice, cricket::ICEMODE_FULL, | 1253 cricket::ICEMODE_FULL, |
1008 cricket::CONNECTIONROLE_NONE, &fingerprint)))); | 1254 cricket::CONNECTIONROLE_NONE, &fingerprint)))); |
1009 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( | 1255 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
1010 kVideoContentName, | 1256 kVideoContentName, |
1011 TransportDescription(std::vector<std::string>(), kCandidateUfragVideo, | 1257 TransportDescription(std::vector<std::string>(), kUfragVideo, kPwdVideo, |
1012 kCandidatePwdVideo, cricket::ICEMODE_FULL, | 1258 cricket::ICEMODE_FULL, |
1013 cricket::CONNECTIONROLE_NONE, &fingerprint)))); | 1259 cricket::CONNECTIONROLE_NONE, &fingerprint)))); |
1014 } | 1260 } |
1015 | 1261 |
1016 void AddExtmap() { | 1262 void AddExtmap() { |
1017 audio_desc_ = static_cast<AudioContentDescription*>( | 1263 audio_desc_ = static_cast<AudioContentDescription*>( |
1018 audio_desc_->Copy()); | 1264 audio_desc_->Copy()); |
1019 video_desc_ = static_cast<VideoContentDescription*>( | 1265 video_desc_ = static_cast<VideoContentDescription*>( |
1020 video_desc_->Copy()); | 1266 video_desc_->Copy()); |
1021 audio_desc_->AddRtpHeaderExtension( | 1267 audio_desc_->AddRtpHeaderExtension( |
1022 RtpHeaderExtension(kExtmapUri, kExtmapId)); | 1268 RtpHeaderExtension(kExtmapUri, kExtmapId)); |
(...skipping 30 matching lines...) Expand all Loading... | |
1053 audio_desc_ = static_cast<AudioContentDescription*>( | 1299 audio_desc_ = static_cast<AudioContentDescription*>( |
1054 audio_desc_->Copy()); | 1300 audio_desc_->Copy()); |
1055 video_desc_ = static_cast<VideoContentDescription*>( | 1301 video_desc_ = static_cast<VideoContentDescription*>( |
1056 video_desc_->Copy()); | 1302 video_desc_->Copy()); |
1057 desc_.RemoveContentByName(kAudioContentName); | 1303 desc_.RemoveContentByName(kAudioContentName); |
1058 desc_.RemoveContentByName(kVideoContentName); | 1304 desc_.RemoveContentByName(kVideoContentName); |
1059 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_rejected, | 1305 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_rejected, |
1060 audio_desc_); | 1306 audio_desc_); |
1061 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_rejected, | 1307 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_rejected, |
1062 video_desc_); | 1308 video_desc_); |
1063 SetIceUfragPwd(kAudioContentName, | 1309 SetIceUfragPwd(kAudioContentName, audio_rejected ? "" : kUfragVoice, |
1064 audio_rejected ? "" : kCandidateUfragVoice, | 1310 audio_rejected ? "" : kPwdVoice); |
1065 audio_rejected ? "" : kCandidatePwdVoice); | 1311 SetIceUfragPwd(kVideoContentName, video_rejected ? "" : kUfragVideo, |
1066 SetIceUfragPwd(kVideoContentName, | 1312 video_rejected ? "" : kPwdVideo); |
1067 video_rejected ? "" : kCandidateUfragVideo, | |
1068 video_rejected ? "" : kCandidatePwdVideo); | |
1069 | 1313 |
1070 std::string new_sdp = kSdpString; | 1314 std::string new_sdp = kSdpString; |
1071 ReplaceRejected(audio_rejected, video_rejected, &new_sdp); | 1315 ReplaceRejected(audio_rejected, video_rejected, &new_sdp); |
1072 | 1316 |
1073 JsepSessionDescription jdesc_no_candidates(kDummyString); | 1317 JsepSessionDescription jdesc_no_candidates(kDummyString); |
1074 if (!jdesc_no_candidates.Initialize(desc_.Copy(), kSessionId, | 1318 if (!jdesc_no_candidates.Initialize(desc_.Copy(), kSessionId, |
1075 kSessionVersion)) { | 1319 kSessionVersion)) { |
1076 return false; | 1320 return false; |
1077 } | 1321 } |
1078 std::string message = webrtc::SdpSerialize(jdesc_no_candidates); | 1322 std::string message = webrtc::SdpSerialize(jdesc_no_candidates); |
1079 EXPECT_EQ(new_sdp, message); | 1323 EXPECT_EQ(new_sdp, message); |
1080 return true; | 1324 return true; |
1081 } | 1325 } |
1082 | 1326 |
1083 void AddSctpDataChannel() { | 1327 void AddSctpDataChannel() { |
1084 rtc::scoped_ptr<DataContentDescription> data( | 1328 rtc::scoped_ptr<DataContentDescription> data( |
1085 new DataContentDescription()); | 1329 new DataContentDescription()); |
1086 data_desc_ = data.get(); | 1330 data_desc_ = data.get(); |
1087 data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp); | 1331 data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp); |
1088 DataCodec codec(cricket::kGoogleSctpDataCodecId, | 1332 DataCodec codec(cricket::kGoogleSctpDataCodecId, |
1089 cricket::kGoogleSctpDataCodecName, 0); | 1333 cricket::kGoogleSctpDataCodecName, 0); |
1090 codec.SetParam(cricket::kCodecParamPort, kDefaultSctpPort); | 1334 codec.SetParam(cricket::kCodecParamPort, kDefaultSctpPort); |
1091 data_desc_->AddCodec(codec); | 1335 data_desc_->AddCodec(codec); |
1092 desc_.AddContent(kDataContentName, NS_JINGLE_DRAFT_SCTP, data.release()); | 1336 desc_.AddContent(kDataContentName, NS_JINGLE_DRAFT_SCTP, data.release()); |
1093 EXPECT_TRUE(desc_.AddTransportInfo( | 1337 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
1094 TransportInfo(kDataContentName, | 1338 kDataContentName, TransportDescription(kUfragData, kPwdData)))); |
1095 TransportDescription(kCandidateUfragData, | |
1096 kCandidatePwdData)))); | |
1097 } | 1339 } |
1098 | 1340 |
1099 void AddRtpDataChannel() { | 1341 void AddRtpDataChannel() { |
1100 rtc::scoped_ptr<DataContentDescription> data( | 1342 rtc::scoped_ptr<DataContentDescription> data( |
1101 new DataContentDescription()); | 1343 new DataContentDescription()); |
1102 data_desc_ = data.get(); | 1344 data_desc_ = data.get(); |
1103 | 1345 |
1104 data_desc_->AddCodec(DataCodec(101, "google-data", 1)); | 1346 data_desc_->AddCodec(DataCodec(101, "google-data", 1)); |
1105 StreamParams data_stream; | 1347 StreamParams data_stream; |
1106 data_stream.id = kDataChannelMsid; | 1348 data_stream.id = kDataChannelMsid; |
1107 data_stream.cname = kDataChannelCname; | 1349 data_stream.cname = kDataChannelCname; |
1108 data_stream.sync_label = kDataChannelLabel; | 1350 data_stream.sync_label = kDataChannelLabel; |
1109 data_stream.ssrcs.push_back(kDataChannelSsrc); | 1351 data_stream.ssrcs.push_back(kDataChannelSsrc); |
1110 data_desc_->AddStream(data_stream); | 1352 data_desc_->AddStream(data_stream); |
1111 data_desc_->AddCrypto(CryptoParams( | 1353 data_desc_->AddCrypto(CryptoParams( |
1112 1, "AES_CM_128_HMAC_SHA1_80", | 1354 1, "AES_CM_128_HMAC_SHA1_80", |
1113 "inline:FvLcvU2P3ZWmQxgPAgcDu7Zl9vftYElFOjEzhWs5", "")); | 1355 "inline:FvLcvU2P3ZWmQxgPAgcDu7Zl9vftYElFOjEzhWs5", "")); |
1114 data_desc_->set_protocol(cricket::kMediaProtocolSavpf); | 1356 data_desc_->set_protocol(cricket::kMediaProtocolSavpf); |
1115 desc_.AddContent(kDataContentName, NS_JINGLE_RTP, data.release()); | 1357 desc_.AddContent(kDataContentName, NS_JINGLE_RTP, data.release()); |
1116 EXPECT_TRUE(desc_.AddTransportInfo( | 1358 EXPECT_TRUE(desc_.AddTransportInfo(TransportInfo( |
1117 TransportInfo(kDataContentName, | 1359 kDataContentName, TransportDescription(kUfragData, kPwdData)))); |
1118 TransportDescription(kCandidateUfragData, | |
1119 kCandidatePwdData)))); | |
1120 } | 1360 } |
1121 | 1361 |
1122 bool TestDeserializeDirection(cricket::MediaContentDirection direction) { | 1362 bool TestDeserializeDirection(cricket::MediaContentDirection direction) { |
1123 std::string new_sdp = kSdpFullString; | 1363 std::string new_sdp = kSdpFullString; |
1124 ReplaceDirection(direction, &new_sdp); | 1364 ReplaceDirection(direction, &new_sdp); |
1125 JsepSessionDescription new_jdesc(kDummyString); | 1365 JsepSessionDescription new_jdesc(kDummyString); |
1126 | 1366 |
1127 EXPECT_TRUE(SdpDeserialize(new_sdp, &new_jdesc)); | 1367 EXPECT_TRUE(SdpDeserialize(new_sdp, &new_jdesc)); |
1128 | 1368 |
1129 audio_desc_->set_direction(direction); | 1369 audio_desc_->set_direction(direction); |
(...skipping 16 matching lines...) Expand all Loading... | |
1146 audio_desc_ = static_cast<AudioContentDescription*>( | 1386 audio_desc_ = static_cast<AudioContentDescription*>( |
1147 audio_desc_->Copy()); | 1387 audio_desc_->Copy()); |
1148 video_desc_ = static_cast<VideoContentDescription*>( | 1388 video_desc_ = static_cast<VideoContentDescription*>( |
1149 video_desc_->Copy()); | 1389 video_desc_->Copy()); |
1150 desc_.RemoveContentByName(kAudioContentName); | 1390 desc_.RemoveContentByName(kAudioContentName); |
1151 desc_.RemoveContentByName(kVideoContentName); | 1391 desc_.RemoveContentByName(kVideoContentName); |
1152 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_rejected, | 1392 desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_rejected, |
1153 audio_desc_); | 1393 audio_desc_); |
1154 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_rejected, | 1394 desc_.AddContent(kVideoContentName, NS_JINGLE_RTP, video_rejected, |
1155 video_desc_); | 1395 video_desc_); |
1156 SetIceUfragPwd(kAudioContentName, | 1396 SetIceUfragPwd(kAudioContentName, audio_rejected ? "" : kUfragVoice, |
1157 audio_rejected ? "" : kCandidateUfragVoice, | 1397 audio_rejected ? "" : kPwdVoice); |
1158 audio_rejected ? "" : kCandidatePwdVoice); | 1398 SetIceUfragPwd(kVideoContentName, video_rejected ? "" : kUfragVideo, |
1159 SetIceUfragPwd(kVideoContentName, | 1399 video_rejected ? "" : kPwdVideo); |
1160 video_rejected ? "" : kCandidateUfragVideo, | |
1161 video_rejected ? "" : kCandidatePwdVideo); | |
1162 JsepSessionDescription jdesc_no_candidates(kDummyString); | 1400 JsepSessionDescription jdesc_no_candidates(kDummyString); |
1163 if (!jdesc_no_candidates.Initialize(desc_.Copy(), jdesc_.session_id(), | 1401 if (!jdesc_no_candidates.Initialize(desc_.Copy(), jdesc_.session_id(), |
1164 jdesc_.session_version())) { | 1402 jdesc_.session_version())) { |
1165 return false; | 1403 return false; |
1166 } | 1404 } |
1167 EXPECT_TRUE(CompareSessionDescription(jdesc_no_candidates, new_jdesc)); | 1405 EXPECT_TRUE(CompareSessionDescription(jdesc_no_candidates, new_jdesc)); |
1168 return true; | 1406 return true; |
1169 } | 1407 } |
1170 | 1408 |
1171 void TestDeserializeExtmap(bool session_level, bool media_level) { | 1409 void TestDeserializeExtmap(bool session_level, bool media_level) { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1350 cricket::FeedbackParam(cricket::kRtcpFbParamCcm, | 1588 cricket::FeedbackParam(cricket::kRtcpFbParamCcm, |
1351 cricket::kRtcpFbCcmParamFir))); | 1589 cricket::kRtcpFbCcmParamFir))); |
1352 } | 1590 } |
1353 | 1591 |
1354 // Two SDP messages can mean the same thing but be different strings, e.g. | 1592 // Two SDP messages can mean the same thing but be different strings, e.g. |
1355 // some of the lines can be serialized in different order. | 1593 // some of the lines can be serialized in different order. |
1356 // However, a deserialized description can be compared field by field and has | 1594 // However, a deserialized description can be compared field by field and has |
1357 // no order. If deserializer has already been tested, serializing then | 1595 // no order. If deserializer has already been tested, serializing then |
1358 // deserializing and comparing JsepSessionDescription will test | 1596 // deserializing and comparing JsepSessionDescription will test |
1359 // the serializer sufficiently. | 1597 // the serializer sufficiently. |
1360 void TestSerialize(const JsepSessionDescription& jdesc) { | 1598 void TestSerialize(const JsepSessionDescription& jdesc, |
1361 std::string message = webrtc::SdpSerialize(jdesc); | 1599 bool unified_plan_sdp) { |
1600 std::string message = webrtc::SdpSerialize(jdesc, unified_plan_sdp); | |
1362 JsepSessionDescription jdesc_output_des(kDummyString); | 1601 JsepSessionDescription jdesc_output_des(kDummyString); |
1363 SdpParseError error; | 1602 SdpParseError error; |
1364 EXPECT_TRUE(webrtc::SdpDeserialize(message, &jdesc_output_des, &error)); | 1603 EXPECT_TRUE(webrtc::SdpDeserialize(message, &jdesc_output_des, &error)); |
1365 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output_des)); | 1604 EXPECT_TRUE(CompareSessionDescription(jdesc, jdesc_output_des)); |
1366 } | 1605 } |
1367 | 1606 |
1368 protected: | 1607 protected: |
1369 SessionDescription desc_; | 1608 SessionDescription desc_; |
1370 AudioContentDescription* audio_desc_; | 1609 AudioContentDescription* audio_desc_; |
1371 VideoContentDescription* video_desc_; | 1610 VideoContentDescription* video_desc_; |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2322 TestDeserializeExtmap(true, true); | 2561 TestDeserializeExtmap(true, true); |
2323 } | 2562 } |
2324 | 2563 |
2325 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutEndLineBreak) { | 2564 TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutEndLineBreak) { |
2326 JsepSessionDescription jdesc(kDummyString); | 2565 JsepSessionDescription jdesc(kDummyString); |
2327 std::string sdp = kSdpFullString; | 2566 std::string sdp = kSdpFullString; |
2328 sdp = sdp.substr(0, sdp.size() - 2); // Remove \r\n at the end. | 2567 sdp = sdp.substr(0, sdp.size() - 2); // Remove \r\n at the end. |
2329 // Deserialize | 2568 // Deserialize |
2330 SdpParseError error; | 2569 SdpParseError error; |
2331 EXPECT_FALSE(webrtc::SdpDeserialize(sdp, &jdesc, &error)); | 2570 EXPECT_FALSE(webrtc::SdpDeserialize(sdp, &jdesc, &error)); |
2332 const std::string lastline = "a=ssrc:6 label:video_track_id_3"; | 2571 const std::string lastline = "a=ssrc:3 label:video_track_id_1"; |
2333 EXPECT_EQ(lastline, error.line); | 2572 EXPECT_EQ(lastline, error.line); |
2334 EXPECT_EQ("Invalid SDP line.", error.description); | 2573 EXPECT_EQ("Invalid SDP line.", error.description); |
2335 } | 2574 } |
2336 | 2575 |
2337 TEST_F(WebRtcSdpTest, DeserializeCandidateWithDifferentTransport) { | 2576 TEST_F(WebRtcSdpTest, DeserializeCandidateWithDifferentTransport) { |
2338 JsepIceCandidate jcandidate(kDummyMid, kDummyIndex); | 2577 JsepIceCandidate jcandidate(kDummyMid, kDummyIndex); |
2339 std::string new_sdp = kSdpOneCandidate; | 2578 std::string new_sdp = kSdpOneCandidate; |
2340 Replace("udp", "unsupported_transport", &new_sdp); | 2579 Replace("udp", "unsupported_transport", &new_sdp); |
2341 EXPECT_FALSE(SdpDeserializeCandidate(new_sdp, &jcandidate)); | 2580 EXPECT_FALSE(SdpDeserializeCandidate(new_sdp, &jcandidate)); |
2342 new_sdp = kSdpOneCandidate; | 2581 new_sdp = kSdpOneCandidate; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2422 ExpectParseFailure("a=sendrecv", kSdpMd5); | 2661 ExpectParseFailure("a=sendrecv", kSdpMd5); |
2423 | 2662 |
2424 // Empty Line | 2663 // Empty Line |
2425 ExpectParseFailure("a=rtcp:2347 IN IP4 74.125.127.126", kSdpEmptyLine); | 2664 ExpectParseFailure("a=rtcp:2347 IN IP4 74.125.127.126", kSdpEmptyLine); |
2426 ExpectParseFailure("a=rtcp:2347 IN IP4 74.125.127.126", kSdpMissingValue); | 2665 ExpectParseFailure("a=rtcp:2347 IN IP4 74.125.127.126", kSdpMissingValue); |
2427 } | 2666 } |
2428 | 2667 |
2429 TEST_F(WebRtcSdpTest, DeserializeSdpWithInvalidAttributeValue) { | 2668 TEST_F(WebRtcSdpTest, DeserializeSdpWithInvalidAttributeValue) { |
2430 // ssrc | 2669 // ssrc |
2431 ExpectParseFailure("a=ssrc:1", "a=ssrc:badvalue"); | 2670 ExpectParseFailure("a=ssrc:1", "a=ssrc:badvalue"); |
2432 ExpectParseFailure("a=ssrc-group:FEC 5 6", "a=ssrc-group:FEC badvalue 6"); | 2671 ExpectParseFailure("a=ssrc-group:FEC 2 3", "a=ssrc-group:FEC badvalue 3"); |
2433 // crypto | 2672 // crypto |
2434 ExpectParseFailure("a=crypto:1 ", "a=crypto:badvalue "); | 2673 ExpectParseFailure("a=crypto:1 ", "a=crypto:badvalue "); |
2435 // rtpmap | 2674 // rtpmap |
2436 ExpectParseFailure("a=rtpmap:111 ", "a=rtpmap:badvalue "); | 2675 ExpectParseFailure("a=rtpmap:111 ", "a=rtpmap:badvalue "); |
2437 ExpectParseFailure("opus/48000/2", "opus/badvalue/2"); | 2676 ExpectParseFailure("opus/48000/2", "opus/badvalue/2"); |
2438 ExpectParseFailure("opus/48000/2", "opus/48000/badvalue"); | 2677 ExpectParseFailure("opus/48000/2", "opus/48000/badvalue"); |
2439 // candidate | 2678 // candidate |
2440 ExpectParseFailure("1 udp 2130706432", "badvalue udp 2130706432"); | 2679 ExpectParseFailure("1 udp 2130706432", "badvalue udp 2130706432"); |
2441 ExpectParseFailure("1 udp 2130706432", "1 udp badvalue"); | 2680 ExpectParseFailure("1 udp 2130706432", "1 udp badvalue"); |
2442 ExpectParseFailure("192.168.1.5 1234", "192.168.1.5 badvalue"); | 2681 ExpectParseFailure("192.168.1.5 1234", "192.168.1.5 badvalue"); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2492 JsepSessionDescription jdesc_output(kDummyString); | 2731 JsepSessionDescription jdesc_output(kDummyString); |
2493 CodecParams params; | 2732 CodecParams params; |
2494 params.max_ptime = 40; | 2733 params.max_ptime = 40; |
2495 params.ptime = 30; | 2734 params.ptime = 30; |
2496 params.min_ptime = 10; | 2735 params.min_ptime = 10; |
2497 params.sprop_stereo = 1; | 2736 params.sprop_stereo = 1; |
2498 params.stereo = 1; | 2737 params.stereo = 1; |
2499 params.useinband = 1; | 2738 params.useinband = 1; |
2500 params.maxaveragebitrate = 128000; | 2739 params.maxaveragebitrate = 128000; |
2501 TestDeserializeCodecParams(params, &jdesc_output); | 2740 TestDeserializeCodecParams(params, &jdesc_output); |
2502 TestSerialize(jdesc_output); | 2741 TestSerialize(jdesc_output, false); |
2503 } | 2742 } |
2504 | 2743 |
2505 TEST_F(WebRtcSdpTest, DeserializeSerializeRtcpFb) { | 2744 TEST_F(WebRtcSdpTest, DeserializeSerializeRtcpFb) { |
2506 const bool kUseWildcard = false; | 2745 const bool kUseWildcard = false; |
2507 JsepSessionDescription jdesc_output(kDummyString); | 2746 JsepSessionDescription jdesc_output(kDummyString); |
2508 TestDeserializeRtcpFb(&jdesc_output, kUseWildcard); | 2747 TestDeserializeRtcpFb(&jdesc_output, kUseWildcard); |
2509 TestSerialize(jdesc_output); | 2748 TestSerialize(jdesc_output, false); |
2510 } | 2749 } |
2511 | 2750 |
2512 TEST_F(WebRtcSdpTest, DeserializeSerializeRtcpFbWildcard) { | 2751 TEST_F(WebRtcSdpTest, DeserializeSerializeRtcpFbWildcard) { |
2513 const bool kUseWildcard = true; | 2752 const bool kUseWildcard = true; |
2514 JsepSessionDescription jdesc_output(kDummyString); | 2753 JsepSessionDescription jdesc_output(kDummyString); |
2515 TestDeserializeRtcpFb(&jdesc_output, kUseWildcard); | 2754 TestDeserializeRtcpFb(&jdesc_output, kUseWildcard); |
2516 TestSerialize(jdesc_output); | 2755 TestSerialize(jdesc_output, false); |
2517 } | 2756 } |
2518 | 2757 |
2519 TEST_F(WebRtcSdpTest, DeserializeVideoFmtp) { | 2758 TEST_F(WebRtcSdpTest, DeserializeVideoFmtp) { |
2520 JsepSessionDescription jdesc_output(kDummyString); | 2759 JsepSessionDescription jdesc_output(kDummyString); |
2521 | 2760 |
2522 const char kSdpWithFmtpString[] = | 2761 const char kSdpWithFmtpString[] = |
2523 "v=0\r\n" | 2762 "v=0\r\n" |
2524 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" | 2763 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" |
2525 "s=-\r\n" | 2764 "s=-\r\n" |
2526 "t=0 0\r\n" | 2765 "t=0 0\r\n" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2732 const cricket::MediaContentDescription* mdesc = | 2971 const cricket::MediaContentDescription* mdesc = |
2733 static_cast<const cricket::MediaContentDescription*>( | 2972 static_cast<const cricket::MediaContentDescription*>( |
2734 desc->contents()[i].description); | 2973 desc->contents()[i].description); |
2735 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); | 2974 EXPECT_EQ(media_types[media_content_in_sdp[i]], mdesc->type()); |
2736 } | 2975 } |
2737 | 2976 |
2738 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); | 2977 std::string serialized_sdp = webrtc::SdpSerialize(jdesc); |
2739 EXPECT_EQ(sdp_string, serialized_sdp); | 2978 EXPECT_EQ(sdp_string, serialized_sdp); |
2740 } | 2979 } |
2741 } | 2980 } |
2981 | |
2982 TEST_F(WebRtcSdpTest, DeserializePlanBSessionDescription) { | |
2983 MakePlanBDescription(); | |
2984 | |
2985 JsepSessionDescription deserialized_description(kDummyString); | |
2986 EXPECT_TRUE(SdpDeserialize(kPlanBSdpFullString, &deserialized_description)); | |
2987 | |
2988 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description)); | |
2989 } | |
2990 | |
2991 TEST_F(WebRtcSdpTest, SerializePlanBSessionDescription) { | |
2992 MakePlanBDescription(); | |
2993 TestSerialize(jdesc_, false); | |
2994 } | |
2995 | |
2996 TEST_F(WebRtcSdpTest, DeserializeUnifiedPlanSessionDescription) { | |
2997 MakeUnifiedPlanDescription(); | |
2998 | |
2999 JsepSessionDescription deserialized_description(kDummyString); | |
3000 EXPECT_TRUE( | |
3001 SdpDeserialize(kUnifiedPlanSdpFullString, &deserialized_description)); | |
3002 | |
3003 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description)); | |
3004 } | |
3005 | |
3006 TEST_F(WebRtcSdpTest, SerializeUnifiedPlanSessionDescription) { | |
3007 MakeUnifiedPlanDescription(); | |
3008 TestSerialize(jdesc_, true); | |
3009 } | |
OLD | NEW |