Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h

Issue 2260803002: Generalize FEC header formatting. (pt. 4) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Feedback response (with accidental rebase). Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // Given a sequence number spread (i.e., the difference between the largest
danilchap 2016/08/29 12:26:03 'plus one' in the comment feels strange. may be in
brandtr 2016/08/30 07:12:41 Updated comment.
76 // and smallest sequence number, plus one), returns the required packet
77 // mask size.
78 size_t PacketMaskSize(size_t seq_num_spread);
79
68 // Inserts |num_zeros| zero columns into |new_mask| at position 80 // 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 81 // |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 82 // byte will be filled with zeros from |new_bit_index|, but the next byte will
71 // be untouched. 83 // be untouched.
72 void InsertZeroColumns(int num_zeros, 84 void InsertZeroColumns(int num_zeros,
73 uint8_t* new_mask, 85 uint8_t* new_mask,
74 int new_mask_bytes, 86 int new_mask_bytes,
75 int num_fec_packets, 87 int num_fec_packets,
76 int new_bit_index); 88 int new_bit_index);
77 89
(...skipping 10 matching lines...) Expand all
88 uint8_t* old_mask, 100 uint8_t* old_mask,
89 int old_mask_bytes, 101 int old_mask_bytes,
90 int num_fec_packets, 102 int num_fec_packets,
91 int new_bit_index, 103 int new_bit_index,
92 int old_bit_index); 104 int old_bit_index);
93 105
94 } // namespace internal 106 } // namespace internal
95 } // namespace webrtc 107 } // namespace webrtc
96 108
97 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_ 109 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698