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

Unified 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: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h
diff --git a/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h b/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h
index 48117514ecad86691c2b3526a34ab473c3153f59..3f61af4c4b3075fb3533654baacf6cfe0f2f5e4c 100644
--- a/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h
+++ b/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.h
@@ -16,10 +16,15 @@
namespace webrtc {
-// Packet mask size in bytes (L bit is set).
-constexpr size_t kMaskSizeLBitSet = 6;
+// Maximum number of media packets that can be protected
+// by these packet masks.
+constexpr size_t kUlpfecMaxMediaPackets = 48;
+
// Packet mask size in bytes (L bit is cleared).
-constexpr size_t kMaskSizeLBitClear = 2;
+constexpr size_t kUlpfecPacketMaskSizeLBitClear = 2;
+
+// Packet mask size in bytes (L bit is set).
+constexpr size_t kUlpfecPacketMaskSizeLBitSet = 6;
namespace internal {
@@ -65,6 +70,38 @@ void GeneratePacketMasks(int num_media_packets, int num_fec_packets,
const PacketMaskTable& mask_table,
uint8_t* packet_mask);
+// Given a sequence number spread (i.e., the difference between the largest
+// and smallest sequence number, plus one), returns the required packet
+// mask size.
+size_t PacketMaskSize(size_t seq_num_spread);
+
+// Inserts |num_zeros| zero columns into |new_mask| at position
+// |new_bit_index|. If the current byte of |new_mask| can't fit all zeros, the
+// byte will be filled with zeros from |new_bit_index|, but the next byte will
+// be untouched.
+void InsertZeroColumns(int num_zeros,
+ uint8_t* new_mask,
+ int new_mask_bytes,
+ int num_fec_packets,
+ int new_bit_index);
+
+// Copies the left most bit column from the byte pointed to by
+// |old_bit_index| in |old_mask| to the right most column of the byte pointed
+// to by |new_bit_index| in |new_mask|. |old_mask_bytes| and |new_mask_bytes|
+// represent the number of bytes used per row for each mask. |num_fec_packets|
+// represent the number of rows of the masks.
+// The copied bit is shifted out from |old_mask| and is shifted one step to
+// the left in |new_mask|. |new_mask| will contain "xxxx xxn0" after this
+// operation, where x are previously inserted bits and n is the new bit.
+void CopyColumn(uint8_t* new_mask,
+ int new_mask_bytes,
+ uint8_t* old_mask,
+ int old_mask_bytes,
+ int num_fec_packets,
+ int new_bit_index,
+ int old_bit_index);
+
} // namespace internal
} // namespace webrtc
+
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FORWARD_ERROR_CORRECTION_INTERNAL_H_

Powered by Google App Engine
This is Rietveld 408576698