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

Unified Diff: webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc

Issue 2260803002: Generalize FEC header formatting. (pt. 4) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Lint fix. 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
« no previous file with comments | « webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc
diff --git a/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc b/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc
index b7c4ef5506b1a11f67e573cfae7d8cacd3edec9a..0b4ac259497ee08013b421ed3c07afa53c0965f9 100644
--- a/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc
+++ b/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc
@@ -730,24 +730,24 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
int code_index = 0;
// Maximum number of media packets allowed for the mask type.
const int packet_mask_max = kMaxMediaPackets[fec_mask_type];
- uint8_t* packet_mask = new uint8_t[packet_mask_max * kMaskSizeLBitSet];
+ std::unique_ptr<uint8_t[]> packet_mask(
+ new uint8_t[packet_mask_max * kUlpfecMaxPacketMaskSize]);
// Loop through codes up to |kMaxMediaPacketsTest|.
for (int num_media_packets = 1; num_media_packets <= kMaxMediaPacketsTest;
num_media_packets++) {
const int mask_bytes_fec_packet =
- (num_media_packets > 16) ? kMaskSizeLBitSet : kMaskSizeLBitClear;
+ static_cast<int>(internal::PacketMaskSize(num_media_packets));
internal::PacketMaskTable mask_table(fec_mask_type, num_media_packets);
for (int num_fec_packets = 1; num_fec_packets <= num_media_packets;
num_fec_packets++) {
- memset(packet_mask, 0, num_media_packets * mask_bytes_fec_packet);
- memcpy(packet_mask, mask_table.fec_packet_mask_table()
- [num_media_packets - 1][num_fec_packets - 1],
+ memset(packet_mask.get(), 0, num_media_packets * mask_bytes_fec_packet);
+ memcpy(packet_mask.get(),
+ mask_table.fec_packet_mask_table()[num_media_packets - 1]
+ [num_fec_packets - 1],
num_fec_packets * mask_bytes_fec_packet);
// Convert to bit mask.
- GetPacketMaskConvertToBitMask(packet_mask,
- num_media_packets,
- num_fec_packets,
- mask_bytes_fec_packet,
+ GetPacketMaskConvertToBitMask(packet_mask.get(), num_media_packets,
+ num_fec_packets, mask_bytes_fec_packet,
code_type);
if (RejectInvalidMasks(num_media_packets, num_fec_packets) < 0) {
return -1;
@@ -759,7 +759,6 @@ class FecPacketMaskMetricsTest : public ::testing::Test {
}
}
assert(code_index == kNumberCodes);
- delete [] packet_mask;
return 0;
}
« no previous file with comments | « webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698