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 |
11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_ |
13 | 13 |
14 #include "webrtc/modules/include/module_common_types.h" | 14 #include "webrtc/modules/include/module_common_types.h" |
15 #include "webrtc/typedefs.h" | 15 #include "webrtc/typedefs.h" |
16 | 16 |
17 namespace webrtc { | 17 namespace webrtc { |
18 | 18 |
19 // Packet mask size in bytes (L bit is set). | 19 // Maximum number of media packets that can be protected |
20 constexpr size_t kMaskSizeLBitSet = 6; | 20 // by these packet masks. |
21 // Packet mask size in bytes (L bit is cleared). | 21 constexpr size_t kUlpfecMaxMediaPackets = 48; |
22 constexpr size_t kMaskSizeLBitClear = 2; | 22 |
| 23 // Packet mask size in bytes (given L bit). |
| 24 constexpr size_t kUlpfecPacketMaskSizeLBitClear = 2; |
| 25 constexpr size_t kUlpfecPacketMaskSizeLBitSet = 6; |
| 26 |
| 27 // Convenience constants. |
| 28 constexpr size_t kUlpfecMinPacketMaskSize = kUlpfecPacketMaskSizeLBitClear; |
| 29 constexpr size_t kUlpfecMaxPacketMaskSize = kUlpfecPacketMaskSizeLBitSet; |
23 | 30 |
24 namespace internal { | 31 namespace internal { |
25 | 32 |
26 class PacketMaskTable { | 33 class PacketMaskTable { |
27 public: | 34 public: |
28 PacketMaskTable(FecMaskType fec_mask_type, int num_media_packets); | 35 PacketMaskTable(FecMaskType fec_mask_type, int num_media_packets); |
29 ~PacketMaskTable() {} | 36 ~PacketMaskTable() {} |
30 FecMaskType fec_mask_type() const { return fec_mask_type_; } | 37 FecMaskType fec_mask_type() const { return fec_mask_type_; } |
31 const uint8_t*** fec_packet_mask_table() const { | 38 const uint8_t*** fec_packet_mask_table() const { |
32 return fec_packet_mask_table_; | 39 return fec_packet_mask_table_; |
(...skipping 25 matching lines...) Expand all Loading... |
58 // packet mask used, and a pointer to the | 65 // packet mask used, and a pointer to the |
59 // corresponding packet masks. | 66 // corresponding packet masks. |
60 // \param[out] packet_mask A pointer to hold the packet mask array, | 67 // \param[out] packet_mask A pointer to hold the packet mask array, |
61 // of size: num_fec_packets * | 68 // of size: num_fec_packets * |
62 // "number of mask bytes". | 69 // "number of mask bytes". |
63 void GeneratePacketMasks(int num_media_packets, int num_fec_packets, | 70 void GeneratePacketMasks(int num_media_packets, int num_fec_packets, |
64 int num_imp_packets, bool use_unequal_protection, | 71 int num_imp_packets, bool use_unequal_protection, |
65 const PacketMaskTable& mask_table, | 72 const PacketMaskTable& mask_table, |
66 uint8_t* packet_mask); | 73 uint8_t* packet_mask); |
67 | 74 |
| 75 // Returns the required packet mask size, given the number of sequence numbers |
| 76 // that will be covered. |
| 77 size_t PacketMaskSize(size_t num_sequence_numbers); |
| 78 |
68 // Inserts |num_zeros| zero columns into |new_mask| at position | 79 // Inserts |num_zeros| zero columns into |new_mask| at position |
69 // |new_bit_index|. If the current byte of |new_mask| can't fit all zeros, the | 80 // |new_bit_index|. If the current byte of |new_mask| can't fit all zeros, the |
70 // byte will be filled with zeros from |new_bit_index|, but the next byte will | 81 // byte will be filled with zeros from |new_bit_index|, but the next byte will |
71 // be untouched. | 82 // be untouched. |
72 void InsertZeroColumns(int num_zeros, | 83 void InsertZeroColumns(int num_zeros, |
73 uint8_t* new_mask, | 84 uint8_t* new_mask, |
74 int new_mask_bytes, | 85 int new_mask_bytes, |
75 int num_fec_packets, | 86 int num_fec_packets, |
76 int new_bit_index); | 87 int new_bit_index); |
77 | 88 |
(...skipping 10 matching lines...) Expand all Loading... |
88 uint8_t* old_mask, | 99 uint8_t* old_mask, |
89 int old_mask_bytes, | 100 int old_mask_bytes, |
90 int num_fec_packets, | 101 int num_fec_packets, |
91 int new_bit_index, | 102 int new_bit_index, |
92 int old_bit_index); | 103 int old_bit_index); |
93 | 104 |
94 } // namespace internal | 105 } // namespace internal |
95 } // namespace webrtc | 106 } // namespace webrtc |
96 | 107 |
97 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_ | 108 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_ |
OLD | NEW |