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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // list will be valid until the next call to | 179 // list will be valid until the next call to |
180 // DecodeFec(). | 180 // DecodeFec(). |
181 // | 181 // |
182 // Returns 0 on success, -1 on failure. | 182 // Returns 0 on success, -1 on failure. |
183 // | 183 // |
184 int DecodeFec(ReceivedPacketList* received_packets, | 184 int DecodeFec(ReceivedPacketList* received_packets, |
185 RecoveredPacketList* recovered_packets); | 185 RecoveredPacketList* recovered_packets); |
186 | 186 |
187 // Get the number of generated FEC packets, given the number of media packets | 187 // Get the number of generated FEC packets, given the number of media packets |
188 // and the protection factor. | 188 // and the protection factor. |
189 int GetNumberOfFecPackets(int num_media_packets, int protection_factor); | 189 static int NumFecPackets(int num_media_packets, int protection_factor); |
190 | 190 |
191 // Gets the size in bytes of the FEC/ULP headers, which must be accounted for | 191 // Gets the maximum size of the FEC headers in bytes, which must be |
192 // as packet overhead. Returns the packet overhead in bytes. | 192 // accounted for as packet overhead. |
193 static size_t PacketOverhead(); | 193 size_t MaxPacketOverhead() const; |
194 | 194 |
195 // Reset internal states from last frame and clear |recovered_packets|. | 195 // Reset internal states from last frame and clear |recovered_packets|. |
196 // Frees all memory allocated by this class. | 196 // Frees all memory allocated by this class. |
197 void ResetState(RecoveredPacketList* recovered_packets); | 197 void ResetState(RecoveredPacketList* recovered_packets); |
198 | 198 |
199 private: | 199 private: |
200 // Used to link media packets to their protecting FEC packets. | 200 // Used to link media packets to their protecting FEC packets. |
201 // | 201 // |
202 // TODO(holmer): Refactor into a proper class. | 202 // TODO(holmer): Refactor into a proper class. |
203 class ProtectedPacket : public ForwardErrorCorrection::SortablePacket { | 203 class ProtectedPacket : public ForwardErrorCorrection::SortablePacket { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 ReceivedFecPacketList received_fec_packets_; | 301 ReceivedFecPacketList received_fec_packets_; |
302 | 302 |
303 // Arrays used to avoid dynamically allocating memory when generating | 303 // Arrays used to avoid dynamically allocating memory when generating |
304 // the packet masks in the ULPFEC headers. | 304 // the packet masks in the ULPFEC headers. |
305 // (There are never more than |kMaxMediaPackets| FEC packets generated.) | 305 // (There are never more than |kMaxMediaPackets| FEC packets generated.) |
306 uint8_t packet_mask_[kMaxMediaPackets * kMaskSizeLBitSet]; | 306 uint8_t packet_mask_[kMaxMediaPackets * kMaskSizeLBitSet]; |
307 uint8_t tmp_packet_mask_[kMaxMediaPackets * kMaskSizeLBitSet]; | 307 uint8_t tmp_packet_mask_[kMaxMediaPackets * kMaskSizeLBitSet]; |
308 }; | 308 }; |
309 } // namespace webrtc | 309 } // namespace webrtc |
310 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_ | 310 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_ |
OLD | NEW |