| 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 #include "webrtc/video/video_send_stream.h" | 10 #include "webrtc/video/video_send_stream.h" |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <sstream> | 13 #include <sstream> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <utility> | 15 #include <utility> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/common_types.h" | 18 #include "webrtc/common_types.h" |
| 19 #include "webrtc/common_video/include/video_bitrate_allocator.h" |
| 19 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
| 20 #include "webrtc/base/file.h" | 21 #include "webrtc/base/file.h" |
| 21 #include "webrtc/base/logging.h" | 22 #include "webrtc/base/logging.h" |
| 22 #include "webrtc/base/trace_event.h" | 23 #include "webrtc/base/trace_event.h" |
| 23 #include "webrtc/base/weak_ptr.h" | 24 #include "webrtc/base/weak_ptr.h" |
| 24 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 25 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 25 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 26 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
| 26 #include "webrtc/modules/pacing/packet_router.h" | 27 #include "webrtc/modules/pacing/packet_router.h" |
| 27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 28 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
| 28 #include "webrtc/modules/utility/include/process_thread.h" | 29 #include "webrtc/modules/utility/include/process_thread.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 279 |
| 279 // VideoSendStreamImpl implements internal::VideoSendStream. | 280 // VideoSendStreamImpl implements internal::VideoSendStream. |
| 280 // It is created and destroyed on |worker_queue|. The intent is to decrease the | 281 // It is created and destroyed on |worker_queue|. The intent is to decrease the |
| 281 // need for locking and to ensure methods are called in sequence. | 282 // need for locking and to ensure methods are called in sequence. |
| 282 // Public methods except |DeliverRtcp| must be called on |worker_queue|. | 283 // Public methods except |DeliverRtcp| must be called on |worker_queue|. |
| 283 // DeliverRtcp is called on the libjingle worker thread or a network thread. | 284 // DeliverRtcp is called on the libjingle worker thread or a network thread. |
| 284 // An encoder may deliver frames through the EncodedImageCallback on an | 285 // An encoder may deliver frames through the EncodedImageCallback on an |
| 285 // arbitrary thread. | 286 // arbitrary thread. |
| 286 class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, | 287 class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver, |
| 287 public webrtc::VCMProtectionCallback, | 288 public webrtc::VCMProtectionCallback, |
| 288 public ViEEncoder::EncoderSink { | 289 public ViEEncoder::EncoderSink, |
| 290 public VideoBitrateAllocationObserver { |
| 289 public: | 291 public: |
| 290 VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, | 292 VideoSendStreamImpl(SendStatisticsProxy* stats_proxy, |
| 291 rtc::TaskQueue* worker_queue, | 293 rtc::TaskQueue* worker_queue, |
| 292 CallStats* call_stats, | 294 CallStats* call_stats, |
| 293 CongestionController* congestion_controller, | 295 CongestionController* congestion_controller, |
| 294 BitrateAllocator* bitrate_allocator, | 296 BitrateAllocator* bitrate_allocator, |
| 295 SendDelayStats* send_delay_stats, | 297 SendDelayStats* send_delay_stats, |
| 296 VieRemb* remb, | 298 VieRemb* remb, |
| 297 ViEEncoder* vie_encoder, | 299 ViEEncoder* vie_encoder, |
| 298 RtcEventLog* event_log, | 300 RtcEventLog* event_log, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 int min_transmit_bitrate_bps) override; | 343 int min_transmit_bitrate_bps) override; |
| 342 | 344 |
| 343 // Implements EncodedImageCallback. The implementation routes encoded frames | 345 // Implements EncodedImageCallback. The implementation routes encoded frames |
| 344 // to the |payload_router_| and |config.pre_encode_callback| if set. | 346 // to the |payload_router_| and |config.pre_encode_callback| if set. |
| 345 // Called on an arbitrary encoder callback thread. | 347 // Called on an arbitrary encoder callback thread. |
| 346 EncodedImageCallback::Result OnEncodedImage( | 348 EncodedImageCallback::Result OnEncodedImage( |
| 347 const EncodedImage& encoded_image, | 349 const EncodedImage& encoded_image, |
| 348 const CodecSpecificInfo* codec_specific_info, | 350 const CodecSpecificInfo* codec_specific_info, |
| 349 const RTPFragmentationHeader* fragmentation) override; | 351 const RTPFragmentationHeader* fragmentation) override; |
| 350 | 352 |
| 353 // Implements VideoBitrateAllocationObserver. |
| 354 void OnBitrateAllocationUpdated(const BitrateAllocation& allocation) override; |
| 355 |
| 351 void ConfigureProtection(); | 356 void ConfigureProtection(); |
| 352 void ConfigureSsrcs(); | 357 void ConfigureSsrcs(); |
| 353 void SignalEncoderTimedOut(); | 358 void SignalEncoderTimedOut(); |
| 354 void SignalEncoderActive(); | 359 void SignalEncoderActive(); |
| 355 | 360 |
| 356 SendStatisticsProxy* const stats_proxy_; | 361 SendStatisticsProxy* const stats_proxy_; |
| 357 const VideoSendStream::Config* const config_; | 362 const VideoSendStream::Config* const config_; |
| 358 std::map<uint32_t, RtpState> suspended_ssrcs_; | 363 std::map<uint32_t, RtpState> suspended_ssrcs_; |
| 359 | 364 |
| 360 ProcessThread* module_process_thread_; | 365 ProcessThread* module_process_thread_; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 const std::map<uint32_t, RtpState>& suspended_ssrcs) | 578 const std::map<uint32_t, RtpState>& suspended_ssrcs) |
| 574 : worker_queue_(worker_queue), | 579 : worker_queue_(worker_queue), |
| 575 thread_sync_event_(false /* manual_reset */, false), | 580 thread_sync_event_(false /* manual_reset */, false), |
| 576 stats_proxy_(Clock::GetRealTimeClock(), | 581 stats_proxy_(Clock::GetRealTimeClock(), |
| 577 config, | 582 config, |
| 578 encoder_config.content_type), | 583 encoder_config.content_type), |
| 579 config_(std::move(config)) { | 584 config_(std::move(config)) { |
| 580 vie_encoder_.reset(new ViEEncoder( | 585 vie_encoder_.reset(new ViEEncoder( |
| 581 num_cpu_cores, &stats_proxy_, config_.encoder_settings, | 586 num_cpu_cores, &stats_proxy_, config_.encoder_settings, |
| 582 config_.pre_encode_callback, config_.post_encode_callback)); | 587 config_.pre_encode_callback, config_.post_encode_callback)); |
| 583 | |
| 584 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( | 588 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( |
| 585 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), | 589 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), |
| 586 module_process_thread, call_stats, congestion_controller, | 590 module_process_thread, call_stats, congestion_controller, |
| 587 bitrate_allocator, send_delay_stats, remb, event_log, &config_, | 591 bitrate_allocator, send_delay_stats, remb, event_log, &config_, |
| 588 encoder_config.max_bitrate_bps, suspended_ssrcs))); | 592 encoder_config.max_bitrate_bps, suspended_ssrcs))); |
| 589 | 593 |
| 590 // Wait for ConstructionTask to complete so that |send_stream_| can be used. | 594 // Wait for ConstructionTask to complete so that |send_stream_| can be used. |
| 591 // |module_process_thread| must be registered and deregistered on the thread | 595 // |module_process_thread| must be registered and deregistered on the thread |
| 592 // it was created on. | 596 // it was created on. |
| 593 thread_sync_event_.Wait(rtc::Event::kForever); | 597 thread_sync_event_.Wait(rtc::Event::kForever); |
| 594 send_stream_->RegisterProcessThread(module_process_thread); | 598 send_stream_->RegisterProcessThread(module_process_thread); |
| 595 | 599 vie_encoder_->SetBitrateObserver(send_stream_.get()); |
| 596 vie_encoder_->RegisterProcessThread(module_process_thread); | 600 vie_encoder_->RegisterProcessThread(module_process_thread); |
| 597 | 601 |
| 598 ReconfigureVideoEncoder(std::move(encoder_config)); | 602 ReconfigureVideoEncoder(std::move(encoder_config)); |
| 599 } | 603 } |
| 600 | 604 |
| 601 VideoSendStream::~VideoSendStream() { | 605 VideoSendStream::~VideoSendStream() { |
| 602 RTC_DCHECK_RUN_ON(&thread_checker_); | 606 RTC_DCHECK_RUN_ON(&thread_checker_); |
| 603 RTC_DCHECK(!send_stream_); | 607 RTC_DCHECK(!send_stream_); |
| 604 } | 608 } |
| 605 | 609 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 } | 823 } |
| 820 | 824 |
| 821 void VideoSendStreamImpl::DeRegisterProcessThread() { | 825 void VideoSendStreamImpl::DeRegisterProcessThread() { |
| 822 RTC_DCHECK_RUN_ON(&module_process_thread_checker_); | 826 RTC_DCHECK_RUN_ON(&module_process_thread_checker_); |
| 823 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 827 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 824 module_process_thread_->DeRegisterModule(rtp_rtcp); | 828 module_process_thread_->DeRegisterModule(rtp_rtcp); |
| 825 } | 829 } |
| 826 | 830 |
| 827 VideoSendStreamImpl::~VideoSendStreamImpl() { | 831 VideoSendStreamImpl::~VideoSendStreamImpl() { |
| 828 RTC_DCHECK_RUN_ON(worker_queue_); | 832 RTC_DCHECK_RUN_ON(worker_queue_); |
| 829 RTC_DCHECK(!payload_router_.active()) | 833 RTC_DCHECK(!payload_router_.IsActive()) |
| 830 << "VideoSendStreamImpl::Stop not called"; | 834 << "VideoSendStreamImpl::Stop not called"; |
| 831 LOG(LS_INFO) << "~VideoSendStreamInternal: " << config_->ToString(); | 835 LOG(LS_INFO) << "~VideoSendStreamInternal: " << config_->ToString(); |
| 832 | 836 |
| 833 rtp_rtcp_modules_[0]->SetREMBStatus(false); | 837 rtp_rtcp_modules_[0]->SetREMBStatus(false); |
| 834 remb_->RemoveRembSender(rtp_rtcp_modules_[0]); | 838 remb_->RemoveRembSender(rtp_rtcp_modules_[0]); |
| 835 | 839 |
| 836 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 840 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 837 congestion_controller_->packet_router()->RemoveRtpModule(rtp_rtcp); | 841 congestion_controller_->packet_router()->RemoveRtpModule(rtp_rtcp); |
| 838 delete rtp_rtcp; | 842 delete rtp_rtcp; |
| 839 } | 843 } |
| 840 } | 844 } |
| 841 | 845 |
| 842 bool VideoSendStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) { | 846 bool VideoSendStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) { |
| 843 // Runs on a network thread. | 847 // Runs on a network thread. |
| 844 RTC_DCHECK(!worker_queue_->IsCurrent()); | 848 RTC_DCHECK(!worker_queue_->IsCurrent()); |
| 845 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 849 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 846 rtp_rtcp->IncomingRtcpPacket(packet, length); | 850 rtp_rtcp->IncomingRtcpPacket(packet, length); |
| 847 return true; | 851 return true; |
| 848 } | 852 } |
| 849 | 853 |
| 850 void VideoSendStreamImpl::Start() { | 854 void VideoSendStreamImpl::Start() { |
| 851 RTC_DCHECK_RUN_ON(worker_queue_); | 855 RTC_DCHECK_RUN_ON(worker_queue_); |
| 852 LOG(LS_INFO) << "VideoSendStream::Start"; | 856 LOG(LS_INFO) << "VideoSendStream::Start"; |
| 853 if (payload_router_.active()) | 857 if (payload_router_.IsActive()) |
| 854 return; | 858 return; |
| 855 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); | 859 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); |
| 856 payload_router_.set_active(true); | 860 payload_router_.SetActive(true); |
| 857 | 861 |
| 858 bitrate_allocator_->AddObserver( | 862 bitrate_allocator_->AddObserver( |
| 859 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, | 863 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, |
| 860 max_padding_bitrate_, !config_->suspend_below_min_bitrate); | 864 max_padding_bitrate_, !config_->suspend_below_min_bitrate); |
| 861 | 865 |
| 862 // Start monitoring encoder activity. | 866 // Start monitoring encoder activity. |
| 863 { | 867 { |
| 864 rtc::CritScope lock(&encoder_activity_crit_sect_); | 868 rtc::CritScope lock(&encoder_activity_crit_sect_); |
| 865 RTC_DCHECK(!check_encoder_activity_task_); | 869 RTC_DCHECK(!check_encoder_activity_task_); |
| 866 check_encoder_activity_task_ = new CheckEncoderActivityTask(weak_ptr_); | 870 check_encoder_activity_task_ = new CheckEncoderActivityTask(weak_ptr_); |
| 867 worker_queue_->PostDelayedTask( | 871 worker_queue_->PostDelayedTask( |
| 868 std::unique_ptr<rtc::QueuedTask>(check_encoder_activity_task_), | 872 std::unique_ptr<rtc::QueuedTask>(check_encoder_activity_task_), |
| 869 CheckEncoderActivityTask::kEncoderTimeOutMs); | 873 CheckEncoderActivityTask::kEncoderTimeOutMs); |
| 870 } | 874 } |
| 871 | 875 |
| 872 vie_encoder_->SendKeyFrame(); | 876 vie_encoder_->SendKeyFrame(); |
| 873 } | 877 } |
| 874 | 878 |
| 875 void VideoSendStreamImpl::Stop() { | 879 void VideoSendStreamImpl::Stop() { |
| 876 RTC_DCHECK_RUN_ON(worker_queue_); | 880 RTC_DCHECK_RUN_ON(worker_queue_); |
| 877 LOG(LS_INFO) << "VideoSendStream::Stop"; | 881 LOG(LS_INFO) << "VideoSendStream::Stop"; |
| 878 if (!payload_router_.active()) | 882 if (!payload_router_.IsActive()) |
| 879 return; | 883 return; |
| 880 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Stop"); | 884 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Stop"); |
| 881 payload_router_.set_active(false); | 885 payload_router_.SetActive(false); |
| 882 bitrate_allocator_->RemoveObserver(this); | 886 bitrate_allocator_->RemoveObserver(this); |
| 883 { | 887 { |
| 884 rtc::CritScope lock(&encoder_activity_crit_sect_); | 888 rtc::CritScope lock(&encoder_activity_crit_sect_); |
| 885 check_encoder_activity_task_->Stop(); | 889 check_encoder_activity_task_->Stop(); |
| 886 check_encoder_activity_task_ = nullptr; | 890 check_encoder_activity_task_ = nullptr; |
| 887 } | 891 } |
| 888 vie_encoder_->OnBitrateUpdated(0, 0, 0); | 892 vie_encoder_->OnBitrateUpdated(0, 0, 0); |
| 889 stats_proxy_->OnSetEncoderTargetRate(0); | 893 stats_proxy_->OnSetEncoderTargetRate(0); |
| 890 } | 894 } |
| 891 | 895 |
| 892 void VideoSendStreamImpl::SignalEncoderTimedOut() { | 896 void VideoSendStreamImpl::SignalEncoderTimedOut() { |
| 893 RTC_DCHECK_RUN_ON(worker_queue_); | 897 RTC_DCHECK_RUN_ON(worker_queue_); |
| 894 // If the encoder has not produced anything the last kEncoderTimeOutMs and it | 898 // If the encoder has not produced anything the last kEncoderTimeOutMs and it |
| 895 // is supposed to, deregister as BitrateAllocatorObserver. This can happen | 899 // is supposed to, deregister as BitrateAllocatorObserver. This can happen |
| 896 // if a camera stops producing frames. | 900 // if a camera stops producing frames. |
| 897 if (encoder_target_rate_bps_ > 0) { | 901 if (encoder_target_rate_bps_ > 0) { |
| 898 LOG(LS_INFO) << "SignalEncoderTimedOut, Encoder timed out."; | 902 LOG(LS_INFO) << "SignalEncoderTimedOut, Encoder timed out."; |
| 899 bitrate_allocator_->RemoveObserver(this); | 903 bitrate_allocator_->RemoveObserver(this); |
| 900 } | 904 } |
| 901 } | 905 } |
| 902 | 906 |
| 907 void VideoSendStreamImpl::OnBitrateAllocationUpdated( |
| 908 const BitrateAllocation& allocation) { |
| 909 payload_router_.OnBitrateAllocationUpdated(allocation); |
| 910 } |
| 911 |
| 903 void VideoSendStreamImpl::SignalEncoderActive() { | 912 void VideoSendStreamImpl::SignalEncoderActive() { |
| 904 RTC_DCHECK_RUN_ON(worker_queue_); | 913 RTC_DCHECK_RUN_ON(worker_queue_); |
| 905 LOG(LS_INFO) << "SignalEncoderActive, Encoder is active."; | 914 LOG(LS_INFO) << "SignalEncoderActive, Encoder is active."; |
| 906 bitrate_allocator_->AddObserver( | 915 bitrate_allocator_->AddObserver( |
| 907 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, | 916 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, |
| 908 max_padding_bitrate_, !config_->suspend_below_min_bitrate); | 917 max_padding_bitrate_, !config_->suspend_below_min_bitrate); |
| 909 } | 918 } |
| 910 | 919 |
| 911 void VideoSendStreamImpl::OnEncoderConfigurationChanged( | 920 void VideoSendStreamImpl::OnEncoderConfigurationChanged( |
| 912 std::vector<VideoStream> streams, | 921 std::vector<VideoStream> streams, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 935 for (size_t i = streams.size(); i < config_->rtp.ssrcs.size(); ++i) { | 944 for (size_t i = streams.size(); i < config_->rtp.ssrcs.size(); ++i) { |
| 936 stats_proxy_->OnInactiveSsrc(config_->rtp.ssrcs[i]); | 945 stats_proxy_->OnInactiveSsrc(config_->rtp.ssrcs[i]); |
| 937 } | 946 } |
| 938 | 947 |
| 939 size_t number_of_temporal_layers = | 948 size_t number_of_temporal_layers = |
| 940 streams.back().temporal_layer_thresholds_bps.size() + 1; | 949 streams.back().temporal_layer_thresholds_bps.size() + 1; |
| 941 protection_bitrate_calculator_.SetEncodingData( | 950 protection_bitrate_calculator_.SetEncodingData( |
| 942 streams[0].width, streams[0].height, number_of_temporal_layers, | 951 streams[0].width, streams[0].height, number_of_temporal_layers, |
| 943 config_->rtp.max_packet_size); | 952 config_->rtp.max_packet_size); |
| 944 | 953 |
| 945 if (payload_router_.active()) { | 954 if (payload_router_.IsActive()) { |
| 946 // The send stream is started already. Update the allocator with new bitrate | 955 // The send stream is started already. Update the allocator with new bitrate |
| 947 // limits. | 956 // limits. |
| 948 bitrate_allocator_->AddObserver( | 957 bitrate_allocator_->AddObserver( |
| 949 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, | 958 this, encoder_min_bitrate_bps_, encoder_max_bitrate_bps_, |
| 950 max_padding_bitrate_, !config_->suspend_below_min_bitrate); | 959 max_padding_bitrate_, !config_->suspend_below_min_bitrate); |
| 951 } | 960 } |
| 952 } | 961 } |
| 953 | 962 |
| 954 EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage( | 963 EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage( |
| 955 const EncodedImage& encoded_image, | 964 const EncodedImage& encoded_image, |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 1152 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 1144 rtp_rtcp->SetRTCPStatus(state == kNetworkUp ? config_->rtp.rtcp_mode | 1153 rtp_rtcp->SetRTCPStatus(state == kNetworkUp ? config_->rtp.rtcp_mode |
| 1145 : RtcpMode::kOff); | 1154 : RtcpMode::kOff); |
| 1146 } | 1155 } |
| 1147 } | 1156 } |
| 1148 | 1157 |
| 1149 uint32_t VideoSendStreamImpl::OnBitrateUpdated(uint32_t bitrate_bps, | 1158 uint32_t VideoSendStreamImpl::OnBitrateUpdated(uint32_t bitrate_bps, |
| 1150 uint8_t fraction_loss, | 1159 uint8_t fraction_loss, |
| 1151 int64_t rtt) { | 1160 int64_t rtt) { |
| 1152 RTC_DCHECK_RUN_ON(worker_queue_); | 1161 RTC_DCHECK_RUN_ON(worker_queue_); |
| 1153 RTC_DCHECK(payload_router_.active()) | 1162 RTC_DCHECK(payload_router_.IsActive()) |
| 1154 << "VideoSendStream::Start has not been called."; | 1163 << "VideoSendStream::Start has not been called."; |
| 1155 // Get the encoder target rate. It is the estimated network rate - | 1164 // Get the encoder target rate. It is the estimated network rate - |
| 1156 // protection overhead. | 1165 // protection overhead. |
| 1157 encoder_target_rate_bps_ = protection_bitrate_calculator_.SetTargetRates( | 1166 encoder_target_rate_bps_ = protection_bitrate_calculator_.SetTargetRates( |
| 1158 bitrate_bps, stats_proxy_->GetSendFrameRate(), fraction_loss, rtt); | 1167 bitrate_bps, stats_proxy_->GetSendFrameRate(), fraction_loss, rtt); |
| 1159 uint32_t protection_bitrate = bitrate_bps - encoder_target_rate_bps_; | 1168 uint32_t protection_bitrate = bitrate_bps - encoder_target_rate_bps_; |
| 1160 | 1169 |
| 1161 encoder_target_rate_bps_ = | 1170 encoder_target_rate_bps_ = |
| 1162 std::min(encoder_max_bitrate_bps_, encoder_target_rate_bps_); | 1171 std::min(encoder_max_bitrate_bps_, encoder_target_rate_bps_); |
| 1163 vie_encoder_->OnBitrateUpdated(encoder_target_rate_bps_, fraction_loss, rtt); | 1172 vie_encoder_->OnBitrateUpdated(encoder_target_rate_bps_, fraction_loss, rtt); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 } | 1221 } |
| 1213 | 1222 |
| 1214 void VideoSendStreamImpl::SetTransportOverhead( | 1223 void VideoSendStreamImpl::SetTransportOverhead( |
| 1215 int transport_overhead_per_packet) { | 1224 int transport_overhead_per_packet) { |
| 1216 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 1225 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 1217 rtp_rtcp->SetTransportOverhead(transport_overhead_per_packet); | 1226 rtp_rtcp->SetTransportOverhead(transport_overhead_per_packet); |
| 1218 } | 1227 } |
| 1219 | 1228 |
| 1220 } // namespace internal | 1229 } // namespace internal |
| 1221 } // namespace webrtc | 1230 } // namespace webrtc |
| OLD | NEW |