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

Side by Side Diff: webrtc/pc/channelmanager.cc

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

Powered by Google App Engine
This is Rietveld 408576698