OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 static const char kRecvonly[] = "recvonly"; | 65 static const char kRecvonly[] = "recvonly"; |
66 static const char kSendrecv[] = "sendrecv"; | 66 static const char kSendrecv[] = "sendrecv"; |
67 | 67 |
68 // Reference SDP with a MediaStream with label "stream1" and audio track with | 68 // Reference SDP with a MediaStream with label "stream1" and audio track with |
69 // id "audio_1" and a video track with id "video_1; | 69 // id "audio_1" and a video track with id "video_1; |
70 static const char kSdpStringWithStream1[] = | 70 static const char kSdpStringWithStream1[] = |
71 "v=0\r\n" | 71 "v=0\r\n" |
72 "o=- 0 0 IN IP4 127.0.0.1\r\n" | 72 "o=- 0 0 IN IP4 127.0.0.1\r\n" |
73 "s=-\r\n" | 73 "s=-\r\n" |
74 "t=0 0\r\n" | 74 "t=0 0\r\n" |
| 75 "m=audio 1 RTP/AVPF 103\r\n" |
75 "a=ice-ufrag:e5785931\r\n" | 76 "a=ice-ufrag:e5785931\r\n" |
76 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" | 77 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
77 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" | 78 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
78 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" | 79 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
79 "m=audio 1 RTP/AVPF 103\r\n" | |
80 "a=mid:audio\r\n" | 80 "a=mid:audio\r\n" |
81 "a=sendrecv\r\n" | 81 "a=sendrecv\r\n" |
82 "a=rtcp-mux\r\n" | 82 "a=rtcp-mux\r\n" |
83 "a=rtpmap:103 ISAC/16000\r\n" | 83 "a=rtpmap:103 ISAC/16000\r\n" |
84 "a=ssrc:1 cname:stream1\r\n" | 84 "a=ssrc:1 cname:stream1\r\n" |
85 "a=ssrc:1 mslabel:stream1\r\n" | 85 "a=ssrc:1 mslabel:stream1\r\n" |
86 "a=ssrc:1 label:audiotrack0\r\n" | 86 "a=ssrc:1 label:audiotrack0\r\n" |
87 "m=video 1 RTP/AVPF 120\r\n" | 87 "m=video 1 RTP/AVPF 120\r\n" |
| 88 "a=ice-ufrag:e5785931\r\n" |
| 89 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
| 90 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
| 91 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
88 "a=mid:video\r\n" | 92 "a=mid:video\r\n" |
89 "a=sendrecv\r\n" | 93 "a=sendrecv\r\n" |
90 "a=rtcp-mux\r\n" | 94 "a=rtcp-mux\r\n" |
91 "a=rtpmap:120 VP8/90000\r\n" | 95 "a=rtpmap:120 VP8/90000\r\n" |
92 "a=ssrc:2 cname:stream1\r\n" | 96 "a=ssrc:2 cname:stream1\r\n" |
93 "a=ssrc:2 mslabel:stream1\r\n" | 97 "a=ssrc:2 mslabel:stream1\r\n" |
94 "a=ssrc:2 label:videotrack0\r\n"; | 98 "a=ssrc:2 label:videotrack0\r\n"; |
95 | 99 |
96 // Reference SDP with a MediaStream with label "stream1" and audio track with | 100 // Reference SDP with a MediaStream with label "stream1" and audio track with |
97 // id "audio_1"; | 101 // id "audio_1"; |
98 static const char kSdpStringWithStream1AudioTrackOnly[] = | 102 static const char kSdpStringWithStream1AudioTrackOnly[] = |
99 "v=0\r\n" | 103 "v=0\r\n" |
100 "o=- 0 0 IN IP4 127.0.0.1\r\n" | 104 "o=- 0 0 IN IP4 127.0.0.1\r\n" |
101 "s=-\r\n" | 105 "s=-\r\n" |
102 "t=0 0\r\n" | 106 "t=0 0\r\n" |
| 107 "m=audio 1 RTP/AVPF 103\r\n" |
103 "a=ice-ufrag:e5785931\r\n" | 108 "a=ice-ufrag:e5785931\r\n" |
104 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" | 109 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
105 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" | 110 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
106 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" | 111 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
107 "m=audio 1 RTP/AVPF 103\r\n" | |
108 "a=mid:audio\r\n" | 112 "a=mid:audio\r\n" |
109 "a=sendrecv\r\n" | 113 "a=sendrecv\r\n" |
110 "a=rtpmap:103 ISAC/16000\r\n" | 114 "a=rtpmap:103 ISAC/16000\r\n" |
111 "a=ssrc:1 cname:stream1\r\n" | 115 "a=ssrc:1 cname:stream1\r\n" |
112 "a=ssrc:1 mslabel:stream1\r\n" | 116 "a=ssrc:1 mslabel:stream1\r\n" |
113 "a=ssrc:1 label:audiotrack0\r\n" | 117 "a=ssrc:1 label:audiotrack0\r\n" |
114 "a=rtcp-mux\r\n"; | 118 "a=rtcp-mux\r\n"; |
115 | 119 |
116 // Reference SDP with two MediaStreams with label "stream1" and "stream2. Each | 120 // Reference SDP with two MediaStreams with label "stream1" and "stream2. Each |
117 // MediaStreams have one audio track and one video track. | 121 // MediaStreams have one audio track and one video track. |
118 // This uses MSID. | 122 // This uses MSID. |
119 static const char kSdpStringWithStream1And2[] = | 123 static const char kSdpStringWithStream1And2[] = |
120 "v=0\r\n" | 124 "v=0\r\n" |
121 "o=- 0 0 IN IP4 127.0.0.1\r\n" | 125 "o=- 0 0 IN IP4 127.0.0.1\r\n" |
122 "s=-\r\n" | 126 "s=-\r\n" |
123 "t=0 0\r\n" | 127 "t=0 0\r\n" |
| 128 "a=msid-semantic: WMS stream1 stream2\r\n" |
| 129 "m=audio 1 RTP/AVPF 103\r\n" |
124 "a=ice-ufrag:e5785931\r\n" | 130 "a=ice-ufrag:e5785931\r\n" |
125 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" | 131 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
126 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" | 132 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
127 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" | 133 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
128 "a=msid-semantic: WMS stream1 stream2\r\n" | |
129 "m=audio 1 RTP/AVPF 103\r\n" | |
130 "a=mid:audio\r\n" | 134 "a=mid:audio\r\n" |
131 "a=sendrecv\r\n" | 135 "a=sendrecv\r\n" |
132 "a=rtcp-mux\r\n" | 136 "a=rtcp-mux\r\n" |
133 "a=rtpmap:103 ISAC/16000\r\n" | 137 "a=rtpmap:103 ISAC/16000\r\n" |
134 "a=ssrc:1 cname:stream1\r\n" | 138 "a=ssrc:1 cname:stream1\r\n" |
135 "a=ssrc:1 msid:stream1 audiotrack0\r\n" | 139 "a=ssrc:1 msid:stream1 audiotrack0\r\n" |
136 "a=ssrc:3 cname:stream2\r\n" | 140 "a=ssrc:3 cname:stream2\r\n" |
137 "a=ssrc:3 msid:stream2 audiotrack1\r\n" | 141 "a=ssrc:3 msid:stream2 audiotrack1\r\n" |
138 "m=video 1 RTP/AVPF 120\r\n" | 142 "m=video 1 RTP/AVPF 120\r\n" |
| 143 "a=ice-ufrag:e5785931\r\n" |
| 144 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
| 145 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
| 146 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
139 "a=mid:video\r\n" | 147 "a=mid:video\r\n" |
140 "a=sendrecv\r\n" | 148 "a=sendrecv\r\n" |
141 "a=rtcp-mux\r\n" | 149 "a=rtcp-mux\r\n" |
142 "a=rtpmap:120 VP8/0\r\n" | 150 "a=rtpmap:120 VP8/0\r\n" |
143 "a=ssrc:2 cname:stream1\r\n" | 151 "a=ssrc:2 cname:stream1\r\n" |
144 "a=ssrc:2 msid:stream1 videotrack0\r\n" | 152 "a=ssrc:2 msid:stream1 videotrack0\r\n" |
145 "a=ssrc:4 cname:stream2\r\n" | 153 "a=ssrc:4 cname:stream2\r\n" |
146 "a=ssrc:4 msid:stream2 videotrack1\r\n"; | 154 "a=ssrc:4 msid:stream2 videotrack1\r\n"; |
147 | 155 |
148 // Reference SDP without MediaStreams. Msid is not supported. | 156 // Reference SDP without MediaStreams. Msid is not supported. |
149 static const char kSdpStringWithoutStreams[] = | 157 static const char kSdpStringWithoutStreams[] = |
150 "v=0\r\n" | 158 "v=0\r\n" |
151 "o=- 0 0 IN IP4 127.0.0.1\r\n" | 159 "o=- 0 0 IN IP4 127.0.0.1\r\n" |
152 "s=-\r\n" | 160 "s=-\r\n" |
153 "t=0 0\r\n" | 161 "t=0 0\r\n" |
| 162 "m=audio 1 RTP/AVPF 103\r\n" |
154 "a=ice-ufrag:e5785931\r\n" | 163 "a=ice-ufrag:e5785931\r\n" |
155 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" | 164 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
156 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" | 165 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
157 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" | 166 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
158 "m=audio 1 RTP/AVPF 103\r\n" | |
159 "a=mid:audio\r\n" | 167 "a=mid:audio\r\n" |
160 "a=sendrecv\r\n" | 168 "a=sendrecv\r\n" |
161 "a=rtcp-mux\r\n" | 169 "a=rtcp-mux\r\n" |
162 "a=rtpmap:103 ISAC/16000\r\n" | 170 "a=rtpmap:103 ISAC/16000\r\n" |
163 "m=video 1 RTP/AVPF 120\r\n" | 171 "m=video 1 RTP/AVPF 120\r\n" |
| 172 "a=ice-ufrag:e5785931\r\n" |
| 173 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
| 174 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
| 175 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
164 "a=mid:video\r\n" | 176 "a=mid:video\r\n" |
165 "a=sendrecv\r\n" | 177 "a=sendrecv\r\n" |
166 "a=rtcp-mux\r\n" | 178 "a=rtcp-mux\r\n" |
167 "a=rtpmap:120 VP8/90000\r\n"; | 179 "a=rtpmap:120 VP8/90000\r\n"; |
168 | 180 |
169 // Reference SDP without MediaStreams. Msid is supported. | 181 // Reference SDP without MediaStreams. Msid is supported. |
170 static const char kSdpStringWithMsidWithoutStreams[] = | 182 static const char kSdpStringWithMsidWithoutStreams[] = |
171 "v=0\r\n" | 183 "v=0\r\n" |
172 "o=- 0 0 IN IP4 127.0.0.1\r\n" | 184 "o=- 0 0 IN IP4 127.0.0.1\r\n" |
173 "s=-\r\n" | 185 "s=-\r\n" |
174 "t=0 0\r\n" | 186 "t=0 0\r\n" |
| 187 "a=msid-semantic: WMS\r\n" |
| 188 "m=audio 1 RTP/AVPF 103\r\n" |
175 "a=ice-ufrag:e5785931\r\n" | 189 "a=ice-ufrag:e5785931\r\n" |
176 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" | 190 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
177 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" | 191 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
178 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" | 192 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
179 "a=msid-semantic: WMS\r\n" | |
180 "m=audio 1 RTP/AVPF 103\r\n" | |
181 "a=mid:audio\r\n" | 193 "a=mid:audio\r\n" |
182 "a=sendrecv\r\n" | 194 "a=sendrecv\r\n" |
183 "a=rtcp-mux\r\n" | 195 "a=rtcp-mux\r\n" |
184 "a=rtpmap:103 ISAC/16000\r\n" | 196 "a=rtpmap:103 ISAC/16000\r\n" |
185 "m=video 1 RTP/AVPF 120\r\n" | 197 "m=video 1 RTP/AVPF 120\r\n" |
| 198 "a=ice-ufrag:e5785931\r\n" |
| 199 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
| 200 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
| 201 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
186 "a=mid:video\r\n" | 202 "a=mid:video\r\n" |
187 "a=sendrecv\r\n" | 203 "a=sendrecv\r\n" |
188 "a=rtcp-mux\r\n" | 204 "a=rtcp-mux\r\n" |
189 "a=rtpmap:120 VP8/90000\r\n"; | 205 "a=rtpmap:120 VP8/90000\r\n"; |
190 | 206 |
191 // Reference SDP without MediaStreams and audio only. | 207 // Reference SDP without MediaStreams and audio only. |
192 static const char kSdpStringWithoutStreamsAudioOnly[] = | 208 static const char kSdpStringWithoutStreamsAudioOnly[] = |
193 "v=0\r\n" | 209 "v=0\r\n" |
194 "o=- 0 0 IN IP4 127.0.0.1\r\n" | 210 "o=- 0 0 IN IP4 127.0.0.1\r\n" |
195 "s=-\r\n" | 211 "s=-\r\n" |
196 "t=0 0\r\n" | 212 "t=0 0\r\n" |
| 213 "m=audio 1 RTP/AVPF 103\r\n" |
197 "a=ice-ufrag:e5785931\r\n" | 214 "a=ice-ufrag:e5785931\r\n" |
198 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" | 215 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
199 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" | 216 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
200 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" | 217 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
201 "m=audio 1 RTP/AVPF 103\r\n" | |
202 "a=mid:audio\r\n" | 218 "a=mid:audio\r\n" |
203 "a=sendrecv\r\n" | 219 "a=sendrecv\r\n" |
204 "a=rtcp-mux\r\n" | 220 "a=rtcp-mux\r\n" |
205 "a=rtpmap:103 ISAC/16000\r\n"; | 221 "a=rtpmap:103 ISAC/16000\r\n"; |
206 | 222 |
207 // Reference SENDONLY SDP without MediaStreams. Msid is not supported. | 223 // Reference SENDONLY SDP without MediaStreams. Msid is not supported. |
208 static const char kSdpStringSendOnlyWithoutStreams[] = | 224 static const char kSdpStringSendOnlyWithoutStreams[] = |
209 "v=0\r\n" | 225 "v=0\r\n" |
210 "o=- 0 0 IN IP4 127.0.0.1\r\n" | 226 "o=- 0 0 IN IP4 127.0.0.1\r\n" |
211 "s=-\r\n" | 227 "s=-\r\n" |
212 "t=0 0\r\n" | 228 "t=0 0\r\n" |
| 229 "m=audio 1 RTP/AVPF 103\r\n" |
213 "a=ice-ufrag:e5785931\r\n" | 230 "a=ice-ufrag:e5785931\r\n" |
214 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" | 231 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
215 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" | 232 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
216 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" | 233 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
217 "m=audio 1 RTP/AVPF 103\r\n" | |
218 "a=mid:audio\r\n" | 234 "a=mid:audio\r\n" |
219 "a=sendrecv\r\n" | 235 "a=sendrecv\r\n" |
220 "a=sendonly\r\n" | 236 "a=sendonly\r\n" |
221 "a=rtcp-mux\r\n" | 237 "a=rtcp-mux\r\n" |
222 "a=rtpmap:103 ISAC/16000\r\n" | 238 "a=rtpmap:103 ISAC/16000\r\n" |
223 "m=video 1 RTP/AVPF 120\r\n" | 239 "m=video 1 RTP/AVPF 120\r\n" |
| 240 "a=ice-ufrag:e5785931\r\n" |
| 241 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
| 242 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
| 243 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
224 "a=mid:video\r\n" | 244 "a=mid:video\r\n" |
225 "a=sendrecv\r\n" | 245 "a=sendrecv\r\n" |
226 "a=sendonly\r\n" | 246 "a=sendonly\r\n" |
227 "a=rtcp-mux\r\n" | 247 "a=rtcp-mux\r\n" |
228 "a=rtpmap:120 VP8/90000\r\n"; | 248 "a=rtpmap:120 VP8/90000\r\n"; |
229 | 249 |
230 static const char kSdpStringInit[] = | 250 static const char kSdpStringInit[] = |
231 "v=0\r\n" | 251 "v=0\r\n" |
232 "o=- 0 0 IN IP4 127.0.0.1\r\n" | 252 "o=- 0 0 IN IP4 127.0.0.1\r\n" |
233 "s=-\r\n" | 253 "s=-\r\n" |
234 "t=0 0\r\n" | 254 "t=0 0\r\n" |
| 255 "a=msid-semantic: WMS\r\n"; |
| 256 |
| 257 static const char kSdpStringAudio[] = |
| 258 "m=audio 1 RTP/AVPF 103\r\n" |
235 "a=ice-ufrag:e5785931\r\n" | 259 "a=ice-ufrag:e5785931\r\n" |
236 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" | 260 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
237 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" | 261 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
238 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" | 262 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
239 "a=msid-semantic: WMS\r\n"; | |
240 | |
241 static const char kSdpStringAudio[] = | |
242 "m=audio 1 RTP/AVPF 103\r\n" | |
243 "a=mid:audio\r\n" | 263 "a=mid:audio\r\n" |
244 "a=sendrecv\r\n" | 264 "a=sendrecv\r\n" |
245 "a=rtcp-mux\r\n" | 265 "a=rtcp-mux\r\n" |
246 "a=rtpmap:103 ISAC/16000\r\n"; | 266 "a=rtpmap:103 ISAC/16000\r\n"; |
247 | 267 |
248 static const char kSdpStringVideo[] = | 268 static const char kSdpStringVideo[] = |
249 "m=video 1 RTP/AVPF 120\r\n" | 269 "m=video 1 RTP/AVPF 120\r\n" |
| 270 "a=ice-ufrag:e5785931\r\n" |
| 271 "a=ice-pwd:36fb7878390db89481c1d46daa4278d8\r\n" |
| 272 "a=fingerprint:sha-256 58:AB:6E:F5:F1:E4:57:B7:E9:46:F4:86:04:28:F9:A7:ED:" |
| 273 "BD:AB:AE:40:EF:CE:9A:51:2C:2A:B1:9B:8B:78:84\r\n" |
250 "a=mid:video\r\n" | 274 "a=mid:video\r\n" |
251 "a=sendrecv\r\n" | 275 "a=sendrecv\r\n" |
252 "a=rtcp-mux\r\n" | 276 "a=rtcp-mux\r\n" |
253 "a=rtpmap:120 VP8/90000\r\n"; | 277 "a=rtpmap:120 VP8/90000\r\n"; |
254 | 278 |
255 static const char kSdpStringMs1Audio0[] = | 279 static const char kSdpStringMs1Audio0[] = |
256 "a=ssrc:1 cname:stream1\r\n" | 280 "a=ssrc:1 cname:stream1\r\n" |
257 "a=ssrc:1 msid:stream1 audiotrack0\r\n"; | 281 "a=ssrc:1 msid:stream1 audiotrack0\r\n"; |
258 | 282 |
259 static const char kSdpStringMs1Video0[] = | 283 static const char kSdpStringMs1Video0[] = |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 const cricket::MediaContentDescription* media_desc = | 342 const cricket::MediaContentDescription* media_desc = |
319 static_cast<const cricket::MediaContentDescription*>( | 343 static_cast<const cricket::MediaContentDescription*>( |
320 content_info->description); | 344 content_info->description); |
321 if (!media_desc || media_desc->streams().empty()) { | 345 if (!media_desc || media_desc->streams().empty()) { |
322 return false; | 346 return false; |
323 } | 347 } |
324 *ssrc = media_desc->streams().begin()->first_ssrc(); | 348 *ssrc = media_desc->streams().begin()->first_ssrc(); |
325 return true; | 349 return true; |
326 } | 350 } |
327 | 351 |
| 352 // Get the ufrags out of an SDP blob. Useful for testing ICE restart |
| 353 // behavior. |
| 354 std::vector<std::string> GetUfrags( |
| 355 const webrtc::SessionDescriptionInterface* desc) { |
| 356 std::vector<std::string> ufrags; |
| 357 for (const cricket::TransportInfo& info : |
| 358 desc->description()->transport_infos()) { |
| 359 ufrags.push_back(info.description.ice_ufrag); |
| 360 } |
| 361 return ufrags; |
| 362 } |
| 363 |
328 void SetSsrcToZero(std::string* sdp) { | 364 void SetSsrcToZero(std::string* sdp) { |
329 const char kSdpSsrcAtribute[] = "a=ssrc:"; | 365 const char kSdpSsrcAtribute[] = "a=ssrc:"; |
330 const char kSdpSsrcAtributeZero[] = "a=ssrc:0"; | 366 const char kSdpSsrcAtributeZero[] = "a=ssrc:0"; |
331 size_t ssrc_pos = 0; | 367 size_t ssrc_pos = 0; |
332 while ((ssrc_pos = sdp->find(kSdpSsrcAtribute, ssrc_pos)) != | 368 while ((ssrc_pos = sdp->find(kSdpSsrcAtribute, ssrc_pos)) != |
333 std::string::npos) { | 369 std::string::npos) { |
334 size_t end_ssrc = sdp->find(" ", ssrc_pos); | 370 size_t end_ssrc = sdp->find(" ", ssrc_pos); |
335 sdp->replace(ssrc_pos, end_ssrc - ssrc_pos, kSdpSsrcAtributeZero); | 371 sdp->replace(ssrc_pos, end_ssrc - ssrc_pos, kSdpSsrcAtributeZero); |
336 ssrc_pos = end_ssrc; | 372 ssrc_pos = end_ssrc; |
337 } | 373 } |
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 CreateAndSetRemoteOffer(kSdpStringWithStream1AudioTrackOnly); | 2755 CreateAndSetRemoteOffer(kSdpStringWithStream1AudioTrackOnly); |
2720 EXPECT_EQ(observer_.num_added_tracks_, 1); | 2756 EXPECT_EQ(observer_.num_added_tracks_, 1); |
2721 EXPECT_EQ(observer_.last_added_track_label_, kAudioTracks[0]); | 2757 EXPECT_EQ(observer_.last_added_track_label_, kAudioTracks[0]); |
2722 | 2758 |
2723 // Create and set the updated remote SDP. | 2759 // Create and set the updated remote SDP. |
2724 CreateAndSetRemoteOffer(kSdpStringWithStream1); | 2760 CreateAndSetRemoteOffer(kSdpStringWithStream1); |
2725 EXPECT_EQ(observer_.num_added_tracks_, 2); | 2761 EXPECT_EQ(observer_.num_added_tracks_, 2); |
2726 EXPECT_EQ(observer_.last_added_track_label_, kVideoTracks[0]); | 2762 EXPECT_EQ(observer_.last_added_track_label_, kVideoTracks[0]); |
2727 } | 2763 } |
2728 | 2764 |
| 2765 // Test that when SetConfiguration is called and the configuration is |
| 2766 // changing, the next offer causes an ICE restart. |
| 2767 TEST_F(PeerConnectionInterfaceTest, SetConfigurationCausingIceRetart) { |
| 2768 PeerConnectionInterface::RTCConfiguration config; |
| 2769 config.type = PeerConnectionInterface::kRelay; |
| 2770 // Need to pass default constraints to prevent disabling of DTLS... |
| 2771 FakeConstraints default_constraints; |
| 2772 CreatePeerConnection(config, &default_constraints); |
| 2773 AddAudioVideoStream(kStreamLabel1, "audio_label", "video_label"); |
| 2774 |
| 2775 // Do initial offer/answer so there's something to restart. |
| 2776 CreateOfferAsLocalDescription(); |
| 2777 CreateAnswerAsRemoteDescription(kSdpStringWithStream1); |
| 2778 |
| 2779 // Grab the ufrags. |
| 2780 std::vector<std::string> initial_ufrags = GetUfrags(pc_->local_description()); |
| 2781 |
| 2782 // Change ICE policy, which should trigger an ICE restart on the next offer. |
| 2783 config.type = PeerConnectionInterface::kAll; |
| 2784 EXPECT_TRUE(pc_->SetConfiguration(config)); |
| 2785 CreateOfferAsLocalDescription(); |
| 2786 |
| 2787 // Grab the new ufrags. |
| 2788 std::vector<std::string> subsequent_ufrags = |
| 2789 GetUfrags(pc_->local_description()); |
| 2790 |
| 2791 // Sanity check. |
| 2792 EXPECT_EQ(initial_ufrags.size(), subsequent_ufrags.size()); |
| 2793 // Check that each ufrag is different. |
| 2794 for (int i = 0; i < static_cast<int>(initial_ufrags.size()); ++i) { |
| 2795 EXPECT_NE(initial_ufrags[i], subsequent_ufrags[i]); |
| 2796 } |
| 2797 } |
| 2798 |
| 2799 // Test that when SetConfiguration is called and the configuration *isn't* |
| 2800 // changing, the next offer does *not* cause an ICE restart. |
| 2801 TEST_F(PeerConnectionInterfaceTest, SetConfigurationNotCausingIceRetart) { |
| 2802 PeerConnectionInterface::RTCConfiguration config; |
| 2803 config.type = PeerConnectionInterface::kRelay; |
| 2804 // Need to pass default constraints to prevent disabling of DTLS... |
| 2805 FakeConstraints default_constraints; |
| 2806 CreatePeerConnection(config, &default_constraints); |
| 2807 AddAudioVideoStream(kStreamLabel1, "audio_label", "video_label"); |
| 2808 |
| 2809 // Do initial offer/answer so there's something to restart. |
| 2810 CreateOfferAsLocalDescription(); |
| 2811 CreateAnswerAsRemoteDescription(kSdpStringWithStream1); |
| 2812 |
| 2813 // Grab the ufrags. |
| 2814 std::vector<std::string> initial_ufrags = GetUfrags(pc_->local_description()); |
| 2815 |
| 2816 // Call SetConfiguration with a config identical to what the PC was |
| 2817 // constructed with. |
| 2818 EXPECT_TRUE(pc_->SetConfiguration(config)); |
| 2819 CreateOfferAsLocalDescription(); |
| 2820 |
| 2821 // Grab the new ufrags. |
| 2822 std::vector<std::string> subsequent_ufrags = |
| 2823 GetUfrags(pc_->local_description()); |
| 2824 |
| 2825 EXPECT_EQ(initial_ufrags, subsequent_ufrags); |
| 2826 } |
| 2827 |
| 2828 // Test for a weird corner case scenario: |
| 2829 // 1. Audio/video session established. |
| 2830 // 2. SetConfiguration changes ICE config; ICE restart needed. |
| 2831 // 3. ICE restart initiated by remote peer, but only for one m= section. |
| 2832 // 4. Next createOffer should initiate an ICE restart, but only for the other |
| 2833 // m= section; it would be pointless to do an ICE restart for the m= section |
| 2834 // that was already restarted. |
| 2835 TEST_F(PeerConnectionInterfaceTest, SetConfigurationCausingPartialIceRestart) { |
| 2836 PeerConnectionInterface::RTCConfiguration config; |
| 2837 config.type = PeerConnectionInterface::kRelay; |
| 2838 // Need to pass default constraints to prevent disabling of DTLS... |
| 2839 FakeConstraints default_constraints; |
| 2840 CreatePeerConnection(config, &default_constraints); |
| 2841 AddAudioVideoStream(kStreamLabel1, "audio_label", "video_label"); |
| 2842 |
| 2843 // Do initial offer/answer so there's something to restart. |
| 2844 CreateOfferAsLocalDescription(); |
| 2845 CreateAnswerAsRemoteDescription(kSdpStringWithStream1); |
| 2846 |
| 2847 // Change ICE policy, which should set the "needs-ice-restart" flag. |
| 2848 config.type = PeerConnectionInterface::kAll; |
| 2849 EXPECT_TRUE(pc_->SetConfiguration(config)); |
| 2850 |
| 2851 // Do ICE restart for the first m= section, initiated by remote peer. |
| 2852 webrtc::JsepSessionDescription* remote_offer = |
| 2853 new webrtc::JsepSessionDescription(SessionDescriptionInterface::kOffer); |
| 2854 EXPECT_TRUE(remote_offer->Initialize(kSdpStringWithStream1, nullptr)); |
| 2855 remote_offer->description()->transport_infos()[0].description.ice_ufrag = |
| 2856 "modified"; |
| 2857 EXPECT_TRUE(DoSetRemoteDescription(remote_offer)); |
| 2858 CreateAnswerAsLocalDescription(); |
| 2859 |
| 2860 // Grab the ufrags. |
| 2861 std::vector<std::string> initial_ufrags = GetUfrags(pc_->local_description()); |
| 2862 ASSERT_EQ(2, initial_ufrags.size()); |
| 2863 |
| 2864 // Create offer and grab the new ufrags. |
| 2865 CreateOfferAsLocalDescription(); |
| 2866 std::vector<std::string> subsequent_ufrags = |
| 2867 GetUfrags(pc_->local_description()); |
| 2868 ASSERT_EQ(2, subsequent_ufrags.size()); |
| 2869 |
| 2870 // Ensure that only the ufrag for the second m= section changed. |
| 2871 EXPECT_EQ(initial_ufrags[0], subsequent_ufrags[0]); |
| 2872 EXPECT_NE(initial_ufrags[1], subsequent_ufrags[1]); |
| 2873 } |
| 2874 |
2729 class PeerConnectionMediaConfigTest : public testing::Test { | 2875 class PeerConnectionMediaConfigTest : public testing::Test { |
2730 protected: | 2876 protected: |
2731 void SetUp() override { | 2877 void SetUp() override { |
2732 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); | 2878 pcf_ = new rtc::RefCountedObject<PeerConnectionFactoryForTest>(); |
2733 pcf_->Initialize(); | 2879 pcf_->Initialize(); |
2734 } | 2880 } |
2735 const cricket::MediaConfig& TestCreatePeerConnection( | 2881 const cricket::MediaConfig& TestCreatePeerConnection( |
2736 const PeerConnectionInterface::RTCConfiguration& config, | 2882 const PeerConnectionInterface::RTCConfiguration& config, |
2737 const MediaConstraintsInterface *constraints) { | 2883 const MediaConstraintsInterface *constraints) { |
2738 pcf_->create_media_controller_called_ = false; | 2884 pcf_->create_media_controller_called_ = false; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2982 FakeConstraints updated_answer_c; | 3128 FakeConstraints updated_answer_c; |
2983 answer_c.SetMandatoryReceiveAudio(false); | 3129 answer_c.SetMandatoryReceiveAudio(false); |
2984 answer_c.SetMandatoryReceiveVideo(false); | 3130 answer_c.SetMandatoryReceiveVideo(false); |
2985 | 3131 |
2986 cricket::MediaSessionOptions updated_answer_options; | 3132 cricket::MediaSessionOptions updated_answer_options; |
2987 EXPECT_TRUE( | 3133 EXPECT_TRUE( |
2988 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 3134 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
2989 EXPECT_TRUE(updated_answer_options.has_audio()); | 3135 EXPECT_TRUE(updated_answer_options.has_audio()); |
2990 EXPECT_TRUE(updated_answer_options.has_video()); | 3136 EXPECT_TRUE(updated_answer_options.has_video()); |
2991 } | 3137 } |
OLD | NEW |