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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc

Issue 2448463003: Rename {,Set}GenericFECStatus to {,Set}UlpfecConfig. (Closed)
Patch Set: Created 4 years, 1 month 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 fec_bitrate_.Update(fec_packet->length(), clock_->TimeInMilliseconds()); 163 fec_bitrate_.Update(fec_packet->length(), clock_->TimeInMilliseconds());
164 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), 164 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
165 "Video::PacketFec", "timestamp", rtp_timestamp, 165 "Video::PacketFec", "timestamp", rtp_timestamp,
166 "seqnum", fec_sequence_number); 166 "seqnum", fec_sequence_number);
167 } else { 167 } else {
168 LOG(LS_WARNING) << "Failed to send FEC packet " << fec_sequence_number; 168 LOG(LS_WARNING) << "Failed to send FEC packet " << fec_sequence_number;
169 } 169 }
170 } 170 }
171 } 171 }
172 172
173 void RTPSenderVideo::SetGenericFECStatus(bool enable, 173 void RTPSenderVideo::SetUlpfecConfig(bool ulpfec_enabled,
174 uint8_t payload_type_red, 174 int red_payload_type,
175 uint8_t payload_type_fec) { 175 int ulpfec_payload_type) {
176 RTC_DCHECK(!enable || payload_type_red > 0); 176 RTC_DCHECK(!ulpfec_enabled || red_payload_type > 0);
177
danilchap 2016/10/26 12:59:14 Add DCHECKS payload_type is small enough: RTC_DCHE
brandtr 2016/10/26 13:57:04 Done.
177 rtc::CritScope cs(&crit_); 178 rtc::CritScope cs(&crit_);
178 fec_enabled_ = enable; 179 fec_enabled_ = ulpfec_enabled;
179 red_payload_type_ = payload_type_red; 180 red_payload_type_ = red_payload_type;
180 fec_payload_type_ = payload_type_fec; 181 fec_payload_type_ = ulpfec_payload_type;
182
183 // Reset FEC rates.
181 delta_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom}; 184 delta_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom};
182 key_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom}; 185 key_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom};
183 } 186 }
184 187
185 void RTPSenderVideo::GenericFECStatus(bool* enable, 188 void RTPSenderVideo::UlpfecConfig(bool* ulpfec_enabled,
186 uint8_t* payload_type_red, 189 int* red_payload_type,
187 uint8_t* payload_type_fec) const { 190 int* ulpfec_payload_type) const {
188 rtc::CritScope cs(&crit_); 191 rtc::CritScope cs(&crit_);
189 *enable = fec_enabled_; 192 *ulpfec_enabled = fec_enabled_;
190 *payload_type_red = red_payload_type_; 193 *red_payload_type = red_payload_type_;
191 *payload_type_fec = fec_payload_type_; 194 *ulpfec_payload_type = fec_payload_type_;
192 } 195 }
193 196
194 size_t RTPSenderVideo::FecPacketOverhead() const { 197 size_t RTPSenderVideo::FecPacketOverhead() const {
195 rtc::CritScope cs(&crit_); 198 rtc::CritScope cs(&crit_);
196 size_t overhead = 0; 199 size_t overhead = 0;
197 if (red_payload_type_ != 0) { 200 if (red_payload_type_ != -1) {
198 // Overhead is FEC headers plus RED for FEC header plus anything in RTP 201 // Overhead is FEC headers plus RED for FEC header plus anything in RTP
199 // header beyond the 12 bytes base header (CSRC list, extensions...) 202 // header beyond the 12 bytes base header (CSRC list, extensions...)
200 // This reason for the header extensions to be included here is that 203 // This reason for the header extensions to be included here is that
201 // from an FEC viewpoint, they are part of the payload to be protected. 204 // from an FEC viewpoint, they are part of the payload to be protected.
202 // (The base RTP header is already protected by the FEC header.) 205 // (The base RTP header is already protected by the FEC header.)
203 return producer_fec_.MaxPacketOverhead() + kRedForFecHeaderLength + 206 return producer_fec_.MaxPacketOverhead() + kRedForFecHeaderLength +
204 (rtp_sender_->RtpHeaderLength() - kRtpHeaderSize); 207 (rtp_sender_->RtpHeaderLength() - kRtpHeaderSize);
205 } 208 }
206 if (fec_enabled_) 209 if (fec_enabled_)
207 overhead += producer_fec_.MaxPacketOverhead(); 210 overhead += producer_fec_.MaxPacketOverhead();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 298
296 size_t payload_bytes_in_packet = 0; 299 size_t payload_bytes_in_packet = 0;
297 if (!packetizer->NextPacket(payload, &payload_bytes_in_packet, &last)) 300 if (!packetizer->NextPacket(payload, &payload_bytes_in_packet, &last))
298 return false; 301 return false;
299 302
300 packet->SetPayloadSize(payload_bytes_in_packet); 303 packet->SetPayloadSize(payload_bytes_in_packet);
301 packet->SetMarker(last); 304 packet->SetMarker(last);
302 if (!rtp_sender_->AssignSequenceNumber(packet.get())) 305 if (!rtp_sender_->AssignSequenceNumber(packet.get()))
303 return false; 306 return false;
304 307
305 if (red_payload_type != 0) { 308 if (red_payload_type != -1) {
306 SendVideoPacketAsRed(std::move(packet), storage, 309 SendVideoPacketAsRed(std::move(packet), storage,
307 packetizer->GetProtectionType() == kProtectedPacket); 310 packetizer->GetProtectionType() == kProtectedPacket);
308 } else { 311 } else {
309 SendVideoPacket(std::move(packet), storage); 312 SendVideoPacket(std::move(packet), storage);
310 } 313 }
311 314
312 if (first_frame) { 315 if (first_frame) {
313 if (first) { 316 if (first) {
314 LOG(LS_INFO) 317 LOG(LS_INFO)
315 << "Sent first RTP packet of the first video frame (pre-pacer)"; 318 << "Sent first RTP packet of the first video frame (pre-pacer)";
(...skipping 25 matching lines...) Expand all
341 rtc::CritScope cs(&crit_); 344 rtc::CritScope cs(&crit_);
342 return retransmission_settings_; 345 return retransmission_settings_;
343 } 346 }
344 347
345 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { 348 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) {
346 rtc::CritScope cs(&crit_); 349 rtc::CritScope cs(&crit_);
347 retransmission_settings_ = settings; 350 retransmission_settings_ = settings;
348 } 351 }
349 352
350 } // namespace webrtc 353 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698