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

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

Issue 2622613004: Refactoring of RTCP options in BaseChannel. (Closed)
Patch Set: Minor renaming/adding a comment, which makes sense to do after this refactoring. 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
« no previous file with comments | « webrtc/pc/channelmanager.h ('k') | webrtc/pc/channelmanager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 TransportChannel* rtp_transport, 210 TransportChannel* rtp_transport,
211 TransportChannel* rtcp_transport, 211 TransportChannel* rtcp_transport,
212 rtc::Thread* signaling_thread, 212 rtc::Thread* signaling_thread,
213 const std::string& content_name, 213 const std::string& content_name,
214 const std::string* bundle_transport_name, 214 const std::string* bundle_transport_name,
215 bool rtcp, 215 bool rtcp_mux_required,
216 bool srtp_required, 216 bool srtp_required,
217 const AudioOptions& options) { 217 const AudioOptions& options) {
218 return worker_thread_->Invoke<VoiceChannel*>( 218 return worker_thread_->Invoke<VoiceChannel*>(
219 RTC_FROM_HERE, 219 RTC_FROM_HERE,
220 Bind(&ChannelManager::CreateVoiceChannel_w, this, media_controller, 220 Bind(&ChannelManager::CreateVoiceChannel_w, this, media_controller,
221 rtp_transport, rtcp_transport, signaling_thread, content_name, 221 rtp_transport, rtcp_transport, signaling_thread, content_name,
222 bundle_transport_name, rtcp, srtp_required, options)); 222 bundle_transport_name, rtcp_mux_required, srtp_required, options));
223 } 223 }
224 224
225 VoiceChannel* ChannelManager::CreateVoiceChannel_w( 225 VoiceChannel* ChannelManager::CreateVoiceChannel_w(
226 webrtc::MediaControllerInterface* media_controller, 226 webrtc::MediaControllerInterface* media_controller,
227 TransportChannel* rtp_transport, 227 TransportChannel* rtp_transport,
228 TransportChannel* rtcp_transport, 228 TransportChannel* rtcp_transport,
229 rtc::Thread* signaling_thread, 229 rtc::Thread* signaling_thread,
230 const std::string& content_name, 230 const std::string& content_name,
231 const std::string* bundle_transport_name, 231 const std::string* bundle_transport_name,
232 bool rtcp, 232 bool rtcp_mux_required,
233 bool srtp_required, 233 bool srtp_required,
234 const AudioOptions& options) { 234 const AudioOptions& options) {
235 RTC_DCHECK(initialized_); 235 RTC_DCHECK(initialized_);
236 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); 236 RTC_DCHECK(worker_thread_ == rtc::Thread::Current());
237 RTC_DCHECK(nullptr != media_controller); 237 RTC_DCHECK(nullptr != media_controller);
238 238
239 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( 239 VoiceMediaChannel* media_channel = media_engine_->CreateChannel(
240 media_controller->call_w(), media_controller->config(), options); 240 media_controller->call_w(), media_controller->config(), options);
241 if (!media_channel) 241 if (!media_channel)
242 return nullptr; 242 return nullptr;
243 243
244 VoiceChannel* voice_channel = new VoiceChannel( 244 VoiceChannel* voice_channel = new VoiceChannel(
245 worker_thread_, network_thread_, signaling_thread, media_engine_.get(), 245 worker_thread_, network_thread_, signaling_thread, media_engine_.get(),
246 media_channel, content_name, rtcp, srtp_required); 246 media_channel, content_name, rtcp_mux_required, srtp_required);
247 voice_channel->SetCryptoOptions(crypto_options_); 247 voice_channel->SetCryptoOptions(crypto_options_);
248 248
249 if (!voice_channel->Init_w(rtp_transport, rtcp_transport)) { 249 if (!voice_channel->Init_w(rtp_transport, rtcp_transport)) {
250 delete voice_channel; 250 delete voice_channel;
251 return nullptr; 251 return nullptr;
252 } 252 }
253 voice_channels_.push_back(voice_channel); 253 voice_channels_.push_back(voice_channel);
254 return voice_channel; 254 return voice_channel;
255 } 255 }
256 256
(...skipping 20 matching lines...) Expand all
277 delete voice_channel; 277 delete voice_channel;
278 } 278 }
279 279
280 VideoChannel* ChannelManager::CreateVideoChannel( 280 VideoChannel* ChannelManager::CreateVideoChannel(
281 webrtc::MediaControllerInterface* media_controller, 281 webrtc::MediaControllerInterface* media_controller,
282 TransportChannel* rtp_transport, 282 TransportChannel* rtp_transport,
283 TransportChannel* rtcp_transport, 283 TransportChannel* rtcp_transport,
284 rtc::Thread* signaling_thread, 284 rtc::Thread* signaling_thread,
285 const std::string& content_name, 285 const std::string& content_name,
286 const std::string* bundle_transport_name, 286 const std::string* bundle_transport_name,
287 bool rtcp, 287 bool rtcp_mux_required,
288 bool srtp_required, 288 bool srtp_required,
289 const VideoOptions& options) { 289 const VideoOptions& options) {
290 return worker_thread_->Invoke<VideoChannel*>( 290 return worker_thread_->Invoke<VideoChannel*>(
291 RTC_FROM_HERE, 291 RTC_FROM_HERE,
292 Bind(&ChannelManager::CreateVideoChannel_w, this, media_controller, 292 Bind(&ChannelManager::CreateVideoChannel_w, this, media_controller,
293 rtp_transport, rtcp_transport, signaling_thread, content_name, 293 rtp_transport, rtcp_transport, signaling_thread, content_name,
294 bundle_transport_name, rtcp, srtp_required, options)); 294 bundle_transport_name, rtcp_mux_required, srtp_required, options));
295 } 295 }
296 296
297 VideoChannel* ChannelManager::CreateVideoChannel_w( 297 VideoChannel* ChannelManager::CreateVideoChannel_w(
298 webrtc::MediaControllerInterface* media_controller, 298 webrtc::MediaControllerInterface* media_controller,
299 TransportChannel* rtp_transport, 299 TransportChannel* rtp_transport,
300 TransportChannel* rtcp_transport, 300 TransportChannel* rtcp_transport,
301 rtc::Thread* signaling_thread, 301 rtc::Thread* signaling_thread,
302 const std::string& content_name, 302 const std::string& content_name,
303 const std::string* bundle_transport_name, 303 const std::string* bundle_transport_name,
304 bool rtcp, 304 bool rtcp_mux_required,
305 bool srtp_required, 305 bool srtp_required,
306 const VideoOptions& options) { 306 const VideoOptions& options) {
307 RTC_DCHECK(initialized_); 307 RTC_DCHECK(initialized_);
308 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); 308 RTC_DCHECK(worker_thread_ == rtc::Thread::Current());
309 RTC_DCHECK(nullptr != media_controller); 309 RTC_DCHECK(nullptr != media_controller);
310 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( 310 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel(
311 media_controller->call_w(), media_controller->config(), options); 311 media_controller->call_w(), media_controller->config(), options);
312 if (media_channel == NULL) { 312 if (media_channel == NULL) {
313 return NULL; 313 return NULL;
314 } 314 }
315 315
316 VideoChannel* video_channel = 316 VideoChannel* video_channel = new VideoChannel(
317 new VideoChannel(worker_thread_, network_thread_, signaling_thread, 317 worker_thread_, network_thread_, signaling_thread, media_channel,
318 media_channel, content_name, rtcp, srtp_required); 318 content_name, rtcp_mux_required, srtp_required);
319 video_channel->SetCryptoOptions(crypto_options_); 319 video_channel->SetCryptoOptions(crypto_options_);
320 if (!video_channel->Init_w(rtp_transport, rtcp_transport)) { 320 if (!video_channel->Init_w(rtp_transport, rtcp_transport)) {
321 delete video_channel; 321 delete video_channel;
322 return NULL; 322 return NULL;
323 } 323 }
324 video_channels_.push_back(video_channel); 324 video_channels_.push_back(video_channel);
325 return video_channel; 325 return video_channel;
326 } 326 }
327 327
328 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { 328 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) {
(...skipping 20 matching lines...) Expand all
349 delete video_channel; 349 delete video_channel;
350 } 350 }
351 351
352 RtpDataChannel* ChannelManager::CreateRtpDataChannel( 352 RtpDataChannel* ChannelManager::CreateRtpDataChannel(
353 webrtc::MediaControllerInterface* media_controller, 353 webrtc::MediaControllerInterface* media_controller,
354 TransportChannel* rtp_transport, 354 TransportChannel* rtp_transport,
355 TransportChannel* rtcp_transport, 355 TransportChannel* rtcp_transport,
356 rtc::Thread* signaling_thread, 356 rtc::Thread* signaling_thread,
357 const std::string& content_name, 357 const std::string& content_name,
358 const std::string* bundle_transport_name, 358 const std::string* bundle_transport_name,
359 bool rtcp, 359 bool rtcp_mux_required,
360 bool srtp_required) { 360 bool srtp_required) {
361 return worker_thread_->Invoke<RtpDataChannel*>( 361 return worker_thread_->Invoke<RtpDataChannel*>(
362 RTC_FROM_HERE, 362 RTC_FROM_HERE,
363 Bind(&ChannelManager::CreateRtpDataChannel_w, this, media_controller, 363 Bind(&ChannelManager::CreateRtpDataChannel_w, this, media_controller,
364 rtp_transport, rtcp_transport, signaling_thread, content_name, 364 rtp_transport, rtcp_transport, signaling_thread, content_name,
365 bundle_transport_name, rtcp, srtp_required)); 365 bundle_transport_name, rtcp_mux_required, srtp_required));
366 } 366 }
367 367
368 RtpDataChannel* ChannelManager::CreateRtpDataChannel_w( 368 RtpDataChannel* ChannelManager::CreateRtpDataChannel_w(
369 webrtc::MediaControllerInterface* media_controller, 369 webrtc::MediaControllerInterface* media_controller,
370 TransportChannel* rtp_transport, 370 TransportChannel* rtp_transport,
371 TransportChannel* rtcp_transport, 371 TransportChannel* rtcp_transport,
372 rtc::Thread* signaling_thread, 372 rtc::Thread* signaling_thread,
373 const std::string& content_name, 373 const std::string& content_name,
374 const std::string* bundle_transport_name, 374 const std::string* bundle_transport_name,
375 bool rtcp, 375 bool rtcp_mux_required,
376 bool srtp_required) { 376 bool srtp_required) {
377 // 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.
378 RTC_DCHECK(initialized_); 378 RTC_DCHECK(initialized_);
379 MediaConfig config; 379 MediaConfig config;
380 if (media_controller) { 380 if (media_controller) {
381 config = media_controller->config(); 381 config = media_controller->config();
382 } 382 }
383 DataMediaChannel* media_channel = data_media_engine_->CreateChannel(config); 383 DataMediaChannel* media_channel = data_media_engine_->CreateChannel(config);
384 if (!media_channel) { 384 if (!media_channel) {
385 LOG(LS_WARNING) << "Failed to create RTP data channel."; 385 LOG(LS_WARNING) << "Failed to create RTP data channel.";
386 return nullptr; 386 return nullptr;
387 } 387 }
388 388
389 RtpDataChannel* data_channel = 389 RtpDataChannel* data_channel = new RtpDataChannel(
390 new RtpDataChannel(worker_thread_, network_thread_, signaling_thread, 390 worker_thread_, network_thread_, signaling_thread, media_channel,
391 media_channel, content_name, rtcp, srtp_required); 391 content_name, rtcp_mux_required, srtp_required);
392 data_channel->SetCryptoOptions(crypto_options_); 392 data_channel->SetCryptoOptions(crypto_options_);
393 if (!data_channel->Init_w(rtp_transport, rtcp_transport)) { 393 if (!data_channel->Init_w(rtp_transport, rtcp_transport)) {
394 LOG(LS_WARNING) << "Failed to init data channel."; 394 LOG(LS_WARNING) << "Failed to init data channel.";
395 delete data_channel; 395 delete data_channel;
396 return nullptr; 396 return nullptr;
397 } 397 }
398 data_channels_.push_back(data_channel); 398 data_channels_.push_back(data_channel);
399 return data_channel; 399 return data_channel;
400 } 400 }
401 401
(...skipping 27 matching lines...) Expand all
429 media_engine_.get(), file, max_size_bytes)); 429 media_engine_.get(), file, max_size_bytes));
430 } 430 }
431 431
432 void ChannelManager::StopAecDump() { 432 void ChannelManager::StopAecDump() {
433 worker_thread_->Invoke<void>( 433 worker_thread_->Invoke<void>(
434 RTC_FROM_HERE, 434 RTC_FROM_HERE,
435 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); 435 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get()));
436 } 436 }
437 437
438 } // namespace cricket 438 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/pc/channelmanager.h ('k') | webrtc/pc/channelmanager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698