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

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

Issue 2455963003: Simplify SetFecParameters signature. (Closed)
Patch Set: Fix fuzzer. 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 int red_payload_type) { 113 int red_payload_type) {
114 std::unique_ptr<RedPacket> red_packet(new RedPacket( 114 std::unique_ptr<RedPacket> red_packet(new RedPacket(
115 payload_length + kRedForFecHeaderLength + rtp_header_length)); 115 payload_length + kRedForFecHeaderLength + rtp_header_length));
116 int payload_type = data_buffer[1] & 0x7f; 116 int payload_type = data_buffer[1] & 0x7f;
117 red_packet->CreateHeader(data_buffer, rtp_header_length, red_payload_type, 117 red_packet->CreateHeader(data_buffer, rtp_header_length, red_payload_type,
118 payload_type); 118 payload_type);
119 red_packet->AssignPayload(data_buffer + rtp_header_length, payload_length); 119 red_packet->AssignPayload(data_buffer + rtp_header_length, payload_length);
120 return red_packet; 120 return red_packet;
121 } 121 }
122 122
123 void UlpfecGenerator::SetFecParameters(const FecProtectionParams* params) { 123 void UlpfecGenerator::SetFecParameters(const FecProtectionParams& params) {
124 RTC_DCHECK_GE(params->fec_rate, 0); 124 RTC_DCHECK_GE(params.fec_rate, 0);
125 RTC_DCHECK_LE(params->fec_rate, 255); 125 RTC_DCHECK_LE(params.fec_rate, 255);
126 // Store the new params and apply them for the next set of FEC packets being 126 // Store the new params and apply them for the next set of FEC packets being
127 // produced. 127 // produced.
128 new_params_ = *params; 128 new_params_ = params;
129 if (params->fec_rate > kHighProtectionThreshold) { 129 if (params.fec_rate > kHighProtectionThreshold) {
130 min_num_media_packets_ = kMinMediaPackets; 130 min_num_media_packets_ = kMinMediaPackets;
131 } else { 131 } else {
132 min_num_media_packets_ = 1; 132 min_num_media_packets_ = 1;
133 } 133 }
134 } 134 }
135 135
136 int UlpfecGenerator::AddRtpPacketAndGenerateFec(const uint8_t* data_buffer, 136 int UlpfecGenerator::AddRtpPacketAndGenerateFec(const uint8_t* data_buffer,
137 size_t payload_length, 137 size_t payload_length,
138 size_t rtp_header_length) { 138 size_t rtp_header_length) {
139 RTC_DCHECK(generated_fec_packets_.empty()); 139 RTC_DCHECK(generated_fec_packets_.empty());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 return (num_fec_packets << 8) / media_packets_.size(); 242 return (num_fec_packets << 8) / media_packets_.size();
243 } 243 }
244 244
245 void UlpfecGenerator::ResetState() { 245 void UlpfecGenerator::ResetState() {
246 media_packets_.clear(); 246 media_packets_.clear();
247 generated_fec_packets_.clear(); 247 generated_fec_packets_.clear();
248 num_protected_frames_ = 0; 248 num_protected_frames_ = 0;
249 } 249 }
250 250
251 } // namespace webrtc 251 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/ulpfec_generator.h ('k') | webrtc/modules/rtp_rtcp/source/ulpfec_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698