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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // Analyzes |media_packets| for holes in the sequence and inserts zero columns | 222 // Analyzes |media_packets| for holes in the sequence and inserts zero columns |
223 // into the |packet_mask| where those holes are found. Zero columns means that | 223 // into the |packet_mask| where those holes are found. Zero columns means that |
224 // those packets will have no protection. | 224 // those packets will have no protection. |
225 // Returns the number of bits used for one row of the new packet mask. | 225 // Returns the number of bits used for one row of the new packet mask. |
226 // Requires that |packet_mask| has at least 6 * |num_fec_packets| bytes | 226 // Requires that |packet_mask| has at least 6 * |num_fec_packets| bytes |
227 // allocated. | 227 // allocated. |
228 int InsertZerosInBitMasks(const PacketList& media_packets, | 228 int InsertZerosInBitMasks(const PacketList& media_packets, |
229 uint8_t* packet_mask, int num_mask_bytes, | 229 uint8_t* packet_mask, int num_mask_bytes, |
230 int num_fec_packets); | 230 int num_fec_packets); |
231 | 231 |
232 // Inserts |num_zeros| zero columns into |new_mask| at position | |
233 // |new_bit_index|. If the current byte of |new_mask| can't fit all zeros, the | |
234 // byte will be filled with zeros from |new_bit_index|, but the next byte will | |
235 // be untouched. | |
236 static void InsertZeroColumns(int num_zeros, uint8_t* new_mask, | |
237 int new_mask_bytes, int num_fec_packets, | |
238 int new_bit_index); | |
239 | |
240 // Copies the left most bit column from the byte pointed to by | |
241 // |old_bit_index| in |old_mask| to the right most column of the byte pointed | |
242 // to by |new_bit_index| in |new_mask|. |old_mask_bytes| and |new_mask_bytes| | |
243 // represent the number of bytes used per row for each mask. |num_fec_packets| | |
244 // represent the number of rows of the masks. | |
245 // The copied bit is shifted out from |old_mask| and is shifted one step to | |
246 // the left in |new_mask|. |new_mask| will contain "xxxx xxn0" after this | |
247 // operation, where x are previously inserted bits and n is the new bit. | |
248 static void CopyColumn(uint8_t* new_mask, int new_mask_bytes, | |
249 uint8_t* old_mask, int old_mask_bytes, | |
250 int num_fec_packets, int new_bit_index, | |
251 int old_bit_index); | |
252 | 232 |
253 void GenerateFecUlpHeaders(const PacketList& media_packets, | 233 void GenerateFecUlpHeaders(const PacketList& media_packets, |
254 uint8_t* packet_mask, int num_fec_packets, | 234 uint8_t* packet_mask, int num_fec_packets, |
255 bool l_bit); | 235 bool l_bit); |
256 | 236 |
257 void GenerateFecBitStrings(const PacketList& media_packets, | 237 void GenerateFecBitStrings(const PacketList& media_packets, |
258 uint8_t* packet_mask, int num_fec_packets, | 238 uint8_t* packet_mask, int num_fec_packets, |
259 bool l_bit); | 239 bool l_bit); |
260 | 240 |
261 // Inserts the |received_packets| into the internal received FEC packet list | 241 // Inserts the |received_packets| into the internal received FEC packet list |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 ReceivedFecPacketList received_fec_packets_; | 301 ReceivedFecPacketList received_fec_packets_; |
322 | 302 |
323 // Arrays used to avoid dynamically allocating memory when generating | 303 // Arrays used to avoid dynamically allocating memory when generating |
324 // the packet masks in the ULPFEC headers. | 304 // the packet masks in the ULPFEC headers. |
325 // (There are never more than |kMaxMediaPackets| FEC packets generated.) | 305 // (There are never more than |kMaxMediaPackets| FEC packets generated.) |
326 uint8_t packet_mask_[kMaxMediaPackets * kMaskSizeLBitSet]; | 306 uint8_t packet_mask_[kMaxMediaPackets * kMaskSizeLBitSet]; |
327 uint8_t tmp_packet_mask_[kMaxMediaPackets * kMaskSizeLBitSet]; | 307 uint8_t tmp_packet_mask_[kMaxMediaPackets * kMaskSizeLBitSet]; |
328 }; | 308 }; |
329 } // namespace webrtc | 309 } // namespace webrtc |
330 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_ | 310 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_ |
OLD | NEW |