Chromium Code Reviews| 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" |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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. | |
| 940 uint8_t payload_type_red = 0; | |
| 941 uint8_t payload_type_fec = 0; | |
| 942 | |
| 943 // TODO(changbin): Should set RTX for RED mapping in RTP sender in future. | 939 // 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 | 940 // 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. | 941 // both should be. If FEC is enabled then they both have to be set. |
| 946 if (config_->rtp.ulpfec.red_payload_type != -1) { | 942 if (config_->rtp.ulpfec.red_payload_type != -1) { |
| 947 RTC_DCHECK_GE(config_->rtp.ulpfec.red_payload_type, 0); | 943 RTC_DCHECK_GE(config_->rtp.ulpfec.red_payload_type, 0); |
| 948 RTC_DCHECK_LE(config_->rtp.ulpfec.red_payload_type, 127); | 944 RTC_DCHECK_LE(config_->rtp.ulpfec.red_payload_type, 127); |
| 949 // TODO(holmer): We should only enable red if ulpfec is also enabled, but | 945 // 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 | 946 // but due to an incompatibility issue with previous versions the receiver |
| 951 // assumes rtx packets are containing red if it has been configured to | 947 // assumes rtx packets are containing red if it has been configured to |
| 952 // receive red. Remove this in a few versions once the incompatibility | 948 // receive red. Remove this in a few versions once the incompatibility |
| 953 // issue is resolved (M53 timeframe). | 949 // issue is resolved (M53 timeframe). |
| 954 payload_type_red = | |
| 955 static_cast<uint8_t>(config_->rtp.ulpfec.red_payload_type); | |
|
stefan-webrtc
2016/10/31 09:33:16
I think the TODO above becomes a bit strange when
brandtr
2016/10/31 12:47:03
Yeah, you are right. This whole function will be c
| |
| 956 } | 950 } |
| 957 if (config_->rtp.ulpfec.ulpfec_payload_type != -1) { | 951 if (config_->rtp.ulpfec.ulpfec_payload_type != -1) { |
| 958 RTC_DCHECK_GE(config_->rtp.ulpfec.ulpfec_payload_type, 0); | 952 RTC_DCHECK_GE(config_->rtp.ulpfec.ulpfec_payload_type, 0); |
| 959 RTC_DCHECK_LE(config_->rtp.ulpfec.ulpfec_payload_type, 127); | 953 RTC_DCHECK_LE(config_->rtp.ulpfec.ulpfec_payload_type, 127); |
| 960 payload_type_fec = | |
| 961 static_cast<uint8_t>(config_->rtp.ulpfec.ulpfec_payload_type); | |
| 962 } | 954 } |
| 963 | 955 |
| 964 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 956 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 965 // Set NACK. | 957 // Set NACK. |
| 966 rtp_rtcp->SetStorePacketsStatus( | 958 rtp_rtcp->SetStorePacketsStatus( |
| 967 enable_protection_nack || congestion_controller_->pacer(), | 959 enable_protection_nack || congestion_controller_->pacer(), |
| 968 kMinSendSidePacketHistorySize); | 960 kMinSendSidePacketHistorySize); |
| 969 // Set FEC. | 961 // Set FEC. |
| 970 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 962 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 971 rtp_rtcp->SetGenericFECStatus(enable_protection_fec, payload_type_red, | 963 rtp_rtcp->SetUlpfecConfig(enable_protection_fec, |
| 972 payload_type_fec); | 964 config_->rtp.ulpfec.red_payload_type, |
| 965 config_->rtp.ulpfec.ulpfec_payload_type); | |
| 973 } | 966 } |
| 974 } | 967 } |
| 975 | 968 |
| 976 protection_bitrate_calculator_.SetProtectionMethod(enable_protection_fec, | 969 protection_bitrate_calculator_.SetProtectionMethod(enable_protection_fec, |
| 977 enable_protection_nack); | 970 enable_protection_nack); |
| 978 } | 971 } |
| 979 | 972 |
| 980 void VideoSendStreamImpl::ConfigureSsrcs() { | 973 void VideoSendStreamImpl::ConfigureSsrcs() { |
| 981 RTC_DCHECK_RUN_ON(worker_queue_); | 974 RTC_DCHECK_RUN_ON(worker_queue_); |
| 982 // Configure regular SSRCs. | 975 // Configure regular SSRCs. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1107 &module_nack_rate); | 1100 &module_nack_rate); |
| 1108 *sent_video_rate_bps += module_video_rate; | 1101 *sent_video_rate_bps += module_video_rate; |
| 1109 *sent_nack_rate_bps += module_nack_rate; | 1102 *sent_nack_rate_bps += module_nack_rate; |
| 1110 *sent_fec_rate_bps += module_fec_rate; | 1103 *sent_fec_rate_bps += module_fec_rate; |
| 1111 } | 1104 } |
| 1112 return 0; | 1105 return 0; |
| 1113 } | 1106 } |
| 1114 | 1107 |
| 1115 } // namespace internal | 1108 } // namespace internal |
| 1116 } // namespace webrtc | 1109 } // namespace webrtc |
| OLD | NEW |