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

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

Issue 2537343003: Removing "crypto_required" from MediaContentDescription. (Closed)
Patch Set: Responding to comments (mostly just renaming) Created 4 years 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 DestroyVoiceChannel_w(voice_channels_.back()); 211 DestroyVoiceChannel_w(voice_channels_.back());
212 } 212 }
213 } 213 }
214 214
215 VoiceChannel* ChannelManager::CreateVoiceChannel( 215 VoiceChannel* ChannelManager::CreateVoiceChannel(
216 webrtc::MediaControllerInterface* media_controller, 216 webrtc::MediaControllerInterface* media_controller,
217 TransportController* transport_controller, 217 TransportController* transport_controller,
218 const std::string& content_name, 218 const std::string& content_name,
219 const std::string* bundle_transport_name, 219 const std::string* bundle_transport_name,
220 bool rtcp, 220 bool rtcp,
221 bool srtp_required,
221 const AudioOptions& options) { 222 const AudioOptions& options) {
222 return worker_thread_->Invoke<VoiceChannel*>( 223 return worker_thread_->Invoke<VoiceChannel*>(
223 RTC_FROM_HERE, Bind(&ChannelManager::CreateVoiceChannel_w, this, 224 RTC_FROM_HERE, Bind(&ChannelManager::CreateVoiceChannel_w, this,
224 media_controller, transport_controller, content_name, 225 media_controller, transport_controller, content_name,
225 bundle_transport_name, rtcp, options)); 226 bundle_transport_name, rtcp, srtp_required, options));
226 } 227 }
227 228
228 VoiceChannel* ChannelManager::CreateVoiceChannel_w( 229 VoiceChannel* ChannelManager::CreateVoiceChannel_w(
229 webrtc::MediaControllerInterface* media_controller, 230 webrtc::MediaControllerInterface* media_controller,
230 TransportController* transport_controller, 231 TransportController* transport_controller,
231 const std::string& content_name, 232 const std::string& content_name,
232 const std::string* bundle_transport_name, 233 const std::string* bundle_transport_name,
233 bool rtcp, 234 bool rtcp,
235 bool srtp_required,
234 const AudioOptions& options) { 236 const AudioOptions& options) {
235 ASSERT(initialized_); 237 ASSERT(initialized_);
236 ASSERT(worker_thread_ == rtc::Thread::Current()); 238 ASSERT(worker_thread_ == rtc::Thread::Current());
237 ASSERT(nullptr != media_controller); 239 ASSERT(nullptr != media_controller);
238 VoiceMediaChannel* media_channel = media_engine_->CreateChannel( 240 VoiceMediaChannel* media_channel = media_engine_->CreateChannel(
239 media_controller->call_w(), media_controller->config(), options); 241 media_controller->call_w(), media_controller->config(), options);
240 if (!media_channel) 242 if (!media_channel)
241 return nullptr; 243 return nullptr;
242 244
243 VoiceChannel* voice_channel = 245 VoiceChannel* voice_channel = new VoiceChannel(
244 new VoiceChannel(worker_thread_, network_thread_, media_engine_.get(), 246 worker_thread_, network_thread_, media_engine_.get(), media_channel,
245 media_channel, transport_controller, content_name, rtcp); 247 transport_controller, content_name, rtcp, srtp_required);
246 voice_channel->SetCryptoOptions(crypto_options_); 248 voice_channel->SetCryptoOptions(crypto_options_);
247 if (!voice_channel->Init_w(bundle_transport_name)) { 249 if (!voice_channel->Init_w(bundle_transport_name)) {
248 delete voice_channel; 250 delete voice_channel;
249 return nullptr; 251 return nullptr;
250 } 252 }
251 voice_channels_.push_back(voice_channel); 253 voice_channels_.push_back(voice_channel);
252 return voice_channel; 254 return voice_channel;
253 } 255 }
254 256
255 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) { 257 void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) {
(...skipping 18 matching lines...) Expand all
274 voice_channels_.erase(it); 276 voice_channels_.erase(it);
275 delete voice_channel; 277 delete voice_channel;
276 } 278 }
277 279
278 VideoChannel* ChannelManager::CreateVideoChannel( 280 VideoChannel* ChannelManager::CreateVideoChannel(
279 webrtc::MediaControllerInterface* media_controller, 281 webrtc::MediaControllerInterface* media_controller,
280 TransportController* transport_controller, 282 TransportController* transport_controller,
281 const std::string& content_name, 283 const std::string& content_name,
282 const std::string* bundle_transport_name, 284 const std::string* bundle_transport_name,
283 bool rtcp, 285 bool rtcp,
286 bool srtp_required,
284 const VideoOptions& options) { 287 const VideoOptions& options) {
285 return worker_thread_->Invoke<VideoChannel*>( 288 return worker_thread_->Invoke<VideoChannel*>(
286 RTC_FROM_HERE, Bind(&ChannelManager::CreateVideoChannel_w, this, 289 RTC_FROM_HERE, Bind(&ChannelManager::CreateVideoChannel_w, this,
287 media_controller, transport_controller, content_name, 290 media_controller, transport_controller, content_name,
288 bundle_transport_name, rtcp, options)); 291 bundle_transport_name, rtcp, srtp_required, options));
289 } 292 }
290 293
291 VideoChannel* ChannelManager::CreateVideoChannel_w( 294 VideoChannel* ChannelManager::CreateVideoChannel_w(
292 webrtc::MediaControllerInterface* media_controller, 295 webrtc::MediaControllerInterface* media_controller,
293 TransportController* transport_controller, 296 TransportController* transport_controller,
294 const std::string& content_name, 297 const std::string& content_name,
295 const std::string* bundle_transport_name, 298 const std::string* bundle_transport_name,
296 bool rtcp, 299 bool rtcp,
300 bool srtp_required,
297 const VideoOptions& options) { 301 const VideoOptions& options) {
298 ASSERT(initialized_); 302 ASSERT(initialized_);
299 ASSERT(worker_thread_ == rtc::Thread::Current()); 303 ASSERT(worker_thread_ == rtc::Thread::Current());
300 ASSERT(nullptr != media_controller); 304 ASSERT(nullptr != media_controller);
301 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel( 305 VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel(
302 media_controller->call_w(), media_controller->config(), options); 306 media_controller->call_w(), media_controller->config(), options);
303 if (media_channel == NULL) { 307 if (media_channel == NULL) {
304 return NULL; 308 return NULL;
305 } 309 }
306 310
307 VideoChannel* video_channel = 311 VideoChannel* video_channel =
308 new VideoChannel(worker_thread_, network_thread_, media_channel, 312 new VideoChannel(worker_thread_, network_thread_, media_channel,
309 transport_controller, content_name, rtcp); 313 transport_controller, content_name, rtcp, srtp_required);
310 video_channel->SetCryptoOptions(crypto_options_); 314 video_channel->SetCryptoOptions(crypto_options_);
311 if (!video_channel->Init_w(bundle_transport_name)) { 315 if (!video_channel->Init_w(bundle_transport_name)) {
312 delete video_channel; 316 delete video_channel;
313 return NULL; 317 return NULL;
314 } 318 }
315 video_channels_.push_back(video_channel); 319 video_channels_.push_back(video_channel);
316 return video_channel; 320 return video_channel;
317 } 321 }
318 322
319 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) { 323 void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) {
(...skipping 18 matching lines...) Expand all
338 342
339 video_channels_.erase(it); 343 video_channels_.erase(it);
340 delete video_channel; 344 delete video_channel;
341 } 345 }
342 346
343 DataChannel* ChannelManager::CreateDataChannel( 347 DataChannel* ChannelManager::CreateDataChannel(
344 TransportController* transport_controller, 348 TransportController* transport_controller,
345 const std::string& content_name, 349 const std::string& content_name,
346 const std::string* bundle_transport_name, 350 const std::string* bundle_transport_name,
347 bool rtcp, 351 bool rtcp,
352 bool srtp_required,
348 DataChannelType channel_type) { 353 DataChannelType channel_type) {
349 return worker_thread_->Invoke<DataChannel*>( 354 return worker_thread_->Invoke<DataChannel*>(
350 RTC_FROM_HERE, 355 RTC_FROM_HERE,
351 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller, 356 Bind(&ChannelManager::CreateDataChannel_w, this, transport_controller,
352 content_name, bundle_transport_name, rtcp, channel_type)); 357 content_name, bundle_transport_name, rtcp, srtp_required,
358 channel_type));
353 } 359 }
354 360
355 DataChannel* ChannelManager::CreateDataChannel_w( 361 DataChannel* ChannelManager::CreateDataChannel_w(
356 TransportController* transport_controller, 362 TransportController* transport_controller,
357 const std::string& content_name, 363 const std::string& content_name,
358 const std::string* bundle_transport_name, 364 const std::string* bundle_transport_name,
359 bool rtcp, 365 bool rtcp,
366 bool srtp_required,
360 DataChannelType data_channel_type) { 367 DataChannelType data_channel_type) {
361 // This is ok to alloc from a thread other than the worker thread. 368 // This is ok to alloc from a thread other than the worker thread.
362 ASSERT(initialized_); 369 ASSERT(initialized_);
363 DataMediaChannel* media_channel = data_media_engine_->CreateChannel( 370 DataMediaChannel* media_channel = data_media_engine_->CreateChannel(
364 data_channel_type); 371 data_channel_type);
365 if (!media_channel) { 372 if (!media_channel) {
366 LOG(LS_WARNING) << "Failed to create data channel of type " 373 LOG(LS_WARNING) << "Failed to create data channel of type "
367 << data_channel_type; 374 << data_channel_type;
368 return NULL; 375 return NULL;
369 } 376 }
370 377
378 // Only RTP data channels need SRTP.
379 srtp_required = srtp_required && data_channel_type == DCT_RTP;
371 DataChannel* data_channel = 380 DataChannel* data_channel =
372 new DataChannel(worker_thread_, network_thread_, media_channel, 381 new DataChannel(worker_thread_, network_thread_, media_channel,
373 transport_controller, content_name, rtcp); 382 transport_controller, content_name, rtcp, srtp_required);
374 data_channel->SetCryptoOptions(crypto_options_); 383 data_channel->SetCryptoOptions(crypto_options_);
375 if (!data_channel->Init_w(bundle_transport_name)) { 384 if (!data_channel->Init_w(bundle_transport_name)) {
376 LOG(LS_WARNING) << "Failed to init data channel."; 385 LOG(LS_WARNING) << "Failed to init data channel.";
377 delete data_channel; 386 delete data_channel;
378 return NULL; 387 return NULL;
379 } 388 }
380 data_channels_.push_back(data_channel); 389 data_channels_.push_back(data_channel);
381 return data_channel; 390 return data_channel;
382 } 391 }
383 392
(...skipping 27 matching lines...) Expand all
411 media_engine_.get(), file, max_size_bytes)); 420 media_engine_.get(), file, max_size_bytes));
412 } 421 }
413 422
414 void ChannelManager::StopAecDump() { 423 void ChannelManager::StopAecDump() {
415 worker_thread_->Invoke<void>( 424 worker_thread_->Invoke<void>(
416 RTC_FROM_HERE, 425 RTC_FROM_HERE,
417 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); 426 Bind(&MediaEngineInterface::StopAecDump, media_engine_.get()));
418 } 427 }
419 428
420 } // namespace cricket 429 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698