OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 event_log_->LogAudioSendStreamConfig(config); | 400 event_log_->LogAudioSendStreamConfig(config); |
401 AudioSendStream* send_stream = new AudioSendStream( | 401 AudioSendStream* send_stream = new AudioSendStream( |
402 config, config_.audio_state, &worker_queue_, congestion_controller_.get(), | 402 config, config_.audio_state, &worker_queue_, congestion_controller_.get(), |
403 bitrate_allocator_.get(), event_log_); | 403 bitrate_allocator_.get(), event_log_); |
404 { | 404 { |
405 WriteLockScoped write_lock(*send_crit_); | 405 WriteLockScoped write_lock(*send_crit_); |
406 RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) == | 406 RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) == |
407 audio_send_ssrcs_.end()); | 407 audio_send_ssrcs_.end()); |
408 audio_send_ssrcs_[config.rtp.ssrc] = send_stream; | 408 audio_send_ssrcs_[config.rtp.ssrc] = send_stream; |
409 } | 409 } |
410 { | |
411 ReadLockScoped read_lock(*receive_crit_); | |
412 for (const auto& kv : audio_receive_ssrcs_) { | |
413 if (kv.second->config().rtp.local_ssrc == config.rtp.ssrc) { | |
414 kv.second->AssociateSendStream(send_stream); | |
415 } | |
416 } | |
417 } | |
410 send_stream->SignalNetworkState(audio_network_state_); | 418 send_stream->SignalNetworkState(audio_network_state_); |
411 UpdateAggregateNetworkState(); | 419 UpdateAggregateNetworkState(); |
412 return send_stream; | 420 return send_stream; |
413 } | 421 } |
414 | 422 |
415 void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) { | 423 void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) { |
416 TRACE_EVENT0("webrtc", "Call::DestroyAudioSendStream"); | 424 TRACE_EVENT0("webrtc", "Call::DestroyAudioSendStream"); |
417 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 425 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
418 RTC_DCHECK(send_stream != nullptr); | 426 RTC_DCHECK(send_stream != nullptr); |
419 | 427 |
420 send_stream->Stop(); | 428 send_stream->Stop(); |
421 | 429 |
422 webrtc::internal::AudioSendStream* audio_send_stream = | 430 webrtc::internal::AudioSendStream* audio_send_stream = |
423 static_cast<webrtc::internal::AudioSendStream*>(send_stream); | 431 static_cast<webrtc::internal::AudioSendStream*>(send_stream); |
432 uint32_t ssrc = audio_send_stream->config().rtp.ssrc; | |
kwiberg-webrtc
2016/11/11 13:47:40
const?
the sun
2016/11/11 20:03:39
Hmm, why here, in particular, and not on every loc
kwiberg-webrtc
2016/11/13 20:17:02
I try to complain in pretty much all such cases, y
the sun
2016/11/14 18:58:06
In the name of consistency with surrounding code I
kwiberg-webrtc
2016/11/15 05:05:02
I don't think the style guide takes a position on
| |
424 { | 433 { |
425 WriteLockScoped write_lock(*send_crit_); | 434 WriteLockScoped write_lock(*send_crit_); |
426 size_t num_deleted = audio_send_ssrcs_.erase( | 435 size_t num_deleted = audio_send_ssrcs_.erase(ssrc); |
427 audio_send_stream->config().rtp.ssrc); | |
428 RTC_DCHECK(num_deleted == 1); | 436 RTC_DCHECK(num_deleted == 1); |
kwiberg-webrtc
2016/11/11 13:47:39
RTC_DCHECK_EQ
the sun
2016/11/11 20:03:39
Done.
| |
429 } | 437 } |
438 { | |
439 ReadLockScoped read_lock(*receive_crit_); | |
440 for (const auto& kv : audio_receive_ssrcs_) { | |
441 if (kv.second->config().rtp.local_ssrc == ssrc) { | |
442 kv.second->AssociateSendStream(nullptr); | |
443 } | |
444 } | |
445 } | |
430 UpdateAggregateNetworkState(); | 446 UpdateAggregateNetworkState(); |
431 delete audio_send_stream; | 447 delete audio_send_stream; |
432 } | 448 } |
433 | 449 |
434 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( | 450 webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream( |
435 const webrtc::AudioReceiveStream::Config& config) { | 451 const webrtc::AudioReceiveStream::Config& config) { |
436 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); | 452 TRACE_EVENT0("webrtc", "Call::CreateAudioReceiveStream"); |
437 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 453 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
438 event_log_->LogAudioReceiveStreamConfig(config); | 454 event_log_->LogAudioReceiveStreamConfig(config); |
439 AudioReceiveStream* receive_stream = new AudioReceiveStream( | 455 AudioReceiveStream* receive_stream = new AudioReceiveStream( |
440 congestion_controller_.get(), config, config_.audio_state, event_log_); | 456 congestion_controller_.get(), config, config_.audio_state, event_log_); |
441 { | 457 { |
442 WriteLockScoped write_lock(*receive_crit_); | 458 WriteLockScoped write_lock(*receive_crit_); |
443 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == | 459 RTC_DCHECK(audio_receive_ssrcs_.find(config.rtp.remote_ssrc) == |
444 audio_receive_ssrcs_.end()); | 460 audio_receive_ssrcs_.end()); |
445 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; | 461 audio_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; |
446 ConfigureSync(config.sync_group); | 462 ConfigureSync(config.sync_group); |
447 } | 463 } |
464 { | |
465 ReadLockScoped read_lock(*send_crit_); | |
466 auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc); | |
467 if (it != audio_send_ssrcs_.end()) { | |
468 receive_stream->AssociateSendStream(it->second); | |
469 } | |
470 } | |
448 receive_stream->SignalNetworkState(audio_network_state_); | 471 receive_stream->SignalNetworkState(audio_network_state_); |
449 UpdateAggregateNetworkState(); | 472 UpdateAggregateNetworkState(); |
450 return receive_stream; | 473 return receive_stream; |
451 } | 474 } |
452 | 475 |
453 void Call::DestroyAudioReceiveStream( | 476 void Call::DestroyAudioReceiveStream( |
454 webrtc::AudioReceiveStream* receive_stream) { | 477 webrtc::AudioReceiveStream* receive_stream) { |
455 TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream"); | 478 TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream"); |
456 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); | 479 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); |
457 RTC_DCHECK(receive_stream != nullptr); | 480 RTC_DCHECK(receive_stream != nullptr); |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1064 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); | 1087 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); |
1065 ReadLockScoped read_lock(*receive_crit_); | 1088 ReadLockScoped read_lock(*receive_crit_); |
1066 auto it = video_receive_ssrcs_.find(ssrc); | 1089 auto it = video_receive_ssrcs_.find(ssrc); |
1067 if (it == video_receive_ssrcs_.end()) | 1090 if (it == video_receive_ssrcs_.end()) |
1068 return false; | 1091 return false; |
1069 return it->second->OnRecoveredPacket(packet, length); | 1092 return it->second->OnRecoveredPacket(packet, length); |
1070 } | 1093 } |
1071 | 1094 |
1072 } // namespace internal | 1095 } // namespace internal |
1073 } // namespace webrtc | 1096 } // namespace webrtc |
OLD | NEW |