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

Side by Side Diff: webrtc/call/call.cc

Issue 2887733002: Store/restore RTP state for audio streams with same SSRC within a call (Closed)
Patch Set: Turned the MockRtpRtcps into NiceMocks so memcheck doesn't complain. Created 3 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 (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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 }; 244 };
245 std::map<uint32_t, ReceiveRtpConfig> receive_rtp_config_ 245 std::map<uint32_t, ReceiveRtpConfig> receive_rtp_config_
246 GUARDED_BY(receive_crit_); 246 GUARDED_BY(receive_crit_);
247 247
248 std::unique_ptr<RWLockWrapper> send_crit_; 248 std::unique_ptr<RWLockWrapper> send_crit_;
249 // Audio and Video send streams are owned by the client that creates them. 249 // Audio and Video send streams are owned by the client that creates them.
250 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); 250 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_);
251 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); 251 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_);
252 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); 252 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_);
253 253
254 VideoSendStream::RtpStateMap suspended_video_send_ssrcs_; 254 typedef std::map<uint32_t, RtpState> RtpStateMap;
pbos-webrtc 2017/05/22 15:40:18 Does this mean that there's some VideoSendStream::
ossu 2017/05/22 17:13:59 I chose to let RtpStateMap be a shorthand for std:
kwiberg-webrtc 2017/05/19 01:05:09 using?
ossu 2017/05/22 17:13:59 Alright!
255 RtpStateMap suspended_audio_send_ssrcs_;
pbos-webrtc 2017/05/22 15:39:50 Can you do GUARDED_BY (configuration_thread_checke
ossu 2017/05/22 17:13:59 Alright!
256 RtpStateMap suspended_video_send_ssrcs_;
257
255 webrtc::RtcEventLog* event_log_; 258 webrtc::RtcEventLog* event_log_;
256 259
257 // The following members are only accessed (exclusively) from one thread and 260 // The following members are only accessed (exclusively) from one thread and
258 // from the destructor, and therefore doesn't need any explicit 261 // from the destructor, and therefore doesn't need any explicit
259 // synchronization. 262 // synchronization.
260 RateCounter received_bytes_per_second_counter_; 263 RateCounter received_bytes_per_second_counter_;
261 RateCounter received_audio_bytes_per_second_counter_; 264 RateCounter received_audio_bytes_per_second_counter_;
262 RateCounter received_video_bytes_per_second_counter_; 265 RateCounter received_video_bytes_per_second_counter_;
263 RateCounter received_rtcp_bytes_per_second_counter_; 266 RateCounter received_rtcp_bytes_per_second_counter_;
264 267
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // thread. Re-enable once that is fixed. 505 // thread. Re-enable once that is fixed.
503 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 506 // RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
504 return this; 507 return this;
505 } 508 }
506 509
507 webrtc::AudioSendStream* Call::CreateAudioSendStream( 510 webrtc::AudioSendStream* Call::CreateAudioSendStream(
508 const webrtc::AudioSendStream::Config& config) { 511 const webrtc::AudioSendStream::Config& config) {
509 TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream"); 512 TRACE_EVENT0("webrtc", "Call::CreateAudioSendStream");
510 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 513 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
511 event_log_->LogAudioSendStreamConfig(config); 514 event_log_->LogAudioSendStreamConfig(config);
515
516 rtc::Optional<RtpState> suspended_rtp_state;
517 {
518 const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc);
519 if (iter != suspended_audio_send_ssrcs_.end()) {
520 suspended_rtp_state.emplace(iter->second);
521 }
522 }
523
512 AudioSendStream* send_stream = new AudioSendStream( 524 AudioSendStream* send_stream = new AudioSendStream(
513 config, config_.audio_state, &worker_queue_, transport_send_.get(), 525 config, config_.audio_state, &worker_queue_, transport_send_.get(),
514 bitrate_allocator_.get(), event_log_, call_stats_->rtcp_rtt_stats()); 526 bitrate_allocator_.get(), event_log_, call_stats_->rtcp_rtt_stats(),
527 suspended_rtp_state);
515 { 528 {
516 WriteLockScoped write_lock(*send_crit_); 529 WriteLockScoped write_lock(*send_crit_);
517 RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) == 530 RTC_DCHECK(audio_send_ssrcs_.find(config.rtp.ssrc) ==
518 audio_send_ssrcs_.end()); 531 audio_send_ssrcs_.end());
519 audio_send_ssrcs_[config.rtp.ssrc] = send_stream; 532 audio_send_ssrcs_[config.rtp.ssrc] = send_stream;
520 } 533 }
521 { 534 {
522 ReadLockScoped read_lock(*receive_crit_); 535 ReadLockScoped read_lock(*receive_crit_);
523 for (const auto& kv : audio_receive_ssrcs_) { 536 for (const auto& kv : audio_receive_ssrcs_) {
524 if (kv.second->config().rtp.local_ssrc == config.rtp.ssrc) { 537 if (kv.second->config().rtp.local_ssrc == config.rtp.ssrc) {
525 kv.second->AssociateSendStream(send_stream); 538 kv.second->AssociateSendStream(send_stream);
526 } 539 }
527 } 540 }
528 } 541 }
529 send_stream->SignalNetworkState(audio_network_state_); 542 send_stream->SignalNetworkState(audio_network_state_);
530 UpdateAggregateNetworkState(); 543 UpdateAggregateNetworkState();
531 return send_stream; 544 return send_stream;
532 } 545 }
533 546
534 void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) { 547 void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) {
535 TRACE_EVENT0("webrtc", "Call::DestroyAudioSendStream"); 548 TRACE_EVENT0("webrtc", "Call::DestroyAudioSendStream");
536 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 549 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
537 RTC_DCHECK(send_stream != nullptr); 550 RTC_DCHECK(send_stream != nullptr);
538 551
539 send_stream->Stop(); 552 send_stream->Stop();
540 553
541 webrtc::internal::AudioSendStream* audio_send_stream = 554 webrtc::internal::AudioSendStream* audio_send_stream =
542 static_cast<webrtc::internal::AudioSendStream*>(send_stream); 555 static_cast<webrtc::internal::AudioSendStream*>(send_stream);
543 uint32_t ssrc = audio_send_stream->config().rtp.ssrc; 556 const uint32_t ssrc = audio_send_stream->config().rtp.ssrc;
557 suspended_audio_send_ssrcs_[ssrc] = audio_send_stream->GetRtpState();
544 { 558 {
545 WriteLockScoped write_lock(*send_crit_); 559 WriteLockScoped write_lock(*send_crit_);
546 size_t num_deleted = audio_send_ssrcs_.erase(ssrc); 560 size_t num_deleted = audio_send_ssrcs_.erase(ssrc);
547 RTC_DCHECK_EQ(1, num_deleted); 561 RTC_DCHECK_EQ(1, num_deleted);
548 } 562 }
549 { 563 {
550 ReadLockScoped read_lock(*receive_crit_); 564 ReadLockScoped read_lock(*receive_crit_);
551 for (const auto& kv : audio_receive_ssrcs_) { 565 for (const auto& kv : audio_receive_ssrcs_) {
552 if (kv.second->config().rtp.local_ssrc == ssrc) { 566 if (kv.second->config().rtp.local_ssrc == ssrc) {
553 kv.second->AssociateSendStream(nullptr); 567 kv.second->AssociateSendStream(nullptr);
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { 1309 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) {
1296 receive_side_cc_.OnReceivedPacket( 1310 receive_side_cc_.OnReceivedPacket(
1297 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), 1311 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(),
1298 header); 1312 header);
1299 } 1313 }
1300 } 1314 }
1301 1315
1302 } // namespace internal 1316 } // namespace internal
1303 1317
1304 } // namespace webrtc 1318 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698