| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 while (!voice_channels_.empty()) { | 200 while (!voice_channels_.empty()) { |
| 201 DestroyVoiceChannel_w(voice_channels_.back()); | 201 DestroyVoiceChannel_w(voice_channels_.back()); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 VoiceChannel* ChannelManager::CreateVoiceChannel( | 205 VoiceChannel* ChannelManager::CreateVoiceChannel( |
| 206 webrtc::MediaControllerInterface* media_controller, | 206 webrtc::MediaControllerInterface* media_controller, |
| 207 TransportController* transport_controller, | 207 TransportController* transport_controller, |
| 208 const std::string& content_name, | 208 const std::string& content_name, |
| 209 const std::string& transport_name, |
| 209 bool rtcp, | 210 bool rtcp, |
| 210 const AudioOptions& options) { | 211 const AudioOptions& options) { |
| 211 return worker_thread_->Invoke<VoiceChannel*>( | 212 return worker_thread_->Invoke<VoiceChannel*>( |
| 212 Bind(&ChannelManager::CreateVoiceChannel_w, this, media_controller, | 213 Bind(&ChannelManager::CreateVoiceChannel_w, this, media_controller, |
| 213 transport_controller, content_name, rtcp, options)); | 214 transport_controller, content_name, transport_name, rtcp, options)); |
| 214 } | 215 } |
| 215 | 216 |
| 216 VoiceChannel* ChannelManager::CreateVoiceChannel_w( | 217 VoiceChannel* ChannelManager::CreateVoiceChannel_w( |
| 217 webrtc::MediaControllerInterface* media_controller, | 218 webrtc::MediaControllerInterface* media_controller, |
| 218 TransportController* transport_controller, | 219 TransportController* transport_controller, |
| 219 const std::string& content_name, | 220 const std::string& content_name, |
| 221 const std::string& transport_name, |
| 220 bool rtcp, | 222 bool rtcp, |
| 221 const AudioOptions& options) { | 223 const AudioOptions& options) { |
| 222 ASSERT(initialized_); | 224 ASSERT(initialized_); |
| 223 ASSERT(worker_thread_ == rtc::Thread::Current()); | 225 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 224 ASSERT(nullptr != media_controller); | 226 ASSERT(nullptr != media_controller); |
| 225 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( | 227 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( |
| 226 media_controller->call_w(), media_controller->config(), options); | 228 media_controller->call_w(), media_controller->config(), options); |
| 227 if (!media_channel) | 229 if (!media_channel) |
| 228 return nullptr; | 230 return nullptr; |
| 229 | 231 |
| 230 VoiceChannel* voice_channel = | 232 VoiceChannel* voice_channel = |
| 231 new VoiceChannel(worker_thread_, media_engine_.get(), media_channel, | 233 new VoiceChannel(worker_thread_, media_engine_.get(), media_channel, |
| 232 transport_controller, content_name, rtcp); | 234 transport_controller, content_name, rtcp); |
| 233 if (!voice_channel->Init()) { | 235 if (!voice_channel->Init(transport_name)) { |
| 234 delete voice_channel; | 236 delete voice_channel; |
| 235 return nullptr; | 237 return nullptr; |
| 236 } | 238 } |
| 237 voice_channels_.push_back(voice_channel); | 239 voice_channels_.push_back(voice_channel); |
| 238 return voice_channel; | 240 return voice_channel; |
| 239 } | 241 } |
| 240 | 242 |
| 241 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { | 243 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { |
| 242 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); | 244 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel"); |
| 243 if (voice_channel) { | 245 if (voice_channel) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 257 if (it == voice_channels_.end()) | 259 if (it == voice_channels_.end()) |
| 258 return; | 260 return; |
| 259 voice_channels_.erase(it); | 261 voice_channels_.erase(it); |
| 260 delete voice_channel; | 262 delete voice_channel; |
| 261 } | 263 } |
| 262 | 264 |
| 263 VideoChannel* ChannelManager::CreateVideoChannel( | 265 VideoChannel* ChannelManager::CreateVideoChannel( |
| 264 webrtc::MediaControllerInterface* media_controller, | 266 webrtc::MediaControllerInterface* media_controller, |
| 265 TransportController* transport_controller, | 267 TransportController* transport_controller, |
| 266 const std::string& content_name, | 268 const std::string& content_name, |
| 269 const std::string& transport_name, |
| 267 bool rtcp, | 270 bool rtcp, |
| 268 const VideoOptions& options) { | 271 const VideoOptions& options) { |
| 269 return worker_thread_->Invoke<VideoChannel*>( | 272 return worker_thread_->Invoke<VideoChannel*>( |
| 270 Bind(&ChannelManager::CreateVideoChannel_w, this, media_controller, | 273 Bind(&ChannelManager::CreateVideoChannel_w, this, media_controller, |
| 271 transport_controller, content_name, rtcp, options)); | 274 transport_controller, content_name, transport_name, rtcp, options)); |
| 272 } | 275 } |
| 273 | 276 |
| 274 VideoChannel* ChannelManager::CreateVideoChannel_w( | 277 VideoChannel* ChannelManager::CreateVideoChannel_w( |
| 275 webrtc::MediaControllerInterface* media_controller, | 278 webrtc::MediaControllerInterface* media_controller, |
| 276 TransportController* transport_controller, | 279 TransportController* transport_controller, |
| 277 const std::string& content_name, | 280 const std::string& content_name, |
| 281 const std::string& transport_name, |
| 278 bool rtcp, | 282 bool rtcp, |
| 279 const VideoOptions& options) { | 283 const VideoOptions& options) { |
| 280 ASSERT(initialized_); | 284 ASSERT(initialized_); |
| 281 ASSERT(worker_thread_ == rtc::Thread::Current()); | 285 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 282 ASSERT(nullptr != media_controller); | 286 ASSERT(nullptr != media_controller); |
| 283 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( | 287 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( |
| 284 media_controller->call_w(), media_controller->config(), options); | 288 media_controller->call_w(), media_controller->config(), options); |
| 285 if (media_channel == NULL) { | 289 if (media_channel == NULL) { |
| 286 return NULL; | 290 return NULL; |
| 287 } | 291 } |
| 288 | 292 |
| 289 VideoChannel* video_channel = new VideoChannel( | 293 VideoChannel* video_channel = new VideoChannel( |
| 290 worker_thread_, media_channel, transport_controller, content_name, rtcp); | 294 worker_thread_, media_channel, transport_controller, content_name, rtcp); |
| 291 if (!video_channel->Init()) { | 295 if (!video_channel->Init(transport_name)) { |
| 292 delete video_channel; | 296 delete video_channel; |
| 293 return NULL; | 297 return NULL; |
| 294 } | 298 } |
| 295 video_channels_.push_back(video_channel); | 299 video_channels_.push_back(video_channel); |
| 296 return video_channel; | 300 return video_channel; |
| 297 } | 301 } |
| 298 | 302 |
| 299 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { | 303 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { |
| 300 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); | 304 TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel"); |
| 301 if (video_channel) { | 305 if (video_channel) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 315 if (it == video_channels_.end()) | 319 if (it == video_channels_.end()) |
| 316 return; | 320 return; |
| 317 | 321 |
| 318 video_channels_.erase(it); | 322 video_channels_.erase(it); |
| 319 delete video_channel; | 323 delete video_channel; |
| 320 } | 324 } |
| 321 | 325 |
| 322 DataChannel* ChannelManager::CreateDataChannel( | 326 DataChannel* ChannelManager::CreateDataChannel( |
| 323 TransportController* transport_controller, | 327 TransportController* transport_controller, |
| 324 const std::string& content_name, | 328 const std::string& content_name, |
| 329 const std::string& transport_name, |
| 325 bool rtcp, | 330 bool rtcp, |
| 326 DataChannelType channel_type) { | 331 DataChannelType channel_type) { |
| 327 return worker_thread_->Invoke<DataChannel*>( | 332 return worker_thread_->Invoke<DataChannel*>( |
| 328 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller, | 333 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller, |
| 329 content_name, rtcp, channel_type)); | 334 content_name, transport_name, rtcp, channel_type)); |
| 330 } | 335 } |
| 331 | 336 |
| 332 DataChannel* ChannelManager::CreateDataChannel_w( | 337 DataChannel* ChannelManager::CreateDataChannel_w( |
| 333 TransportController* transport_controller, | 338 TransportController* transport_controller, |
| 334 const std::string& content_name, | 339 const std::string& content_name, |
| 340 const std::string& transport_name, |
| 335 bool rtcp, | 341 bool rtcp, |
| 336 DataChannelType data_channel_type) { | 342 DataChannelType data_channel_type) { |
| 337 // This is ok to alloc from a thread other than the worker thread. | 343 // This is ok to alloc from a thread other than the worker thread. |
| 338 ASSERT(initialized_); | 344 ASSERT(initialized_); |
| 339 DataMediaChannel* media_channel = data_media_engine_->CreateChannel( | 345 DataMediaChannel* media_channel = data_media_engine_->CreateChannel( |
| 340 data_channel_type); | 346 data_channel_type); |
| 341 if (!media_channel) { | 347 if (!media_channel) { |
| 342 LOG(LS_WARNING) << "Failed to create data channel of type " | 348 LOG(LS_WARNING) << "Failed to create data channel of type " |
| 343 << data_channel_type; | 349 << data_channel_type; |
| 344 return NULL; | 350 return NULL; |
| 345 } | 351 } |
| 346 | 352 |
| 347 DataChannel* data_channel = new DataChannel( | 353 DataChannel* data_channel = new DataChannel( |
| 348 worker_thread_, media_channel, transport_controller, content_name, rtcp); | 354 worker_thread_, media_channel, transport_controller, content_name, rtcp); |
| 349 if (!data_channel->Init()) { | 355 if (!data_channel->Init(transport_name)) { |
| 350 LOG(LS_WARNING) << "Failed to init data channel."; | 356 LOG(LS_WARNING) << "Failed to init data channel."; |
| 351 delete data_channel; | 357 delete data_channel; |
| 352 return NULL; | 358 return NULL; |
| 353 } | 359 } |
| 354 data_channels_.push_back(data_channel); | 360 data_channels_.push_back(data_channel); |
| 355 return data_channel; | 361 return data_channel; |
| 356 } | 362 } |
| 357 | 363 |
| 358 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { | 364 void ChannelManager::DestroyDataChannel(DataChannel* data_channel) { |
| 359 TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel"); | 365 TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel"); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 return worker_thread_->Invoke<bool>( | 423 return worker_thread_->Invoke<bool>( |
| 418 Bind(&MediaEngineInterface::StartRtcEventLog, media_engine_.get(), file)); | 424 Bind(&MediaEngineInterface::StartRtcEventLog, media_engine_.get(), file)); |
| 419 } | 425 } |
| 420 | 426 |
| 421 void ChannelManager::StopRtcEventLog() { | 427 void ChannelManager::StopRtcEventLog() { |
| 422 worker_thread_->Invoke<void>( | 428 worker_thread_->Invoke<void>( |
| 423 Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get())); | 429 Bind(&MediaEngineInterface::StopRtcEventLog, media_engine_.get())); |
| 424 } | 430 } |
| 425 | 431 |
| 426 } // namespace cricket | 432 } // namespace cricket |
| OLD | NEW |