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

Unified Diff: webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.cc

Issue 2260803002: Generalize FEC header formatting. (pt. 4) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Reorder some things. 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.cc
diff --git a/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.cc b/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.cc
index 790e705bc4aa4e9505496e84d8e9e7cf556fdead..fe59ccddf0368fbe48e9c2f9d5ba0353c949fb24 100644
--- a/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.cc
+++ b/webrtc/modules/rtp_rtcp/source/forward_error_correction_internal.cc
@@ -15,6 +15,7 @@
#include <algorithm>
+#include "webrtc/base/checks.h"
#include "webrtc/modules/rtp_rtcp/source/fec_private_tables_bursty.h"
#include "webrtc/modules/rtp_rtcp/source/fec_private_tables_random.h"
@@ -205,8 +206,8 @@ void RemainingPacketProtection(int num_media_packets,
const int l_bit =
(num_media_packets - num_fec_for_imp_packets) > 16 ? 1 : 0;
- const int res_mask_bytes =
- (l_bit == 1) ? kMaskSizeLBitSet : kMaskSizeLBitClear;
+ const int res_mask_bytes = (l_bit == 1) ? kUlpfecPacketMaskSizeLBitSet
danilchap 2016/09/01 16:28:48 May be PacketMaskSize(num_media_packets - num_fec_
brandtr 2016/09/02 08:29:13 Might as well do it here, while we're at it..!
+ : kUlpfecPacketMaskSizeLBitClear;
const uint8_t* packet_mask_sub_21 =
mask_table.fec_packet_mask_table()[num_media_packets -
@@ -246,8 +247,8 @@ void ImportantPacketProtection(int num_fec_for_imp_packets,
uint8_t* packet_mask,
const PacketMaskTable& mask_table) {
const int l_bit = num_imp_packets > 16 ? 1 : 0;
- const int num_imp_mask_bytes =
- (l_bit == 1) ? kMaskSizeLBitSet : kMaskSizeLBitClear;
+ const int num_imp_mask_bytes = (l_bit == 1) ? kUlpfecPacketMaskSizeLBitSet
danilchap 2016/09/01 16:28:48 probably can use PacketMaskSize(num_imp_packets) h
+ : kUlpfecPacketMaskSizeLBitClear;
// Get sub_mask1 from table
const uint8_t* packet_mask_sub_1 =
@@ -376,8 +377,8 @@ void GeneratePacketMasks(int num_media_packets,
assert(num_imp_packets <= num_media_packets && num_imp_packets >= 0);
int l_bit = num_media_packets > 16 ? 1 : 0;
- const int num_mask_bytes =
- (l_bit == 1) ? kMaskSizeLBitSet : kMaskSizeLBitClear;
+ const int num_mask_bytes = (l_bit == 1) ? kUlpfecPacketMaskSizeLBitSet
danilchap 2016/09/01 16:28:48 probably can use PacketMaskSize(num_media_packets)
+ : kUlpfecPacketMaskSizeLBitClear;
// Equal-protection for these cases.
if (!use_unequal_protection || num_imp_packets == 0) {
@@ -394,6 +395,14 @@ void GeneratePacketMasks(int num_media_packets,
} // End of UEP modification
} // End of GetPacketMasks
+size_t PacketMaskSize(size_t num_sequence_numbers) {
+ RTC_DCHECK_LE(num_sequence_numbers, 8 * kUlpfecPacketMaskSizeLBitSet);
+ if (num_sequence_numbers > 8 * kUlpfecPacketMaskSizeLBitClear) {
+ return kUlpfecPacketMaskSizeLBitSet;
+ }
+ return kUlpfecPacketMaskSizeLBitClear;
+}
+
void InsertZeroColumns(int num_zeros,
uint8_t* new_mask,
int new_mask_bytes,

Powered by Google App Engine
This is Rietveld 408576698