diff options
author | danilchap <danilchap@webrtc.org> | 2015-12-14 06:39:33 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-14 14:39:41 +0000 |
commit | 40f349fddafd97c3f4cd0e37407bd1968496cb09 (patch) | |
tree | f0e52f3f5906be86da30c386aee7664c13cc58d7 | |
parent | 3207916f35ded33f586774e2c98d4d0089fe3c6e (diff) | |
download | webrtc-40f349fddafd97c3f4cd0e37407bd1968496cb09.tar.gz |
[rtp_rtcp] Lint errors cleared from rtp_rtcp/test
except rand() function that is subject of CL#1519503002
and namespace that is fixed in CL#1506823002
BUG=webrtc:5277
R=mflodman
Review URL: https://codereview.webrtc.org/1511413005
Cr-Commit-Position: refs/heads/master@{#11012}
4 files changed, 48 insertions, 52 deletions
diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc index ffe6ccef7d..69ed843e50 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc @@ -165,7 +165,7 @@ TEST_F(RtpRtcpAudioTest, Basic) { module1->SetStartTimestamp(test_timestamp); // Test detection at the end of a DTMF tone. - //EXPECT_EQ(0, module2->SetTelephoneEventForwardToDecoder(true)); + // EXPECT_EQ(0, module2->SetTelephoneEventForwardToDecoder(true)); EXPECT_EQ(0, module1->SetSendingStatus(true)); @@ -334,7 +334,7 @@ TEST_F(RtpRtcpAudioTest, DTMF) { // Send RTP packets for 16 tones a 160 ms 100ms // pause between = 2560ms + 1600ms = 4160ms - for (;timeStamp <= 250 * 160; timeStamp += 160) { + for (; timeStamp <= 250 * 160; timeStamp += 160) { EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, timeStamp, -1, test, 4)); fake_clock.AdvanceTimeMilliseconds(20); @@ -342,7 +342,7 @@ TEST_F(RtpRtcpAudioTest, DTMF) { } EXPECT_EQ(0, module1->SendTelephoneEventOutband(32, 9000, 10)); - for (;timeStamp <= 740 * 160; timeStamp += 160) { + for (; timeStamp <= 740 * 160; timeStamp += 160) { EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, timeStamp, -1, test, 4)); fake_clock.AdvanceTimeMilliseconds(20); diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc index 620f576ec0..6c60bf1f6d 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc @@ -30,30 +30,29 @@ class RtcpCallback : public RtcpIntraFrameObserver { public: void SetModule(RtpRtcp* module) { _rtpRtcpModule = module; - }; + } virtual void OnRTCPPacketTimeout(const int32_t id) { } virtual void OnLipSyncUpdate(const int32_t id, - const int32_t audioVideoOffset) { - }; - virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) { - }; + const int32_t audioVideoOffset) {} + virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) {} virtual void OnReceivedSLI(uint32_t ssrc, uint8_t pictureId) { EXPECT_EQ(kSliPictureId & 0x3f, pictureId); - }; + } virtual void OnReceivedRPSI(uint32_t ssrc, uint64_t pictureId) { EXPECT_EQ(kTestPictureId, pictureId); - }; - virtual void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) {}; + } + virtual void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) {} + private: RtpRtcp* _rtpRtcpModule; }; class TestRtpFeedback : public NullRtpFeedback { public: - TestRtpFeedback(RtpRtcp* rtp_rtcp) : rtp_rtcp_(rtp_rtcp) {} + explicit TestRtpFeedback(RtpRtcp* rtp_rtcp) : rtp_rtcp_(rtp_rtcp) {} virtual ~TestRtpFeedback() {} void OnIncomingSSRCChanged(const uint32_t ssrc) override { diff --git a/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc b/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc index e84b511b4f..7f52a8717f 100644 --- a/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc +++ b/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc @@ -28,7 +28,7 @@ #include "webrtc/modules/rtp_rtcp/source/byte_io.h" #include "webrtc/test/testsupport/fileutils.h" -//#define VERBOSE_OUTPUT +// #define VERBOSE_OUTPUT namespace webrtc { namespace fec_private_tables { @@ -40,7 +40,9 @@ using fec_private_tables::kPacketMaskBurstyTbl; void ReceivePackets( ForwardErrorCorrection::ReceivedPacketList* toDecodeList, ForwardErrorCorrection::ReceivedPacketList* receivedPacketList, - uint32_t numPacketsToDecode, float reorderRate, float duplicateRate) { + uint32_t numPacketsToDecode, + float reorderRate, + float duplicateRate) { assert(toDecodeList->empty()); assert(numPacketsToDecode <= receivedPacketList->size()); @@ -80,12 +82,8 @@ void ReceivePackets( TEST(FecTest, FecTest) { // TODO(marpan): Split this function into subroutines/helper functions. - enum { - kMaxNumberMediaPackets = 48 - }; - enum { - kMaxNumberFecPackets = 48 - }; + enum { kMaxNumberMediaPackets = 48 }; + enum { kMaxNumberFecPackets = 48 }; const uint32_t kNumMaskBytesL0 = 2; const uint32_t kNumMaskBytesL1 = 6; @@ -94,11 +92,12 @@ TEST(FecTest, FecTest) { const bool kUseUnequalProtection = true; // FEC mask types. - const FecMaskType kMaskTypes[] = { kFecMaskRandom, kFecMaskBursty }; + const FecMaskType kMaskTypes[] = {kFecMaskRandom, kFecMaskBursty}; const int kNumFecMaskTypes = sizeof(kMaskTypes) / sizeof(*kMaskTypes); // Maximum number of media packets allowed for the mask type. - const uint16_t kMaxMediaPackets[] = {kMaxNumberMediaPackets, + const uint16_t kMaxMediaPackets[] = { + kMaxNumberMediaPackets, sizeof(kPacketMaskBurstyTbl) / sizeof(*kPacketMaskBurstyTbl)}; ASSERT_EQ(12, kMaxMediaPackets[1]) << "Max media packets for bursty mode not " @@ -114,7 +113,7 @@ TEST(FecTest, FecTest) { ForwardErrorCorrection::Packet* mediaPacket = NULL; // Running over only one loss rate to limit execution time. - const float lossRate[] = { 0.5f }; + const float lossRate[] = {0.5f}; const uint32_t lossRateSize = sizeof(lossRate) / sizeof(*lossRate); const float reorderRate = 0.1f; const float duplicateRate = 0.1f; @@ -140,9 +139,7 @@ TEST(FecTest, FecTest) { // Loop over the mask types: random and bursty. for (int mask_type_idx = 0; mask_type_idx < kNumFecMaskTypes; ++mask_type_idx) { - for (uint32_t lossRateIdx = 0; lossRateIdx < lossRateSize; ++lossRateIdx) { - printf("Loss rate: %.2f, Mask type %d \n", lossRate[lossRateIdx], mask_type_idx); @@ -158,14 +155,12 @@ TEST(FecTest, FecTest) { for (uint32_t numFecPackets = 1; numFecPackets <= numMediaPackets && numFecPackets <= packetMaskMax; numFecPackets++) { - // Loop over numImpPackets: usually <= (0.3*numMediaPackets). // For this test we check up to ~ (numMediaPackets / 4). uint32_t maxNumImpPackets = numMediaPackets / 4 + 1; for (uint32_t numImpPackets = 0; numImpPackets <= maxNumImpPackets && - numImpPackets <= packetMaskMax; + numImpPackets <= packetMaskMax; numImpPackets++) { - uint8_t protectionFactor = static_cast<uint8_t>(numFecPackets * 255 / numMediaPackets); @@ -180,10 +175,11 @@ TEST(FecTest, FecTest) { mask_table, packetMask); #ifdef VERBOSE_OUTPUT - printf("%u media packets, %u FEC packets, %u numImpPackets, " - "loss rate = %.2f \n", - numMediaPackets, numFecPackets, numImpPackets, - lossRate[lossRateIdx]); + printf( + "%u media packets, %u FEC packets, %u numImpPackets, " + "loss rate = %.2f \n", + numMediaPackets, numFecPackets, numImpPackets, + lossRate[lossRateIdx]); printf("Packet mask matrix \n"); #endif @@ -388,7 +384,8 @@ TEST(FecTest, FecTest) { while (!receivedPacketList.empty()) { uint32_t numPacketsToDecode = static_cast<uint32_t>( (static_cast<float>(rand()) / RAND_MAX) * - receivedPacketList.size() + 0.5); + receivedPacketList.size() + + 0.5); if (numPacketsToDecode < 1) { numPacketsToDecode = 1; } @@ -397,7 +394,7 @@ TEST(FecTest, FecTest) { if (fecPacketReceived == false) { ForwardErrorCorrection::ReceivedPacketList::iterator - toDecodeIt = toDecodeList.begin(); + toDecodeIt = toDecodeList.begin(); while (toDecodeIt != toDecodeList.end()) { receivedPacket = *toDecodeIt; if (receivedPacket->is_fec) { @@ -417,11 +414,11 @@ TEST(FecTest, FecTest) { if (mediaLossMask[mediaPacketIdx] == 1) { // Should have recovered this packet. ForwardErrorCorrection::RecoveredPacketList::iterator - recoveredPacketListItem = recoveredPacketList.begin(); + recoveredPacketListItem = recoveredPacketList.begin(); - ASSERT_FALSE( - recoveredPacketListItem == recoveredPacketList.end()) - << "Insufficient number of recovered packets."; + ASSERT_FALSE(recoveredPacketListItem == + recoveredPacketList.end()) + << "Insufficient number of recovered packets."; mediaPacket = *mediaPacketListItem; ForwardErrorCorrection::RecoveredPacket* recoveredPacket = *recoveredPacketListItem; @@ -461,7 +458,7 @@ TEST(FecTest, FecTest) { // Delete received packets we didn't pass to DecodeFEC(), due to // early frame completion. ForwardErrorCorrection::ReceivedPacketList::iterator - receivedPacketIt = receivedPacketList.begin(); + receivedPacketIt = receivedPacketList.begin(); while (receivedPacketIt != receivedPacketList.end()) { receivedPacket = *receivedPacketIt; delete receivedPacket; @@ -475,11 +472,11 @@ TEST(FecTest, FecTest) { } timeStamp += 90000 / 30; } // loop over numImpPackets - } // loop over FecPackets - } // loop over numMediaPackets + } // loop over FecPackets + } // loop over numMediaPackets delete[] packetMask; } // loop over loss rates - } // loop over mask types + } // loop over mask types // Have DecodeFEC free allocated memory. fec.ResetState(&recoveredPacketList); 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 e46c9b8684..466214c740 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 @@ -400,7 +400,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test { // Loop over all loss configurations for the symbol sequence of length // |tot_num_packets|. In this version we process up to (k=12, m=12) codes, // and get exact expressions for the residual loss. - // TODO (marpan): For larger codes, loop over some random sample of loss + // TODO(marpan): For larger codes, loop over some random sample of loss // configurations, sampling driven by the underlying statistical loss model // (importance sampling). @@ -420,7 +420,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test { // Map configuration number to a loss state. for (int j = 0; j < tot_num_packets; j++) { - state[j]=0; // Received state. + state[j] = 0; // Received state. int bit_value = i >> (tot_num_packets - j - 1) & 1; if (bit_value == 1) { state[j] = 1; // Lost state. @@ -853,9 +853,9 @@ TEST_F(FecPacketMaskMetricsTest, FecXorVsRS) { EXPECT_GE(kMetricsXorBursty[code_index].average_residual_loss[k], kMetricsReedSolomon[code_index].average_residual_loss[k]); } - // TODO (marpan): There are some cases (for high loss rates and/or - // burst loss models) where XOR is better than RS. Is there some pattern - // we can identify and enforce as a constraint? + // TODO(marpan): There are some cases (for high loss rates and/or + // burst loss models) where XOR is better than RS. Is there some pattern + // we can identify and enforce as a constraint? } } } @@ -867,7 +867,7 @@ TEST_F(FecPacketMaskMetricsTest, FecXorVsRS) { TEST_F(FecPacketMaskMetricsTest, FecTrendXorVsRsLossRate) { SetLossModels(); SetCodeParams(); - // TODO (marpan): Examine this further to see if the condition can be strictly + // TODO(marpan): Examine this further to see if the condition can be strictly // satisfied (i.e., scale = 1.0) for all codes with different/better masks. double scale = 0.90; int num_loss_rates = sizeof(kAverageLossRate) / @@ -891,7 +891,7 @@ TEST_F(FecPacketMaskMetricsTest, FecTrendXorVsRsLossRate) { kMetricsXorRandom[code_index].average_residual_loss[k+1]; EXPECT_GE(diff_rs_xor_random_loss1, scale * diff_rs_xor_random_loss2); } - // TODO (marpan): Investigate the cases for the bursty mask where + // TODO(marpan): Investigate the cases for the bursty mask where // this trend is not strictly satisfied. } } @@ -930,7 +930,7 @@ TEST_F(FecPacketMaskMetricsTest, FecBehaviorViaProtectionLevelAndLength) { EXPECT_LT( kMetricsReedSolomon[code_index2].average_residual_loss[k], kMetricsReedSolomon[code_index1].average_residual_loss[k]); - // TODO (marpan): There are some corner cases where this is not + // TODO(marpan): There are some corner cases where this is not // satisfied with the current packet masks. Look into updating // these cases to see if this behavior should/can be satisfied, // with overall lower residual loss for those XOR codes. @@ -956,7 +956,7 @@ TEST_F(FecPacketMaskMetricsTest, FecVarianceBehaviorXorVsRs) { SetCodeParams(); // The condition is not strictly satisfied with the current masks, // i.e., for some codes, the variance of XOR may be slightly higher than RS. - // TODO (marpan): Examine this further to see if the condition can be strictly + // TODO(marpan): Examine this further to see if the condition can be strictly // satisfied (i.e., scale = 1.0) for all codes with different/better masks. double scale = 0.95; for (int code_index = 0; code_index < max_num_codes_; code_index++) { @@ -991,7 +991,7 @@ TEST_F(FecPacketMaskMetricsTest, FecXorBurstyPerfectRecoveryConsecutiveLoss) { // bursty mask type, for random loss models at low loss rates. // The XOR codes with bursty mask types are generally better than the one with // random mask type, for bursty loss models and/or high loss rates. -// TODO (marpan): Enable this test when some of the packet masks are updated. +// TODO(marpan): Enable this test when some of the packet masks are updated. // Some isolated cases of the codes don't pass this currently. /* TEST_F(FecPacketMaskMetricsTest, FecXorRandomVsBursty) { |