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

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

Issue 2448463003: Rename {,Set}GenericFECStatus to {,Set}UlpfecConfig. (Closed)
Patch Set: Rebase. 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 fec_bitrate_.Update(fec_packet->length(), clock_->TimeInMilliseconds()); 165 fec_bitrate_.Update(fec_packet->length(), clock_->TimeInMilliseconds());
166 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), 166 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
167 "Video::PacketFec", "timestamp", rtp_timestamp, 167 "Video::PacketFec", "timestamp", rtp_timestamp,
168 "seqnum", fec_sequence_number); 168 "seqnum", fec_sequence_number);
169 } else { 169 } else {
170 LOG(LS_WARNING) << "Failed to send FEC packet " << fec_sequence_number; 170 LOG(LS_WARNING) << "Failed to send FEC packet " << fec_sequence_number;
171 } 171 }
172 } 172 }
173 } 173 }
174 174
175 void RTPSenderVideo::SetGenericFECStatus(bool enable, 175 void RTPSenderVideo::SetUlpfecConfig(bool enabled,
176 uint8_t payload_type_red, 176 int red_payload_type,
177 uint8_t payload_type_fec) { 177 int ulpfec_payload_type) {
178 RTC_DCHECK(!enable || payload_type_red > 0); 178 RTC_DCHECK(!enabled || red_payload_type > 0);
179 RTC_DCHECK_LE(red_payload_type, 127);
180 RTC_DCHECK_LE(ulpfec_payload_type, 127);
181
179 rtc::CritScope cs(&crit_); 182 rtc::CritScope cs(&crit_);
180 fec_enabled_ = enable; 183 fec_enabled_ = enabled;
181 red_payload_type_ = payload_type_red; 184 red_payload_type_ = red_payload_type;
182 fec_payload_type_ = payload_type_fec; 185 fec_payload_type_ = ulpfec_payload_type;
186
187 // Reset FEC rates.
183 delta_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom}; 188 delta_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom};
184 key_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom}; 189 key_fec_params_ = FecProtectionParams{0, 1, kFecMaskRandom};
185 } 190 }
186 191
187 void RTPSenderVideo::GenericFECStatus(bool* enable, 192 void RTPSenderVideo::UlpfecConfig(bool* enabled,
188 uint8_t* payload_type_red, 193 int* red_payload_type,
189 uint8_t* payload_type_fec) const { 194 int* ulpfec_payload_type) const {
190 rtc::CritScope cs(&crit_); 195 rtc::CritScope cs(&crit_);
191 *enable = fec_enabled_; 196 *enabled = fec_enabled_;
192 *payload_type_red = red_payload_type_; 197 *red_payload_type = red_payload_type_;
193 *payload_type_fec = fec_payload_type_; 198 *ulpfec_payload_type = fec_payload_type_;
194 } 199 }
195 200
196 size_t RTPSenderVideo::FecPacketOverhead() const { 201 size_t RTPSenderVideo::FecPacketOverhead() const {
197 rtc::CritScope cs(&crit_); 202 rtc::CritScope cs(&crit_);
198 size_t overhead = 0; 203 size_t overhead = 0;
199 if (red_payload_type_ != 0) { 204 if (red_payload_type_ != -1) {
200 // Overhead is FEC headers plus RED for FEC header plus anything in RTP 205 // Overhead is FEC headers plus RED for FEC header plus anything in RTP
201 // header beyond the 12 bytes base header (CSRC list, extensions...) 206 // header beyond the 12 bytes base header (CSRC list, extensions...)
202 // This reason for the header extensions to be included here is that 207 // This reason for the header extensions to be included here is that
203 // from an FEC viewpoint, they are part of the payload to be protected. 208 // from an FEC viewpoint, they are part of the payload to be protected.
204 // (The base RTP header is already protected by the FEC header.) 209 // (The base RTP header is already protected by the FEC header.)
205 return producer_fec_.MaxPacketOverhead() + kRedForFecHeaderLength + 210 return producer_fec_.MaxPacketOverhead() + kRedForFecHeaderLength +
206 (rtp_sender_->RtpHeaderLength() - kRtpHeaderSize); 211 (rtp_sender_->RtpHeaderLength() - kRtpHeaderSize);
207 } 212 }
208 if (fec_enabled_) 213 if (fec_enabled_)
209 overhead += producer_fec_.MaxPacketOverhead(); 214 overhead += producer_fec_.MaxPacketOverhead();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 304
300 size_t payload_bytes_in_packet = 0; 305 size_t payload_bytes_in_packet = 0;
301 if (!packetizer->NextPacket(payload, &payload_bytes_in_packet, &last)) 306 if (!packetizer->NextPacket(payload, &payload_bytes_in_packet, &last))
302 return false; 307 return false;
303 308
304 packet->SetPayloadSize(payload_bytes_in_packet); 309 packet->SetPayloadSize(payload_bytes_in_packet);
305 packet->SetMarker(last); 310 packet->SetMarker(last);
306 if (!rtp_sender_->AssignSequenceNumber(packet.get())) 311 if (!rtp_sender_->AssignSequenceNumber(packet.get()))
307 return false; 312 return false;
308 313
309 if (red_payload_type != 0) { 314 if (red_payload_type != -1) {
310 SendVideoPacketAsRed(std::move(packet), storage, 315 SendVideoPacketAsRed(std::move(packet), storage,
311 packetizer->GetProtectionType() == kProtectedPacket); 316 packetizer->GetProtectionType() == kProtectedPacket);
312 } else { 317 } else {
313 SendVideoPacket(std::move(packet), storage); 318 SendVideoPacket(std::move(packet), storage);
314 } 319 }
315 320
316 if (first_frame) { 321 if (first_frame) {
317 if (first) { 322 if (first) {
318 LOG(LS_INFO) 323 LOG(LS_INFO)
319 << "Sent first RTP packet of the first video frame (pre-pacer)"; 324 << "Sent first RTP packet of the first video frame (pre-pacer)";
(...skipping 25 matching lines...) Expand all
345 rtc::CritScope cs(&crit_); 350 rtc::CritScope cs(&crit_);
346 return retransmission_settings_; 351 return retransmission_settings_;
347 } 352 }
348 353
349 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { 354 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) {
350 rtc::CritScope cs(&crit_); 355 rtc::CritScope cs(&crit_);
351 retransmission_settings_ = settings; 356 retransmission_settings_ = settings;
352 } 357 }
353 358
354 } // namespace webrtc 359 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698