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 // Maximum number of media packets that can be protected | |
20 // by these packet masks. | |
21 constexpr size_t kUlpfecMaxMediaPackets = 48; | |
danilchap
2016/08/25 17:49:15
Probably put these constants into internal too.
si
brandtr
2016/08/26 11:22:22
I will get rid of the internal namespace, since th
| |
22 | |
23 // Packet mask size in bytes (L bit is cleared). | |
24 constexpr size_t kUlpfecPacketMaskSizeLBitClear = 2; | |
25 | |
19 // Packet mask size in bytes (L bit is set). | 26 // Packet mask size in bytes (L bit is set). |
20 constexpr size_t kMaskSizeLBitSet = 6; | 27 constexpr size_t kUlpfecPacketMaskSizeLBitSet = 6; |
21 // Packet mask size in bytes (L bit is cleared). | |
22 constexpr size_t kMaskSizeLBitClear = 2; | |
23 | 28 |
24 namespace internal { | 29 namespace internal { |
25 | 30 |
26 class PacketMaskTable { | 31 class PacketMaskTable { |
27 public: | 32 public: |
28 PacketMaskTable(FecMaskType fec_mask_type, int num_media_packets); | 33 PacketMaskTable(FecMaskType fec_mask_type, int num_media_packets); |
29 ~PacketMaskTable() {} | 34 ~PacketMaskTable() {} |
30 FecMaskType fec_mask_type() const { return fec_mask_type_; } | 35 FecMaskType fec_mask_type() const { return fec_mask_type_; } |
31 const uint8_t*** fec_packet_mask_table() const { | 36 const uint8_t*** fec_packet_mask_table() const { |
32 return fec_packet_mask_table_; | 37 return fec_packet_mask_table_; |
(...skipping 25 matching lines...) Expand all Loading... | |
58 // packet mask used, and a pointer to the | 63 // packet mask used, and a pointer to the |
59 // corresponding packet masks. | 64 // corresponding packet masks. |
60 // \param[out] packet_mask A pointer to hold the packet mask array, | 65 // \param[out] packet_mask A pointer to hold the packet mask array, |
61 // of size: num_fec_packets * | 66 // of size: num_fec_packets * |
62 // "number of mask bytes". | 67 // "number of mask bytes". |
63 void GeneratePacketMasks(int num_media_packets, int num_fec_packets, | 68 void GeneratePacketMasks(int num_media_packets, int num_fec_packets, |
64 int num_imp_packets, bool use_unequal_protection, | 69 int num_imp_packets, bool use_unequal_protection, |
65 const PacketMaskTable& mask_table, | 70 const PacketMaskTable& mask_table, |
66 uint8_t* packet_mask); | 71 uint8_t* packet_mask); |
67 | 72 |
73 // Given a sequence number spread (i.e., the difference between the largest | |
74 // and smallest sequence number, plus one), returns the required packet | |
75 // mask size. | |
76 size_t PacketMaskSize(size_t seq_num_spread); | |
77 | |
68 // Inserts |num_zeros| zero columns into |new_mask| at position | 78 // 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 | 79 // |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 | 80 // byte will be filled with zeros from |new_bit_index|, but the next byte will |
71 // be untouched. | 81 // be untouched. |
72 void InsertZeroColumns(int num_zeros, | 82 void InsertZeroColumns(int num_zeros, |
73 uint8_t* new_mask, | 83 uint8_t* new_mask, |
74 int new_mask_bytes, | 84 int new_mask_bytes, |
75 int num_fec_packets, | 85 int num_fec_packets, |
76 int new_bit_index); | 86 int new_bit_index); |
77 | 87 |
(...skipping 10 matching lines...) Expand all Loading... | |
88 uint8_t* old_mask, | 98 uint8_t* old_mask, |
89 int old_mask_bytes, | 99 int old_mask_bytes, |
90 int num_fec_packets, | 100 int num_fec_packets, |
91 int new_bit_index, | 101 int new_bit_index, |
92 int old_bit_index); | 102 int old_bit_index); |
93 | 103 |
94 } // namespace internal | 104 } // namespace internal |
95 } // namespace webrtc | 105 } // namespace webrtc |
96 | 106 |
97 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_ | 107 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_ |
OLD | NEW |