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

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

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

Powered by Google App Engine
This is Rietveld 408576698