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

Side by Side Diff: webrtc/video/video_send_stream.cc

Issue 2117493002: Auto pause video streams based on encoder target bitrate. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 5 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
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 return rtp_states; 859 return rtp_states;
860 } 860 }
861 861
862 void VideoSendStream::SignalNetworkState(NetworkState state) { 862 void VideoSendStream::SignalNetworkState(NetworkState state) {
863 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 863 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
864 rtp_rtcp->SetRTCPStatus(state == kNetworkUp ? config_.rtp.rtcp_mode 864 rtp_rtcp->SetRTCPStatus(state == kNetworkUp ? config_.rtp.rtcp_mode
865 : RtcpMode::kOff); 865 : RtcpMode::kOff);
866 } 866 }
867 } 867 }
868 868
869 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, 869 uint32_t VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps,
870 uint8_t fraction_loss, 870 uint8_t fraction_loss,
871 int64_t rtt) { 871 int64_t rtt) {
872 payload_router_.SetTargetSendBitrate(bitrate_bps); 872 payload_router_.SetTargetSendBitrate(bitrate_bps);
873 // Get the encoder target rate. It is the estimated network rate - 873 // Get the encoder target rate. It is the estimated network rate -
874 // protection overhead. 874 // protection overhead.
875 uint32_t encoder_target_rate = protection_bitrate_calculator_.SetTargetRates( 875 uint32_t encoder_target_rate_bps =
876 bitrate_bps, stats_proxy_.GetSendFrameRate(), fraction_loss, rtt); 876 protection_bitrate_calculator_.SetTargetRates(
877 vie_encoder_.OnBitrateUpdated(encoder_target_rate, fraction_loss, rtt); 877 bitrate_bps, stats_proxy_.GetSendFrameRate(), fraction_loss, rtt);
878 vie_encoder_.OnBitrateUpdated(encoder_target_rate_bps, fraction_loss, rtt);
879
880 return bitrate_bps - encoder_target_rate_bps;
878 } 881 }
879 882
880 int VideoSendStream::ProtectionRequest(const FecProtectionParams* delta_params, 883 int VideoSendStream::ProtectionRequest(const FecProtectionParams* delta_params,
881 const FecProtectionParams* key_params, 884 const FecProtectionParams* key_params,
882 uint32_t* sent_video_rate_bps, 885 uint32_t* sent_video_rate_bps,
883 uint32_t* sent_nack_rate_bps, 886 uint32_t* sent_nack_rate_bps,
884 uint32_t* sent_fec_rate_bps) { 887 uint32_t* sent_fec_rate_bps) {
885 *sent_video_rate_bps = 0; 888 *sent_video_rate_bps = 0;
886 *sent_nack_rate_bps = 0; 889 *sent_nack_rate_bps = 0;
887 *sent_fec_rate_bps = 0; 890 *sent_fec_rate_bps = 0;
888 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 891 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
889 uint32_t not_used = 0; 892 uint32_t not_used = 0;
890 uint32_t module_video_rate = 0; 893 uint32_t module_video_rate = 0;
891 uint32_t module_fec_rate = 0; 894 uint32_t module_fec_rate = 0;
892 uint32_t module_nack_rate = 0; 895 uint32_t module_nack_rate = 0;
893 rtp_rtcp->SetFecParameters(delta_params, key_params); 896 rtp_rtcp->SetFecParameters(delta_params, key_params);
894 rtp_rtcp->BitrateSent(&not_used, &module_video_rate, &module_fec_rate, 897 rtp_rtcp->BitrateSent(&not_used, &module_video_rate, &module_fec_rate,
895 &module_nack_rate); 898 &module_nack_rate);
896 *sent_video_rate_bps += module_video_rate; 899 *sent_video_rate_bps += module_video_rate;
897 *sent_nack_rate_bps += module_nack_rate; 900 *sent_nack_rate_bps += module_nack_rate;
898 *sent_fec_rate_bps += module_fec_rate; 901 *sent_fec_rate_bps += module_fec_rate;
899 } 902 }
900 return 0; 903 return 0;
901 } 904 }
902 905
903 } // namespace internal 906 } // namespace internal
904 } // namespace webrtc 907 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698