From 5987f2a9ae49bf12587dd5c5d91e235a5641ef82 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Thu, 19 Apr 2018 14:32:19 +0200 Subject: [PATCH] Fix a couple of nits and update a few comments in forward_error_correction_internal. Bug: None Change-Id: Ie71ea6e98852360940b004fe051044d68c5b299d Reviewed-on: https://webrtc-review.googlesource.com/71200 Reviewed-by: Tommi Commit-Queue: Tommi Cr-Commit-Position: refs/heads/master@{#22983} --- .../source/fec_private_tables_bursty_unittest.cc | 4 ++-- .../source/forward_error_correction_internal.cc | 15 +++++++-------- .../source/forward_error_correction_internal.h | 4 +++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/rtp_rtcp/source/fec_private_tables_bursty_unittest.cc b/modules/rtp_rtcp/source/fec_private_tables_bursty_unittest.cc index 75e84051e8..fd116eb3f0 100644 --- a/modules/rtp_rtcp/source/fec_private_tables_bursty_unittest.cc +++ b/modules/rtp_rtcp/source/fec_private_tables_bursty_unittest.cc @@ -65,7 +65,7 @@ TEST(FecTable, TestRandomLookup) { } TEST(FecTable, TestRandomGenerated) { - FecMaskType fec_mask_type = webrtc::kFecMaskRandom; + FecMaskType fec_mask_type = kFecMaskRandom; int num_media_packets = 15; int num_fec_packets = 6; size_t mask_size = sizeof(kMaskRandom15_6) / sizeof(uint8_t); @@ -73,7 +73,7 @@ TEST(FecTable, TestRandomGenerated) { rtc::ArrayView mask = mask_table.LookUp(num_media_packets, num_fec_packets); EXPECT_EQ(mask.size(), mask_size); - for (size_t i = 0; i < mask_size; i++) { + for (size_t i = 0; i < mask_size; ++i) { EXPECT_EQ(mask[i], kMaskRandom15_6[i]); } } diff --git a/modules/rtp_rtcp/source/forward_error_correction_internal.cc b/modules/rtp_rtcp/source/forward_error_correction_internal.cc index 7d7830aa1a..7336331b49 100644 --- a/modules/rtp_rtcp/source/forward_error_correction_internal.cc +++ b/modules/rtp_rtcp/source/forward_error_correction_internal.cc @@ -392,19 +392,18 @@ void UnequalProtectionMask(int num_media_packets, } // This algorithm is tailored to look up data in the |kPacketMaskRandomTbl| and -// |kPacketMaskBurstyTbl| tables. -// The format of those arrays is that they're essentially a 3 dimensional array -// with the following dimensions: -// * media packet -// * Size for kPacketMaskRandomTbl: 48 +// |kPacketMaskBurstyTbl| tables. These tables only cover fec code for up to 12 +// media packets. Starting from 13 media packets, the fec code will be generated +// at runtime. The format of those arrays is that they're essentially a 3 +// dimensional array with the following dimensions: * media packet +// * Size for kPacketMaskRandomTbl: 12 // * Size for kPacketMaskBurstyTbl: 12 // * fec index // * Size for both random and bursty table increases from 1 to number of rows. // (i.e. 1-48, or 1-12 respectively). // * Fec data (what actually gets returned) -// * Size for kPacketMaskRandomTbl: -// * For the first 16 entries: 2 * fec index (1 based) -// * For entries >= 17: 6 * fec index (1 based) +// * Size for kPacketMaskRandomTbl: 2 bytes. +// * For all entries: 2 * fec index (1 based) // * Size for kPacketMaskBurstyTbl: 2 bytes. // * For all entries: 2 * fec index (1 based) rtc::ArrayView LookUpInFecTable(const uint8_t* table, diff --git a/modules/rtp_rtcp/source/forward_error_correction_internal.h b/modules/rtp_rtcp/source/forward_error_correction_internal.h index dfd794363e..2e8a202113 100644 --- a/modules/rtp_rtcp/source/forward_error_correction_internal.h +++ b/modules/rtp_rtcp/source/forward_error_correction_internal.h @@ -25,7 +25,9 @@ constexpr size_t kUlpfecMaxMediaPackets = 48; constexpr size_t kUlpfecPacketMaskSizeLBitClear = 2; constexpr size_t kUlpfecPacketMaskSizeLBitSet = 6; -// Packet code mask maximum length +// Packet code mask maximum length. kFECPacketMaskMaxSize = MaxNumFECPackets * +// (kUlpfecMaxMediaPackets / 8), and MaxNumFECPackets is equal to maximum number +// of media packets (kUlpfecMaxMediaPackets) constexpr size_t kFECPacketMaskMaxSize = 288; // Convenience constants.