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

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

Issue 2260803002: Generalize FEC header formatting. (pt. 4) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: New upload for dependent patch sets. 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_H_ 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_
13 13
14 #include <stdint.h> 14 #include <stdint.h>
15 15
16 #include <list> 16 #include <list>
17 #include <map>
17 #include <memory> 18 #include <memory>
19 #include <tuple>
18 #include <vector> 20 #include <vector>
19 21
22 #include "webrtc/base/basictypes.h"
23 #include "webrtc/base/constructormagic.h"
20 #include "webrtc/base/refcount.h" 24 #include "webrtc/base/refcount.h"
21 #include "webrtc/base/scoped_ref_ptr.h" 25 #include "webrtc/base/scoped_ref_ptr.h"
22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
23 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h" 27 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h"
24 #include "webrtc/typedefs.h"
25 28
26 namespace webrtc { 29 namespace webrtc {
27 30
31 class FecHeaderReader;
32 class FecHeaderWriter;
33
28 // Performs codec-independent forward error correction (FEC), based on RFC 5109. 34 // Performs codec-independent forward error correction (FEC), based on RFC 5109.
29 // Option exists to enable unequal protection (UEP) across packets. 35 // Option exists to enable unequal protection (UEP) across packets.
30 // This is not to be confused with protection within packets 36 // This is not to be confused with protection within packets
31 // (referred to as uneven level protection (ULP) in RFC 5109). 37 // (referred to as uneven level protection (ULP) in RFC 5109).
32 class ForwardErrorCorrection { 38 class ForwardErrorCorrection {
33 public: 39 public:
34 // Maximum number of media packets we can protect
35 static constexpr size_t kMaxMediaPackets = 48u;
36
37 // TODO(holmer): As a next step all these struct-like packet classes should be 40 // TODO(holmer): As a next step all these struct-like packet classes should be
38 // refactored into proper classes, and their members should be made private. 41 // refactored into proper classes, and their members should be made private.
39 // This will require parts of the functionality in forward_error_correction.cc 42 // This will require parts of the functionality in forward_error_correction.cc
40 // and receiver_fec.cc to be refactored into the packet classes. 43 // and receiver_fec.cc to be refactored into the packet classes.
41 class Packet { 44 class Packet {
42 public: 45 public:
43 Packet() : length(0), data(), ref_count_(0) {} 46 Packet() : length(0), data(), ref_count_(0) {}
44 virtual ~Packet() {} 47 virtual ~Packet() {}
45 48
46 // Add a reference. 49 // Add a reference.
(...skipping 25 matching lines...) Expand all
72 75
73 // The received list parameter of DecodeFec() references structs of this type. 76 // The received list parameter of DecodeFec() references structs of this type.
74 // 77 //
75 // The ssrc member is needed to ensure that we can restore the SSRC field of 78 // The ssrc member is needed to ensure that we can restore the SSRC field of
76 // recovered packets. In most situations this could be retrieved from other 79 // recovered packets. In most situations this could be retrieved from other
77 // media packets, but in the case of an FEC packet protecting a single 80 // media packets, but in the case of an FEC packet protecting a single
78 // missing media packet, we have no other means of obtaining it. 81 // missing media packet, we have no other means of obtaining it.
79 // TODO(holmer): Refactor into a proper class. 82 // TODO(holmer): Refactor into a proper class.
80 class ReceivedPacket : public SortablePacket { 83 class ReceivedPacket : public SortablePacket {
81 public: 84 public:
82 ReceivedPacket();
danilchap 2016/08/24 10:42:40 what is motiviation for removing constructor/destr
brandtr 2016/08/24 11:34:23 Re-adding non-inlined default constructor, as per
danilchap 2016/08/24 16:41:26 yes. POD = Plain Old Data (http://en.cppreference.
83 ~ReceivedPacket();
84
85 uint32_t ssrc; // SSRC of the current frame. Must be set for FEC 85 uint32_t ssrc; // SSRC of the current frame. Must be set for FEC
86 // packets, but not required for media packets. 86 // packets, but not required for media packets.
87 bool is_fec; // Set to true if this is an FEC packet and false 87 bool is_fec; // Set to true if this is an FEC packet and false
88 // otherwise. 88 // otherwise.
89 rtc::scoped_refptr<Packet> pkt; // Pointer to the packet storage. 89 rtc::scoped_refptr<Packet> pkt; // Pointer to the packet storage.
90 }; 90 };
91 91
92 // The recovered list parameter of #DecodeFec() references structs of 92 // The recovered list parameter of DecodeFec() references structs of
93 // this type. 93 // this type.
94 // TODO(holmer): Refactor into a proper class. 94 // TODO(holmer): Refactor into a proper class.
95 class RecoveredPacket : public SortablePacket { 95 class RecoveredPacket : public SortablePacket {
96 public: 96 public:
97 RecoveredPacket();
danilchap 2016/08/24 10:42:40 same here.
brandtr 2016/08/24 11:34:24 Done.
98 ~RecoveredPacket();
99
100 bool was_recovered; // Will be true if this packet was recovered by 97 bool was_recovered; // Will be true if this packet was recovered by
101 // the FEC. Otherwise it was a media packet passed in 98 // the FEC. Otherwise it was a media packet passed in
102 // through the received packet list. 99 // through the received packet list.
103 bool returned; // True when the packet already has been returned to the 100 bool returned; // True when the packet already has been returned to the
104 // caller through the callback. 101 // caller through the callback.
105 uint8_t length_recovery[2]; // Two bytes used for recovering the packet
106 // length with XOR operations.
107 rtc::scoped_refptr<Packet> pkt; // Pointer to the packet storage. 102 rtc::scoped_refptr<Packet> pkt; // Pointer to the packet storage.
108 }; 103 };
109 104
105 // Used to link media packets to their protecting FEC packets.
106 //
107 // TODO(holmer): Refactor into a proper class.
108 class ProtectedPacket : public ForwardErrorCorrection::SortablePacket {
109 public:
110 rtc::scoped_refptr<ForwardErrorCorrection::Packet> pkt;
111 };
112
113 using ProtectedPacketList = std::list<std::unique_ptr<ProtectedPacket>>;
114
115 // Used for internal storage of received FEC packets in a list.
116 //
117 // TODO(holmer): Refactor into a proper class.
118 class ReceivedFecPacket : public ForwardErrorCorrection::SortablePacket {
119 public:
120 ProtectedPacketList protected_packets;
121 // RTP header fields.
122 uint32_t rtp_ssrc;
123 // FEC header fields.
124 size_t fec_header_size;
125 size_t protection_length;
126 // Packet masks metadata.
127 // SSRC -> [SN base, packet mask offset, packet mask size (bytes)]
danilchap 2016/08/24 10:42:40 probably clearer instead of two comments have a he
brandtr 2016/08/24 11:34:24 Good idea, done!
128 std::map<uint32_t, std::tuple<uint16_t, size_t, size_t>> packet_mask_info;
129 // Raw data.
130 rtc::scoped_refptr<ForwardErrorCorrection::Packet> pkt;
131 };
132
110 using PacketList = std::list<std::unique_ptr<Packet>>; 133 using PacketList = std::list<std::unique_ptr<Packet>>;
111 using ReceivedPacketList = std::list<std::unique_ptr<ReceivedPacket>>; 134 using ReceivedPacketList = std::list<std::unique_ptr<ReceivedPacket>>;
112 using RecoveredPacketList = std::list<std::unique_ptr<RecoveredPacket>>; 135 using RecoveredPacketList = std::list<std::unique_ptr<RecoveredPacket>>;
136 using ReceivedFecPacketList = std::list<std::unique_ptr<ReceivedFecPacket>>;
113 137
114 ForwardErrorCorrection(); 138 // Creates a ForwardErrorCorrection tailored for a specific FEC scheme.
115 virtual ~ForwardErrorCorrection(); 139 static std::unique_ptr<ForwardErrorCorrection> CreateUlpfec();
116 140
117 //
118 // Generates a list of FEC packets from supplied media packets. 141 // Generates a list of FEC packets from supplied media packets.
119 // 142 //
120 // Input: media_packets List of media packets to protect, of type 143 // Input: media_packets List of media packets to protect, of type
121 // Packet. All packets must belong to the 144 // Packet. All packets must belong to the
122 // same frame and the list must not be empty. 145 // same frame and the list must not be empty.
123 // Input: protection_factor FEC protection overhead in the [0, 255] 146 // Input: protection_factor FEC protection overhead in the [0, 255]
124 // domain. To obtain 100% overhead, or an 147 // domain. To obtain 100% overhead, or an
125 // equal number of FEC packets as 148 // equal number of FEC packets as
126 // media packets, use 255. 149 // media packets, use 255.
127 // Input: num_important_packets The number of "important" packets in the 150 // Input: num_important_packets The number of "important" packets in the
(...skipping 23 matching lines...) Expand all
151 // 174 //
152 // Returns 0 on success, -1 on failure. 175 // Returns 0 on success, -1 on failure.
153 // 176 //
154 int EncodeFec(const PacketList& media_packets, 177 int EncodeFec(const PacketList& media_packets,
155 uint8_t protection_factor, 178 uint8_t protection_factor,
156 int num_important_packets, 179 int num_important_packets,
157 bool use_unequal_protection, 180 bool use_unequal_protection,
158 FecMaskType fec_mask_type, 181 FecMaskType fec_mask_type,
159 std::list<Packet*>* fec_packets); 182 std::list<Packet*>* fec_packets);
160 183
161 //
162 // Decodes a list of received media and FEC packets. It will parse the 184 // Decodes a list of received media and FEC packets. It will parse the
163 // |received_packets|, storing FEC packets internally, and move 185 // |received_packets|, storing FEC packets internally, and move
164 // media packets to |recovered_packets|. The recovered list will be 186 // media packets to |recovered_packets|. The recovered list will be
165 // sorted by ascending sequence number and have duplicates removed. 187 // sorted by ascending sequence number and have duplicates removed.
166 // The function should be called as new packets arrive, and 188 // The function should be called as new packets arrive, and
167 // |recovered_packets| will be progressively assembled with each call. 189 // |recovered_packets| will be progressively assembled with each call.
168 // When the function returns, |received_packets| will be empty. 190 // When the function returns, |received_packets| will be empty.
169 // 191 //
170 // The caller will allocate packets submitted through |received_packets|. 192 // The caller will allocate packets submitted through |received_packets|.
171 // The function will handle allocation of recovered packets. 193 // The function will handle allocation of recovered packets.
(...skipping 19 matching lines...) Expand all
191 static int NumFecPackets(int num_media_packets, int protection_factor); 213 static int NumFecPackets(int num_media_packets, int protection_factor);
192 214
193 // Gets the maximum size of the FEC headers in bytes, which must be 215 // Gets the maximum size of the FEC headers in bytes, which must be
194 // accounted for as packet overhead. 216 // accounted for as packet overhead.
195 size_t MaxPacketOverhead() const; 217 size_t MaxPacketOverhead() const;
196 218
197 // Reset internal states from last frame and clear |recovered_packets|. 219 // Reset internal states from last frame and clear |recovered_packets|.
198 // Frees all memory allocated by this class. 220 // Frees all memory allocated by this class.
199 void ResetState(RecoveredPacketList* recovered_packets); 221 void ResetState(RecoveredPacketList* recovered_packets);
200 222
223 // TODO(brandtr): Remove these functions when the Packet classes
224 // have been refactored.
225 static uint16_t ParseSequenceNumber(uint8_t* packet);
226 static uint32_t ParseSsrc(uint8_t* packet);
227
228 protected:
229 // This constructor is used by the unit tests.
230 ForwardErrorCorrection(std::unique_ptr<FecHeaderReader> fec_header_reader,
231 std::unique_ptr<FecHeaderWriter> fec_header_writer);
232
201 private: 233 private:
202 // Used to link media packets to their protecting FEC packets.
203 //
204 // TODO(holmer): Refactor into a proper class.
205 class ProtectedPacket : public ForwardErrorCorrection::SortablePacket {
206 public:
207 rtc::scoped_refptr<ForwardErrorCorrection::Packet> pkt;
208 };
209
210 using ProtectedPacketList = std::list<std::unique_ptr<ProtectedPacket>>;
211
212 // Used for internal storage of received FEC packets in a list.
213 //
214 // TODO(holmer): Refactor into a proper class.
215 class ReceivedFecPacket : public ForwardErrorCorrection::SortablePacket {
216 public:
217 ProtectedPacketList protected_packets;
218 uint32_t ssrc; // SSRC of the current frame.
219 rtc::scoped_refptr<ForwardErrorCorrection::Packet> pkt;
220 };
221
222 using ReceivedFecPacketList = std::list<std::unique_ptr<ReceivedFecPacket>>;
223
224 // Analyzes |media_packets| for holes in the sequence and inserts zero columns 234 // Analyzes |media_packets| for holes in the sequence and inserts zero columns
225 // into the |packet_mask| where those holes are found. Zero columns means that 235 // into the |packet_mask| where those holes are found. Zero columns means that
226 // those packets will have no protection. 236 // those packets will have no protection.
227 // Returns the number of bits used for one row of the new packet mask. 237 // Returns the number of bits used for one row of the new packet mask.
228 // Requires that |packet_mask| has at least 6 * |num_fec_packets| bytes 238 // Requires that |packet_mask| has at least 6 * |num_fec_packets| bytes
229 // allocated. 239 // allocated.
230 int InsertZerosInBitMasks(const PacketList& media_packets, 240 int InsertZerosInPacketMasks(const PacketList& media_packets,
231 uint8_t* packet_mask, int num_mask_bytes, 241 size_t num_fec_packets);
232 int num_fec_packets);
233 242
243 // Writes FEC payload and some recovery fields in the FEC headers.
244 void GenerateFecPayloads(const PacketList& media_packets,
245 size_t num_fec_packets);
234 246
235 void GenerateFecUlpHeaders(const PacketList& media_packets, 247 // Writes the FEC header fields that are not written by GenerateFecPayloads.
236 uint8_t* packet_mask, int num_fec_packets, 248 // This includes writing the packet masks.
237 bool l_bit); 249 void FinalizeFecHeaders(const PacketList& media_packets,
238 250 size_t num_fec_packets);
239 void GenerateFecBitStrings(const PacketList& media_packets,
240 uint8_t* packet_mask, int num_fec_packets,
241 bool l_bit);
242 251
243 // Inserts the |received_packets| into the internal received FEC packet list 252 // Inserts the |received_packets| into the internal received FEC packet list
244 // or into |recovered_packets|. 253 // or into |recovered_packets|.
245 void InsertPackets(ReceivedPacketList* received_packets, 254 void InsertPackets(ReceivedPacketList* received_packets,
246 RecoveredPacketList* recovered_packets); 255 RecoveredPacketList* recovered_packets);
247 256
248 // Inserts the |received_packet| into |recovered_packets|. Deletes duplicates. 257 // Inserts the |received_packet| into |recovered_packets|. Deletes duplicates.
249 void InsertMediaPacket(ReceivedPacket* received_packet, 258 void InsertMediaPacket(ReceivedPacket* received_packet,
250 RecoveredPacketList* recovered_packets); 259 RecoveredPacketList* recovered_packets);
251 260
252 // Assigns pointers to the recovered packet from all FEC packets which cover 261 // Assigns pointers to the recovered packet from all FEC packets which cover
253 // it. 262 // it.
254 // Note: This reduces the complexity when we want to try to recover a packet 263 // Note: This reduces the complexity when we want to try to recover a packet
255 // since we don't have to find the intersection between recovered packets and 264 // since we don't have to find the intersection between recovered packets and
256 // packets covered by the FEC packet. 265 // packets covered by the FEC packet.
257 void UpdateCoveringFecPackets(RecoveredPacket* packet); 266 void UpdateCoveringFecPackets(RecoveredPacket* packet);
258 267
259 // Insert |received_packet| into internal FEC list. Deletes duplicates. 268 // Insert |received_packet| into internal FEC list. Deletes duplicates.
260 void InsertFecPacket(ReceivedPacket* received_packet, 269 void InsertFecPacket(ReceivedPacket* received_packet,
261 const RecoveredPacketList* recovered_packets); 270 const RecoveredPacketList* recovered_packets);
262 271
263 // Assigns pointers to already recovered packets covered by |fec_packet|. 272 // Assigns pointers to already recovered packets covered by |fec_packet|.
264 static void AssignRecoveredPackets( 273 static void AssignRecoveredPackets(
265 ReceivedFecPacket* fec_packet, 274 ReceivedFecPacket* fec_packet,
266 const RecoveredPacketList* recovered_packets); 275 const RecoveredPacketList* recovered_packets);
267 276
268 // Insert |rec_packet_to_insert| into |recovered_packets| in correct position.
269 void InsertRecoveredPacket(RecoveredPacket* rec_packet_to_insert,
270 RecoveredPacketList* recovered_packets);
271
272 // Attempt to recover missing packets, using the internally stored 277 // Attempt to recover missing packets, using the internally stored
273 // received FEC packets. 278 // received FEC packets.
274 void AttemptRecover(RecoveredPacketList* recovered_packets); 279 void AttemptRecovery(RecoveredPacketList* recovered_packets);
275
276 // Initializes packet recovery using the received |fec_packet|.
277 static bool StartPacketRecovery(const ReceivedFecPacket* fec_packet,
278 RecoveredPacket* recovered_packet);
279 280
280 // Performs XOR between |src| and |dst| and stores the result in |dst|. 281 // Performs XOR between |src| and |dst| and stores the result in |dst|.
281 static void XorPackets(const Packet* src, RecoveredPacket* dst); 282 // The parameters |src_offset| and |dst_offset| determines at what byte
283 // the XOR operation starts in |src| and |dst|, respectively. In total,
284 // |payload_length| bytes are XORed.
285 static void XorPackets(const Packet* src,
286 size_t src_offset,
287 size_t payload_length,
288 size_t dst_offset,
289 Packet* dst);
282 290
283 // Finish up the recovery of a packet. 291 // Initializes headers and payload before the XOR operation
284 static bool FinishPacketRecovery(RecoveredPacket* recovered_packet); 292 // that recovers a packet.
293 bool StartPacketRecovery(ReceivedFecPacket* fec_packet,
294 RecoveredPacket* recovered_packet) const;
295
296 // Finalizes recovery of packet by setting RTP header fields.
297 // This is not specific to the FEC scheme used.
298 static bool FinishPacketRecovery(const ReceivedFecPacket* fec_packet,
299 RecoveredPacket* recovered_packet);
285 300
286 // Recover a missing packet. 301 // Recover a missing packet.
287 bool RecoverPacket(const ReceivedFecPacket* fec_packet, 302 bool RecoverPacket(ReceivedFecPacket* fec_packet,
288 RecoveredPacket* rec_packet_to_insert); 303 RecoveredPacket* recovered_packet);
289 304
290 // Get the number of missing media packets which are covered by |fec_packet|. 305 // Get the number of missing media packets which are covered by |fec_packet|.
291 // An FEC packet can recover at most one packet, and if zero packets are 306 // An FEC packet can recover at most one packet, and if zero packets are
292 // missing the FEC packet can be discarded. This function returns 2 when two 307 // missing the FEC packet can be discarded. This function returns 2 when two
293 // or more packets are missing. 308 // or more packets are missing.
294 static int NumCoveredPacketsMissing(const ReceivedFecPacket* fec_packet); 309 static int NumCoveredPacketsMissing(const ReceivedFecPacket* fec_packet);
295 310
296 // Discards old packets in |recovered_packets|, which are no longer relevant 311 // Discards old packets in |recovered_packets|, which are no longer relevant
297 // for recovering lost packets. 312 // for recovering lost packets.
298 static void DiscardOldRecoveredPackets( 313 void DiscardOldRecoveredPackets(RecoveredPacketList* recovered_packets);
299 RecoveredPacketList* recovered_packets); 314
300 static uint16_t ParseSequenceNumber(uint8_t* packet); 315 std::unique_ptr<FecHeaderReader> fec_header_reader_;
316 std::unique_ptr<FecHeaderWriter> fec_header_writer_;
301 317
302 std::vector<Packet> generated_fec_packets_; 318 std::vector<Packet> generated_fec_packets_;
303 ReceivedFecPacketList received_fec_packets_; 319 ReceivedFecPacketList received_fec_packets_;
304 320
305 // Arrays used to avoid dynamically allocating memory when generating 321 // Arrays used to avoid dynamically allocating memory when generating
306 // the packet masks in the ULPFEC headers. 322 // the packet masks.
307 // (There are never more than |kMaxMediaPackets| FEC packets generated.) 323 // (There are never more than |kUlpfecMaxMediaPackets| FEC packets generated.)
308 uint8_t packet_mask_[kMaxMediaPackets * kMaskSizeLBitSet]; 324 uint8_t packet_masks_[kUlpfecMaxMediaPackets * kUlpfecPacketMaskSizeLBitSet];
309 uint8_t tmp_packet_mask_[kMaxMediaPackets * kMaskSizeLBitSet]; 325 uint8_t
326 tmp_packet_masks_[kUlpfecMaxMediaPackets * kUlpfecPacketMaskSizeLBitSet];
327 size_t packet_mask_size_;
310 }; 328 };
329
330 // Classes derived from FecHeader{Reader,Writer} encapsulate the
331 // specifics of reading and writing FEC header for, e.g., ULPFEC
332 // and FlexFEC.
333 class FecHeaderReader {
334 public:
335 virtual ~FecHeaderReader();
336
337 // The maximum number of media packets that can be covered by one FEC packet.
338 size_t MaxMediaPackets() const;
339
340 // The maximum number of FEC packets that is supported, per call
341 // to ForwardErrorCorrection::EncodeFec().
342 size_t MaxFecPackets() const;
343
344 // Parses FEC header and stores information in ReceivedFecPacket members.
345 virtual bool ReadFecHeader(
346 ForwardErrorCorrection::ReceivedFecPacket* fec_packet) const = 0;
347
348 protected:
349 FecHeaderReader(size_t max_media_packets, size_t max_fec_packets);
350
351 const size_t max_media_packets_;
352 const size_t max_fec_packets_;
353 };
354
355 class FecHeaderWriter {
356 public:
357 FecHeaderWriter(size_t max_media_packets, size_t max_fec_packets);
358 virtual ~FecHeaderWriter();
359
360 // The maximum number of media packets that can be covered by one FEC packet.
361 size_t MaxMediaPackets() const;
362
363 // The maximum number of FEC packets that is supported, per call
364 // to ForwardErrorCorrection::EncodeFec().
365 size_t MaxFecPackets() const;
366
367 // The maximum overhead (in bytes) per packet, due to FEC headers.
368 size_t MaxPacketOverhead() const;
369
370 // Calculates the minimum packet mask size needed (in bytes),
371 // given the discrete options of the ULPFEC masks and the bits
372 // set in the current packet mask.
373 virtual size_t MinPacketMaskSize(const uint8_t* packet_mask,
374 size_t packet_mask_size) const = 0;
375
376 // The header size (in bytes), given the packet mask size.
377 virtual size_t FecHeaderSize(size_t packet_mask_size) const = 0;
378
379 // Writes FEC header.
380 virtual void FinalizeFecHeader(
381 const ForwardErrorCorrection::PacketList& media_packets,
382 const uint8_t* packet_mask,
383 size_t packet_mask_size,
384 ForwardErrorCorrection::Packet* fec_packet) const = 0;
385
386 protected:
387 FecHeaderWriter(size_t max_media_packets,
388 size_t max_fec_packets,
389 size_t max_packet_overhead_);
390
391 const size_t max_media_packets_;
392 const size_t max_fec_packets_;
393 const size_t max_packet_overhead_;
394 };
395
311 } // namespace webrtc 396 } // namespace webrtc
397
312 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_ 398 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698