OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 while (!video_channels_.empty()) { | 200 while (!video_channels_.empty()) { |
201 DestroyVideoChannel_w(video_channels_.back()); | 201 DestroyVideoChannel_w(video_channels_.back()); |
202 } | 202 } |
203 while (!voice_channels_.empty()) { | 203 while (!voice_channels_.empty()) { |
204 DestroyVoiceChannel_w(voice_channels_.back()); | 204 DestroyVoiceChannel_w(voice_channels_.back()); |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 VoiceChannel* ChannelManager::CreateVoiceChannel( | 208 VoiceChannel* ChannelManager::CreateVoiceChannel( |
209 webrtc::MediaControllerInterface* media_controller, | 209 webrtc::MediaControllerInterface* media_controller, |
210 TransportController* transport_controller, | 210 TransportChannel* rtp_transport, |
| 211 TransportChannel* rtcp_transport, |
| 212 rtc::Thread* signaling_thread, |
211 const std::string& content_name, | 213 const std::string& content_name, |
212 const std::string* bundle_transport_name, | 214 const std::string* bundle_transport_name, |
213 bool rtcp, | 215 bool rtcp, |
214 bool srtp_required, | 216 bool srtp_required, |
215 const AudioOptions& options) { | 217 const AudioOptions& options) { |
216 return worker_thread_->Invoke<VoiceChannel*>( | 218 return worker_thread_->Invoke<VoiceChannel*>( |
217 RTC_FROM_HERE, Bind(&ChannelManager::CreateVoiceChannel_w, this, | 219 RTC_FROM_HERE, |
218 media_controller, transport_controller, content_name, | 220 Bind(&ChannelManager::CreateVoiceChannel_w, this, media_controller, |
219 bundle_transport_name, rtcp, srtp_required, options)); | 221 rtp_transport, rtcp_transport, signaling_thread, content_name, |
| 222 bundle_transport_name, rtcp, srtp_required, options)); |
220 } | 223 } |
221 | 224 |
222 VoiceChannel* ChannelManager::CreateVoiceChannel_w( | 225 VoiceChannel* ChannelManager::CreateVoiceChannel_w( |
223 webrtc::MediaControllerInterface* media_controller, | 226 webrtc::MediaControllerInterface* media_controller, |
224 TransportController* transport_controller, | 227 TransportChannel* rtp_transport, |
| 228 TransportChannel* rtcp_transport, |
| 229 rtc::Thread* signaling_thread, |
225 const std::string& content_name, | 230 const std::string& content_name, |
226 const std::string* bundle_transport_name, | 231 const std::string* bundle_transport_name, |
227 bool rtcp, | 232 bool rtcp, |
228 bool srtp_required, | 233 bool srtp_required, |
229 const AudioOptions& options) { | 234 const AudioOptions& options) { |
230 RTC_DCHECK(initialized_); | 235 RTC_DCHECK(initialized_); |
231 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 236 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
232 RTC_DCHECK(nullptr != media_controller); | 237 RTC_DCHECK(nullptr != media_controller); |
| 238 |
233 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( | 239 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( |
234 media_controller->call_w(), media_controller->config(), options); | 240 media_controller->call_w(), media_controller->config(), options); |
235 if (!media_channel) | 241 if (!media_channel) |
236 return nullptr; | 242 return nullptr; |
237 | 243 |
238 VoiceChannel* voice_channel = new VoiceChannel( | 244 VoiceChannel* voice_channel = new VoiceChannel( |
239 worker_thread_, network_thread_, media_engine_.get(), media_channel, | 245 worker_thread_, network_thread_, signaling_thread, media_engine_.get(), |
240 transport_controller, content_name, rtcp, srtp_required); | 246 media_channel, content_name, rtcp, srtp_required); |
241 voice_channel->SetCryptoOptions(crypto_options_); | 247 voice_channel->SetCryptoOptions(crypto_options_); |
242 if (!voice_channel->Init_w(bundle_transport_name)) { | 248 |
| 249 if (!voice_channel->Init_w(rtp_transport, rtcp_transport)) { |
243 delete voice_channel; | 250 delete voice_channel; |
244 return nullptr; | 251 return nullptr; |
245 } | 252 } |
246 voice_channels_.push_back(voice_channel); | 253 voice_channels_.push_back(voice_channel); |
247 return voice_channel; | 254 return voice_channel; |
248 } | 255 } |
249 | 256 |
250 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { | 257 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { |
251 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); | 258 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); |
252 if (voice_channel) { | 259 if (voice_channel) { |
(...skipping 12 matching lines...) Expand all Loading... |
265 voice_channels_.end(), voice_channel); | 272 voice_channels_.end(), voice_channel); |
266 RTC_DCHECK(it != voice_channels_.end()); | 273 RTC_DCHECK(it != voice_channels_.end()); |
267 if (it == voice_channels_.end()) | 274 if (it == voice_channels_.end()) |
268 return; | 275 return; |
269 voice_channels_.erase(it); | 276 voice_channels_.erase(it); |
270 delete voice_channel; | 277 delete voice_channel; |
271 } | 278 } |
272 | 279 |
273 VideoChannel* ChannelManager::CreateVideoChannel( | 280 VideoChannel* ChannelManager::CreateVideoChannel( |
274 webrtc::MediaControllerInterface* media_controller, | 281 webrtc::MediaControllerInterface* media_controller, |
275 TransportController* transport_controller, | 282 TransportChannel* rtp_transport, |
| 283 TransportChannel* rtcp_transport, |
| 284 rtc::Thread* signaling_thread, |
276 const std::string& content_name, | 285 const std::string& content_name, |
277 const std::string* bundle_transport_name, | 286 const std::string* bundle_transport_name, |
278 bool rtcp, | 287 bool rtcp, |
279 bool srtp_required, | 288 bool srtp_required, |
280 const VideoOptions& options) { | 289 const VideoOptions& options) { |
281 return worker_thread_->Invoke<VideoChannel*>( | 290 return worker_thread_->Invoke<VideoChannel*>( |
282 RTC_FROM_HERE, Bind(&ChannelManager::CreateVideoChannel_w, this, | 291 RTC_FROM_HERE, |
283 media_controller, transport_controller, content_name, | 292 Bind(&ChannelManager::CreateVideoChannel_w, this, media_controller, |
284 bundle_transport_name, rtcp, srtp_required, options)); | 293 rtp_transport, rtcp_transport, signaling_thread, content_name, |
| 294 bundle_transport_name, rtcp, srtp_required, options)); |
285 } | 295 } |
286 | 296 |
287 VideoChannel* ChannelManager::CreateVideoChannel_w( | 297 VideoChannel* ChannelManager::CreateVideoChannel_w( |
288 webrtc::MediaControllerInterface* media_controller, | 298 webrtc::MediaControllerInterface* media_controller, |
289 TransportController* transport_controller, | 299 TransportChannel* rtp_transport, |
| 300 TransportChannel* rtcp_transport, |
| 301 rtc::Thread* signaling_thread, |
290 const std::string& content_name, | 302 const std::string& content_name, |
291 const std::string* bundle_transport_name, | 303 const std::string* bundle_transport_name, |
292 bool rtcp, | 304 bool rtcp, |
293 bool srtp_required, | 305 bool srtp_required, |
294 const VideoOptions& options) { | 306 const VideoOptions& options) { |
295 RTC_DCHECK(initialized_); | 307 RTC_DCHECK(initialized_); |
296 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 308 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
297 RTC_DCHECK(nullptr != media_controller); | 309 RTC_DCHECK(nullptr != media_controller); |
298 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( | 310 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( |
299 media_controller->call_w(), media_controller->config(), options); | 311 media_controller->call_w(), media_controller->config(), options); |
300 if (media_channel == NULL) { | 312 if (media_channel == NULL) { |
301 return NULL; | 313 return NULL; |
302 } | 314 } |
303 | 315 |
304 VideoChannel* video_channel = | 316 VideoChannel* video_channel = |
305 new VideoChannel(worker_thread_, network_thread_, media_channel, | 317 new VideoChannel(worker_thread_, network_thread_, signaling_thread, |
306 transport_controller, content_name, rtcp, srtp_required); | 318 media_channel, content_name, rtcp, srtp_required); |
307 video_channel->SetCryptoOptions(crypto_options_); | 319 video_channel->SetCryptoOptions(crypto_options_); |
308 if (!video_channel->Init_w(bundle_transport_name)) { | 320 if (!video_channel->Init_w(rtp_transport, rtcp_transport)) { |
309 delete video_channel; | 321 delete video_channel; |
310 return NULL; | 322 return NULL; |
311 } | 323 } |
312 video_channels_.push_back(video_channel); | 324 video_channels_.push_back(video_channel); |
313 return video_channel; | 325 return video_channel; |
314 } | 326 } |
315 | 327 |
316 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { | 328 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { |
317 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); | 329 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); |
318 if (video_channel) { | 330 if (video_channel) { |
(...skipping 13 matching lines...) Expand all Loading... |
332 RTC_DCHECK(it != video_channels_.end()); | 344 RTC_DCHECK(it != video_channels_.end()); |
333 if (it == video_channels_.end()) | 345 if (it == video_channels_.end()) |
334 return; | 346 return; |
335 | 347 |
336 video_channels_.erase(it); | 348 video_channels_.erase(it); |
337 delete video_channel; | 349 delete video_channel; |
338 } | 350 } |
339 | 351 |
340 RtpDataChannel* ChannelManager::CreateRtpDataChannel( | 352 RtpDataChannel* ChannelManager::CreateRtpDataChannel( |
341 webrtc::MediaControllerInterface* media_controller, | 353 webrtc::MediaControllerInterface* media_controller, |
342 TransportController* transport_controller, | 354 TransportChannel* rtp_transport, |
| 355 TransportChannel* rtcp_transport, |
| 356 rtc::Thread* signaling_thread, |
343 const std::string& content_name, | 357 const std::string& content_name, |
344 const std::string* bundle_transport_name, | 358 const std::string* bundle_transport_name, |
345 bool rtcp, | 359 bool rtcp, |
346 bool srtp_required) { | 360 bool srtp_required) { |
347 return worker_thread_->Invoke<RtpDataChannel*>( | 361 return worker_thread_->Invoke<RtpDataChannel*>( |
348 RTC_FROM_HERE, Bind(&ChannelManager::CreateRtpDataChannel_w, this, | 362 RTC_FROM_HERE, |
349 media_controller, transport_controller, content_name, | 363 Bind(&ChannelManager::CreateRtpDataChannel_w, this, media_controller, |
350 bundle_transport_name, rtcp, srtp_required)); | 364 rtp_transport, rtcp_transport, signaling_thread, content_name, |
| 365 bundle_transport_name, rtcp, srtp_required)); |
351 } | 366 } |
352 | 367 |
353 RtpDataChannel* ChannelManager::CreateRtpDataChannel_w( | 368 RtpDataChannel* ChannelManager::CreateRtpDataChannel_w( |
354 webrtc::MediaControllerInterface* media_controller, | 369 webrtc::MediaControllerInterface* media_controller, |
355 TransportController* transport_controller, | 370 TransportChannel* rtp_transport, |
| 371 TransportChannel* rtcp_transport, |
| 372 rtc::Thread* signaling_thread, |
356 const std::string& content_name, | 373 const std::string& content_name, |
357 const std::string* bundle_transport_name, | 374 const std::string* bundle_transport_name, |
358 bool rtcp, | 375 bool rtcp, |
359 bool srtp_required) { | 376 bool srtp_required) { |
360 // This is ok to alloc from a thread other than the worker thread. | 377 // This is ok to alloc from a thread other than the worker thread. |
361 RTC_DCHECK(initialized_); | 378 RTC_DCHECK(initialized_); |
362 MediaConfig config; | 379 MediaConfig config; |
363 if (media_controller) { | 380 if (media_controller) { |
364 config = media_controller->config(); | 381 config = media_controller->config(); |
365 } | 382 } |
366 DataMediaChannel* media_channel = data_media_engine_->CreateChannel(config); | 383 DataMediaChannel* media_channel = data_media_engine_->CreateChannel(config); |
367 if (!media_channel) { | 384 if (!media_channel) { |
368 LOG(LS_WARNING) << "Failed to create RTP data channel."; | 385 LOG(LS_WARNING) << "Failed to create RTP data channel."; |
369 return nullptr; | 386 return nullptr; |
370 } | 387 } |
371 | 388 |
372 RtpDataChannel* data_channel = new RtpDataChannel( | 389 RtpDataChannel* data_channel = |
373 worker_thread_, network_thread_, media_channel, transport_controller, | 390 new RtpDataChannel(worker_thread_, network_thread_, signaling_thread, |
374 content_name, rtcp, srtp_required); | 391 media_channel, content_name, rtcp, srtp_required); |
375 data_channel->SetCryptoOptions(crypto_options_); | 392 data_channel->SetCryptoOptions(crypto_options_); |
376 if (!data_channel->Init_w(bundle_transport_name)) { | 393 if (!data_channel->Init_w(rtp_transport, rtcp_transport)) { |
377 LOG(LS_WARNING) << "Failed to init data channel."; | 394 LOG(LS_WARNING) << "Failed to init data channel."; |
378 delete data_channel; | 395 delete data_channel; |
379 return nullptr; | 396 return nullptr; |
380 } | 397 } |
381 data_channels_.push_back(data_channel); | 398 data_channels_.push_back(data_channel); |
382 return data_channel; | 399 return data_channel; |
383 } | 400 } |
384 | 401 |
385 void ChannelManager::DestroyRtpDataChannel(RtpDataChannel* data_channel) { | 402 void ChannelManager::DestroyRtpDataChannel(RtpDataChannel* data_channel) { |
386 TRACE_EVENT0("webrtc", "ChannelManager::DestroyRtpDataChannel"); | 403 TRACE_EVENT0("webrtc", "ChannelManager::DestroyRtpDataChannel"); |
(...skipping 25 matching lines...) Expand all Loading... |
412 media_engine_.get(), file, max_size_bytes)); | 429 media_engine_.get(), file, max_size_bytes)); |
413 } | 430 } |
414 | 431 |
415 void ChannelManager::StopAecDump() { | 432 void ChannelManager::StopAecDump() { |
416 worker_thread_->Invoke<void>( | 433 worker_thread_->Invoke<void>( |
417 RTC_FROM_HERE, | 434 RTC_FROM_HERE, |
418 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); | 435 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); |
419 } | 436 } |
420 | 437 |
421 } // namespace cricket | 438 } // namespace cricket |
OLD | NEW |