OLD | NEW |
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 int red_payload_type) { | 116 int red_payload_type) { |
117 std::unique_ptr<RedPacket> red_packet(new RedPacket( | 117 std::unique_ptr<RedPacket> red_packet(new RedPacket( |
118 payload_length + kRedForFecHeaderLength + rtp_header_length)); | 118 payload_length + kRedForFecHeaderLength + rtp_header_length)); |
119 int payload_type = data_buffer[1] & 0x7f; | 119 int payload_type = data_buffer[1] & 0x7f; |
120 red_packet->CreateHeader(data_buffer, rtp_header_length, red_payload_type, | 120 red_packet->CreateHeader(data_buffer, rtp_header_length, red_payload_type, |
121 payload_type); | 121 payload_type); |
122 red_packet->AssignPayload(data_buffer + rtp_header_length, payload_length); | 122 red_packet->AssignPayload(data_buffer + rtp_header_length, payload_length); |
123 return red_packet; | 123 return red_packet; |
124 } | 124 } |
125 | 125 |
126 void ProducerFec::SetFecParameters(const FecProtectionParams* params) { | 126 void ProducerFec::SetFecParameters(const FecProtectionParams& params) { |
127 RTC_DCHECK_GE(params->fec_rate, 0); | 127 RTC_DCHECK_GE(params.fec_rate, 0); |
128 RTC_DCHECK_LE(params->fec_rate, 255); | 128 RTC_DCHECK_LE(params.fec_rate, 255); |
129 // Store the new params and apply them for the next set of FEC packets being | 129 // Store the new params and apply them for the next set of FEC packets being |
130 // produced. | 130 // produced. |
131 new_params_ = *params; | 131 new_params_ = params; |
132 if (params->fec_rate > kHighProtectionThreshold) { | 132 if (params.fec_rate > kHighProtectionThreshold) { |
133 min_num_media_packets_ = kMinMediaPackets; | 133 min_num_media_packets_ = kMinMediaPackets; |
134 } else { | 134 } else { |
135 min_num_media_packets_ = 1; | 135 min_num_media_packets_ = 1; |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 int ProducerFec::AddRtpPacketAndGenerateFec(const uint8_t* data_buffer, | 139 int ProducerFec::AddRtpPacketAndGenerateFec(const uint8_t* data_buffer, |
140 size_t payload_length, | 140 size_t payload_length, |
141 size_t rtp_header_length) { | 141 size_t rtp_header_length) { |
142 RTC_DCHECK(generated_fec_packets_.empty()); | 142 RTC_DCHECK(generated_fec_packets_.empty()); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 return (num_fec_packets << 8) / media_packets_.size(); | 245 return (num_fec_packets << 8) / media_packets_.size(); |
246 } | 246 } |
247 | 247 |
248 void ProducerFec::ResetState() { | 248 void ProducerFec::ResetState() { |
249 media_packets_.clear(); | 249 media_packets_.clear(); |
250 generated_fec_packets_.clear(); | 250 generated_fec_packets_.clear(); |
251 num_protected_frames_ = 0; | 251 num_protected_frames_ = 0; |
252 } | 252 } |
253 | 253 |
254 } // namespace webrtc | 254 } // namespace webrtc |
OLD | NEW |