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

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

Issue 2269903002: Add FlexFEC header formatters. (pt. 5) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@header_reader_writer-pt4-generalize_header_formatting
Patch Set: 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
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 using PacketList = std::list<std::unique_ptr<Packet>>; 145 using PacketList = std::list<std::unique_ptr<Packet>>;
146 using ReceivedPacketList = std::list<std::unique_ptr<ReceivedPacket>>; 146 using ReceivedPacketList = std::list<std::unique_ptr<ReceivedPacket>>;
147 using RecoveredPacketList = std::list<std::unique_ptr<RecoveredPacket>>; 147 using RecoveredPacketList = std::list<std::unique_ptr<RecoveredPacket>>;
148 using ReceivedFecPacketList = std::list<std::unique_ptr<ReceivedFecPacket>>; 148 using ReceivedFecPacketList = std::list<std::unique_ptr<ReceivedFecPacket>>;
149 149
150 ~ForwardErrorCorrection(); 150 ~ForwardErrorCorrection();
151 151
152 // Creates a ForwardErrorCorrection tailored for a specific FEC scheme. 152 // Creates a ForwardErrorCorrection tailored for a specific FEC scheme.
153 static std::unique_ptr<ForwardErrorCorrection> CreateUlpfec(); 153 static std::unique_ptr<ForwardErrorCorrection> CreateUlpfec();
154 static std::unique_ptr<ForwardErrorCorrection> CreateFlexfec();
154 155
155 // Generates a list of FEC packets from supplied media packets. 156 // Generates a list of FEC packets from supplied media packets.
156 // 157 //
157 // Input: media_packets List of media packets to protect, of type 158 // Input: media_packets List of media packets to protect, of type
158 // Packet. All packets must belong to the 159 // Packet. All packets must belong to the
159 // same frame and the list must not be empty. 160 // same frame and the list must not be empty.
160 // Input: protection_factor FEC protection overhead in the [0, 255] 161 // Input: protection_factor FEC protection overhead in the [0, 255]
161 // domain. To obtain 100% overhead, or an 162 // domain. To obtain 100% overhead, or an
162 // equal number of FEC packets as 163 // equal number of FEC packets as
163 // media packets, use 255. 164 // media packets, use 255.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // allocated. 253 // allocated.
253 int InsertZerosInPacketMasks(const PacketList& media_packets, 254 int InsertZerosInPacketMasks(const PacketList& media_packets,
254 size_t num_fec_packets); 255 size_t num_fec_packets);
255 256
256 // Writes FEC payloads and some recovery fields in the FEC headers. 257 // Writes FEC payloads and some recovery fields in the FEC headers.
257 void GenerateFecPayloads(const PacketList& media_packets, 258 void GenerateFecPayloads(const PacketList& media_packets,
258 size_t num_fec_packets); 259 size_t num_fec_packets);
259 260
260 // Writes the FEC header fields that are not written by GenerateFecPayloads. 261 // Writes the FEC header fields that are not written by GenerateFecPayloads.
261 // This includes writing the packet masks. 262 // This includes writing the packet masks.
262 void FinalizeFecHeaders(size_t num_fec_packets, uint16_t seq_num_base); 263 void FinalizeFecHeaders(size_t num_fec_packets,
264 uint32_t ssrc,
265 uint16_t seq_num_base);
263 266
264 // Inserts the |received_packets| into the internal received FEC packet list 267 // Inserts the |received_packets| into the internal received FEC packet list
265 // or into |recovered_packets|. 268 // or into |recovered_packets|.
266 void InsertPackets(ReceivedPacketList* received_packets, 269 void InsertPackets(ReceivedPacketList* received_packets,
267 RecoveredPacketList* recovered_packets); 270 RecoveredPacketList* recovered_packets);
268 271
269 // Inserts the |received_packet| into |recovered_packets|. Deletes duplicates. 272 // Inserts the |received_packet| into |recovered_packets|. Deletes duplicates.
270 void InsertMediaPacket(RecoveredPacketList* recovered_packets, 273 void InsertMediaPacket(RecoveredPacketList* recovered_packets,
271 ReceivedPacket* received_packet); 274 ReceivedPacket* received_packet);
272 275
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // given the discrete options of the ULPFEC masks and the bits 387 // given the discrete options of the ULPFEC masks and the bits
385 // set in the current packet mask. 388 // set in the current packet mask.
386 virtual size_t MinPacketMaskSize(const uint8_t* packet_mask, 389 virtual size_t MinPacketMaskSize(const uint8_t* packet_mask,
387 size_t packet_mask_size) const = 0; 390 size_t packet_mask_size) const = 0;
388 391
389 // The header size (in bytes), given the packet mask size. 392 // The header size (in bytes), given the packet mask size.
390 virtual size_t FecHeaderSize(size_t packet_mask_size) const = 0; 393 virtual size_t FecHeaderSize(size_t packet_mask_size) const = 0;
391 394
392 // Writes FEC header. 395 // Writes FEC header.
393 virtual void FinalizeFecHeader( 396 virtual void FinalizeFecHeader(
397 uint32_t ssrc,
394 uint16_t seq_num_base, 398 uint16_t seq_num_base,
395 const uint8_t* packet_mask, 399 const uint8_t* packet_mask,
396 size_t packet_mask_size, 400 size_t packet_mask_size,
397 ForwardErrorCorrection::Packet* fec_packet) const = 0; 401 ForwardErrorCorrection::Packet* fec_packet) const = 0;
398 402
399 protected: 403 protected:
400 FecHeaderWriter(size_t max_media_packets, 404 FecHeaderWriter(size_t max_media_packets,
401 size_t max_fec_packets, 405 size_t max_fec_packets,
402 size_t max_packet_overhead); 406 size_t max_packet_overhead);
403 407
404 const size_t max_media_packets_; 408 const size_t max_media_packets_;
405 const size_t max_fec_packets_; 409 const size_t max_fec_packets_;
406 const size_t max_packet_overhead_; 410 const size_t max_packet_overhead_;
407 }; 411 };
408 412
409 } // namespace webrtc 413 } // namespace webrtc
410 414
411 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_ 415 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698