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

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

Issue 2391963002: Rename FecConfig to UlpfecConfig in config.h. (Closed)
Patch Set: Rebase. Created 4 years, 2 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_receive_stream.cc ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | 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 #include "webrtc/video/video_send_stream.h" 10 #include "webrtc/video/video_send_stream.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 ss << ", max_packet_size: " << max_packet_size; 125 ss << ", max_packet_size: " << max_packet_size;
126 ss << ", extensions: ["; 126 ss << ", extensions: [";
127 for (size_t i = 0; i < extensions.size(); ++i) { 127 for (size_t i = 0; i < extensions.size(); ++i) {
128 ss << extensions[i].ToString(); 128 ss << extensions[i].ToString();
129 if (i != extensions.size() - 1) 129 if (i != extensions.size() - 1)
130 ss << ", "; 130 ss << ", ";
131 } 131 }
132 ss << ']'; 132 ss << ']';
133 133
134 ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}'; 134 ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}';
135 ss << ", fec: " << fec.ToString(); 135 ss << ", ulpfec: " << ulpfec.ToString();
136 ss << ", rtx: " << rtx.ToString(); 136 ss << ", rtx: " << rtx.ToString();
137 ss << ", c_name: " << c_name; 137 ss << ", c_name: " << c_name;
138 ss << '}'; 138 ss << '}';
139 return ss.str(); 139 return ss.str();
140 } 140 }
141 141
142 std::string VideoSendStream::Config::ToString() const { 142 std::string VideoSendStream::Config::ToString() const {
143 std::stringstream ss; 143 std::stringstream ss;
144 ss << "{encoder_settings: " << encoder_settings.ToString(); 144 ss << "{encoder_settings: " << encoder_settings.ToString();
145 ss << ", rtp: " << rtp.ToString(); 145 ss << ", rtp: " << rtp.ToString();
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 } 915 }
916 } 916 }
917 917
918 return result; 918 return result;
919 } 919 }
920 920
921 void VideoSendStreamImpl::ConfigureProtection() { 921 void VideoSendStreamImpl::ConfigureProtection() {
922 RTC_DCHECK_RUN_ON(worker_queue_); 922 RTC_DCHECK_RUN_ON(worker_queue_);
923 // Enable NACK, FEC or both. 923 // Enable NACK, FEC or both.
924 const bool enable_protection_nack = config_->rtp.nack.rtp_history_ms > 0; 924 const bool enable_protection_nack = config_->rtp.nack.rtp_history_ms > 0;
925 bool enable_protection_fec = config_->rtp.fec.ulpfec_payload_type != -1; 925 bool enable_protection_fec = config_->rtp.ulpfec.ulpfec_payload_type != -1;
926 // Payload types without picture ID cannot determine that a stream is complete 926 // Payload types without picture ID cannot determine that a stream is complete
927 // without retransmitting FEC, so using FEC + NACK for H.264 (for instance) is 927 // without retransmitting FEC, so using FEC + NACK for H.264 (for instance) is
928 // a waste of bandwidth since FEC packets still have to be transmitted. Note 928 // a waste of bandwidth since FEC packets still have to be transmitted. Note
929 // that this is not the case with FLEXFEC. 929 // that this is not the case with FLEXFEC.
930 if (enable_protection_nack && 930 if (enable_protection_nack &&
931 !PayloadTypeSupportsSkippingFecPackets( 931 !PayloadTypeSupportsSkippingFecPackets(
932 config_->encoder_settings.payload_name)) { 932 config_->encoder_settings.payload_name)) {
933 LOG(LS_WARNING) << "Transmitting payload type without picture ID using" 933 LOG(LS_WARNING) << "Transmitting payload type without picture ID using"
934 "NACK+FEC is a waste of bandwidth since FEC packets " 934 "NACK+FEC is a waste of bandwidth since FEC packets "
935 "also have to be retransmitted. Disabling FEC."; 935 "also have to be retransmitted. Disabling FEC.";
936 enable_protection_fec = false; 936 enable_protection_fec = false;
937 } 937 }
938 938
939 // Set to valid uint8_ts to be castable later without signed overflows. 939 // Set to valid uint8_ts to be castable later without signed overflows.
940 uint8_t payload_type_red = 0; 940 uint8_t payload_type_red = 0;
941 uint8_t payload_type_fec = 0; 941 uint8_t payload_type_fec = 0;
942 942
943 // TODO(changbin): Should set RTX for RED mapping in RTP sender in future. 943 // TODO(changbin): Should set RTX for RED mapping in RTP sender in future.
944 // Validate payload types. If either RED or FEC payload types are set then 944 // Validate payload types. If either RED or FEC payload types are set then
945 // both should be. If FEC is enabled then they both have to be set. 945 // both should be. If FEC is enabled then they both have to be set.
946 if (config_->rtp.fec.red_payload_type != -1) { 946 if (config_->rtp.ulpfec.red_payload_type != -1) {
947 RTC_DCHECK_GE(config_->rtp.fec.red_payload_type, 0); 947 RTC_DCHECK_GE(config_->rtp.ulpfec.red_payload_type, 0);
948 RTC_DCHECK_LE(config_->rtp.fec.red_payload_type, 127); 948 RTC_DCHECK_LE(config_->rtp.ulpfec.red_payload_type, 127);
949 // TODO(holmer): We should only enable red if ulpfec is also enabled, but 949 // TODO(holmer): We should only enable red if ulpfec is also enabled, but
950 // but due to an incompatibility issue with previous versions the receiver 950 // but due to an incompatibility issue with previous versions the receiver
951 // assumes rtx packets are containing red if it has been configured to 951 // assumes rtx packets are containing red if it has been configured to
952 // receive red. Remove this in a few versions once the incompatibility 952 // receive red. Remove this in a few versions once the incompatibility
953 // issue is resolved (M53 timeframe). 953 // issue is resolved (M53 timeframe).
954 payload_type_red = static_cast<uint8_t>(config_->rtp.fec.red_payload_type); 954 payload_type_red =
955 static_cast<uint8_t>(config_->rtp.ulpfec.red_payload_type);
955 } 956 }
956 if (config_->rtp.fec.ulpfec_payload_type != -1) { 957 if (config_->rtp.ulpfec.ulpfec_payload_type != -1) {
957 RTC_DCHECK_GE(config_->rtp.fec.ulpfec_payload_type, 0); 958 RTC_DCHECK_GE(config_->rtp.ulpfec.ulpfec_payload_type, 0);
958 RTC_DCHECK_LE(config_->rtp.fec.ulpfec_payload_type, 127); 959 RTC_DCHECK_LE(config_->rtp.ulpfec.ulpfec_payload_type, 127);
959 payload_type_fec = 960 payload_type_fec =
960 static_cast<uint8_t>(config_->rtp.fec.ulpfec_payload_type); 961 static_cast<uint8_t>(config_->rtp.ulpfec.ulpfec_payload_type);
961 } 962 }
962 963
963 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 964 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
964 // Set NACK. 965 // Set NACK.
965 rtp_rtcp->SetStorePacketsStatus( 966 rtp_rtcp->SetStorePacketsStatus(
966 enable_protection_nack || congestion_controller_->pacer(), 967 enable_protection_nack || congestion_controller_->pacer(),
967 kMinSendSidePacketHistorySize); 968 kMinSendSidePacketHistorySize);
968 // Set FEC. 969 // Set FEC.
969 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 970 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
970 rtp_rtcp->SetGenericFECStatus(enable_protection_fec, payload_type_red, 971 rtp_rtcp->SetGenericFECStatus(enable_protection_fec, payload_type_red,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 rtp_rtcp->SetRtxState(it->second); 1006 rtp_rtcp->SetRtxState(it->second);
1006 } 1007 }
1007 1008
1008 // Configure RTX payload types. 1009 // Configure RTX payload types.
1009 RTC_DCHECK_GE(config_->rtp.rtx.payload_type, 0); 1010 RTC_DCHECK_GE(config_->rtp.rtx.payload_type, 0);
1010 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 1011 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
1011 rtp_rtcp->SetRtxSendPayloadType(config_->rtp.rtx.payload_type, 1012 rtp_rtcp->SetRtxSendPayloadType(config_->rtp.rtx.payload_type,
1012 config_->encoder_settings.payload_type); 1013 config_->encoder_settings.payload_type);
1013 rtp_rtcp->SetRtxSendStatus(kRtxRetransmitted | kRtxRedundantPayloads); 1014 rtp_rtcp->SetRtxSendStatus(kRtxRetransmitted | kRtxRedundantPayloads);
1014 } 1015 }
1015 if (config_->rtp.fec.red_payload_type != -1 && 1016 if (config_->rtp.ulpfec.red_payload_type != -1 &&
1016 config_->rtp.fec.red_rtx_payload_type != -1) { 1017 config_->rtp.ulpfec.red_rtx_payload_type != -1) {
1017 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 1018 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
1018 rtp_rtcp->SetRtxSendPayloadType(config_->rtp.fec.red_rtx_payload_type, 1019 rtp_rtcp->SetRtxSendPayloadType(config_->rtp.ulpfec.red_rtx_payload_type,
1019 config_->rtp.fec.red_payload_type); 1020 config_->rtp.ulpfec.red_payload_type);
1020 } 1021 }
1021 } 1022 }
1022 } 1023 }
1023 1024
1024 std::map<uint32_t, RtpState> VideoSendStreamImpl::GetRtpStates() const { 1025 std::map<uint32_t, RtpState> VideoSendStreamImpl::GetRtpStates() const {
1025 RTC_DCHECK_RUN_ON(worker_queue_); 1026 RTC_DCHECK_RUN_ON(worker_queue_);
1026 std::map<uint32_t, RtpState> rtp_states; 1027 std::map<uint32_t, RtpState> rtp_states;
1027 for (size_t i = 0; i < config_->rtp.ssrcs.size(); ++i) { 1028 for (size_t i = 0; i < config_->rtp.ssrcs.size(); ++i) {
1028 uint32_t ssrc = config_->rtp.ssrcs[i]; 1029 uint32_t ssrc = config_->rtp.ssrcs[i];
1029 RTC_DCHECK_EQ(ssrc, rtp_rtcp_modules_[i]->SSRC()); 1030 RTC_DCHECK_EQ(ssrc, rtp_rtcp_modules_[i]->SSRC());
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 &module_nack_rate); 1107 &module_nack_rate);
1107 *sent_video_rate_bps += module_video_rate; 1108 *sent_video_rate_bps += module_video_rate;
1108 *sent_nack_rate_bps += module_nack_rate; 1109 *sent_nack_rate_bps += module_nack_rate;
1109 *sent_fec_rate_bps += module_fec_rate; 1110 *sent_fec_rate_bps += module_fec_rate;
1110 } 1111 }
1111 return 0; 1112 return 0;
1112 } 1113 }
1113 1114
1114 } // namespace internal 1115 } // namespace internal
1115 } // namespace webrtc 1116 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_receive_stream.cc ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698