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

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

Issue 1917793002: Remove SendPacer from ViEEncoder (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased 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 (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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } 659 }
660 660
661 void Call::OnSentPacket(const rtc::SentPacket& sent_packet) { 661 void Call::OnSentPacket(const rtc::SentPacket& sent_packet) {
662 if (first_packet_sent_ms_ == -1) 662 if (first_packet_sent_ms_ == -1)
663 first_packet_sent_ms_ = clock_->TimeInMilliseconds(); 663 first_packet_sent_ms_ = clock_->TimeInMilliseconds();
664 congestion_controller_->OnSentPacket(sent_packet); 664 congestion_controller_->OnSentPacket(sent_packet);
665 } 665 }
666 666
667 void Call::OnNetworkChanged(uint32_t target_bitrate_bps, uint8_t fraction_loss, 667 void Call::OnNetworkChanged(uint32_t target_bitrate_bps, uint8_t fraction_loss,
668 int64_t rtt_ms) { 668 int64_t rtt_ms) {
669 uint32_t allocated_bitrate_bps = bitrate_allocator_->OnNetworkChanged( 669 bitrate_allocator_->OnNetworkChanged(target_bitrate_bps, fraction_loss,
670 target_bitrate_bps, fraction_loss, rtt_ms); 670 rtt_ms);
671 671
672 int pad_up_to_bitrate_bps = 0; 672 int pad_up_to_bitrate_bps = 0;
673 { 673 {
674 ReadLockScoped read_lock(*send_crit_); 674 ReadLockScoped read_lock(*send_crit_);
675 // No need to update as long as we're not sending. 675 // No need to update as long as we're not sending.
676 if (video_send_streams_.empty()) 676 if (video_send_streams_.empty())
677 return; 677 return;
678 678
679 for (VideoSendStream* stream : video_send_streams_) 679 for (VideoSendStream* stream : video_send_streams_)
680 pad_up_to_bitrate_bps += stream->GetPaddingNeededBps(); 680 pad_up_to_bitrate_bps += stream->GetPaddingNeededBps();
681 } 681 }
682 // Allocated bitrate might be higher than bitrate estimate if enforcing min 682
683 // bitrate, or lower if estimate is higher than the sum of max bitrates, so 683 uint32_t min_send_bitrate = bitrate_allocator_->GetMinSendBitrate();
stefan-webrtc 2016/04/29 10:48:38 I think this can race with the call on 669. Probab
perkj_webrtc 2016/05/02 11:29:10 discussed off line. Reverting.
684 // set the pacer bitrate to the maximum of the two.
685 uint32_t pacer_bitrate_bps =
686 std::max(target_bitrate_bps, allocated_bitrate_bps);
687 { 684 {
688 rtc::CritScope lock(&bitrate_crit_); 685 rtc::CritScope lock(&bitrate_crit_);
689 // We only update these stats if we have send streams, and assume that 686 // We only update these stats if we have send streams, and assume that
690 // OnNetworkChanged is called roughly with a fixed frequency. 687 // OnNetworkChanged is called roughly with a fixed frequency.
691 estimated_send_bitrate_sum_kbits_ += target_bitrate_bps / 1000; 688 estimated_send_bitrate_sum_kbits_ += target_bitrate_bps / 1000;
692 pacer_bitrate_sum_kbits_ += pacer_bitrate_bps / 1000; 689
690 // Allocated bitrate might be higher than bitrate estimate if enforcing min
691 // bitrate, or lower if estimate is higher than the sum of max bitrates, so
692 // set the pacer bitrate to the maximum of the two.
693 pacer_bitrate_sum_kbits_ +=
694 std::max(target_bitrate_bps, min_send_bitrate) / 1000;
693 ++num_bitrate_updates_; 695 ++num_bitrate_updates_;
694 } 696 }
695 congestion_controller_->UpdatePacerBitrate( 697 congestion_controller_->UpdatePaddingBitrate(pad_up_to_bitrate_bps);
stefan-webrtc 2016/04/29 10:48:38 I think we still have to set the target_bitrate_bp
perkj_webrtc 2016/05/02 11:29:09 See new architecture.
696 target_bitrate_bps / 1000, 698
697 PacedSender::kDefaultPaceMultiplier * pacer_bitrate_bps / 1000, 699 // TODO(perkj): Refactor setting the minimum send bitrate.
698 pad_up_to_bitrate_bps / 1000); 700 // It changes when a stream is added or removed based on settings.
701 // Not when the network change.
702 congestion_controller_->SetMinimumSendBitrate(min_send_bitrate);
699 } 703 }
700 704
701 void Call::ConfigureSync(const std::string& sync_group) { 705 void Call::ConfigureSync(const std::string& sync_group) {
702 // Set sync only if there was no previous one. 706 // Set sync only if there was no previous one.
703 if (voice_engine() == nullptr || sync_group.empty()) 707 if (voice_engine() == nullptr || sync_group.empty())
704 return; 708 return;
705 709
706 AudioReceiveStream* sync_audio_stream = nullptr; 710 AudioReceiveStream* sync_audio_stream = nullptr;
707 // Find existing audio stream. 711 // Find existing audio stream.
708 const auto it = sync_stream_mapping_.find(sync_group); 712 const auto it = sync_stream_mapping_.find(sync_group);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 // thread. Then this check can be enabled. 837 // thread. Then this check can be enabled.
834 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); 838 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread());
835 if (RtpHeaderParser::IsRtcp(packet, length)) 839 if (RtpHeaderParser::IsRtcp(packet, length))
836 return DeliverRtcp(media_type, packet, length); 840 return DeliverRtcp(media_type, packet, length);
837 841
838 return DeliverRtp(media_type, packet, length, packet_time); 842 return DeliverRtp(media_type, packet, length, packet_time);
839 } 843 }
840 844
841 } // namespace internal 845 } // namespace internal
842 } // namespace webrtc 846 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698