From cdba1a836b6e4fd994c95fa4442951921ce18780 Mon Sep 17 00:00:00 2001 From: "marpan@webrtc.org" Date: Tue, 31 Jan 2012 00:36:14 +0000 Subject: [PATCH] test_fec: Reduce execution time of test, and use testsupport/fileutils.h for path of randomSeedLog file. Review URL: https://webrtc-codereview.appspot.com/373016 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1576 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/modules/rtp_rtcp/test/testFec/test_fec.cc | 30 ++++++++++++++----- .../rtp_rtcp/test/testFec/test_fec.gypi | 3 +- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/modules/rtp_rtcp/test/testFec/test_fec.cc b/src/modules/rtp_rtcp/test/testFec/test_fec.cc index c4b562e0a..927135568 100644 --- a/src/modules/rtp_rtcp/test/testFec/test_fec.cc +++ b/src/modules/rtp_rtcp/test/testFec/test_fec.cc @@ -1,7 +1,16 @@ -/** - * Test application for core FEC algorithm. Calls encoding and decoding functions in - * ForwardErrorCorrection directly. +/* + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +/* + * Test application for core FEC algorithm. Calls encoding and decoding + * functions in ForwardErrorCorrection directly. */ #include @@ -15,6 +24,7 @@ #include "forward_error_correction_internal.h" #include "rtp_utility.h" +#include "testsupport/fileutils.h" //#define VERBOSE_OUTPUT @@ -46,7 +56,8 @@ int main() { std::list fecMaskList; ForwardErrorCorrection::Packet* mediaPacket; - const float lossRate[] = {0, 0.05f, 0.1f, 0.25f, 0.5f, 0.75f, 0.9f}; + // Running over only one loss rate to limit execution time. + const float lossRate[] = {0.5f}; const WebRtc_UWord32 lossRateSize = sizeof(lossRate)/sizeof(*lossRate); const float reorderRate = 0.1f; const float duplicateRate = 0.1f; @@ -59,7 +70,8 @@ int main() { // reproduce past results. const unsigned int randomSeed = static_cast(time(NULL)); srand(randomSeed); - FILE* randomSeedFile = fopen("randomSeedLog.txt", "a"); + std::string filename = webrtc::test::OutputPath() + "randomSeedLog.txt"; + FILE* randomSeedFile = fopen(filename.c_str(), "a"); fprintf(randomSeedFile, "%u\n", randomSeed); fclose(randomSeedFile); randomSeedFile = NULL; @@ -83,10 +95,12 @@ int main() { numFecPackets <= kMaxNumberFecPackets; numFecPackets++) { - // loop over all possible numImpPackets + // Loop over numImpPackets: these are usually <= (0.3*numMediaPackets). + // For this test we check up to ~ (0.5*numMediaPackets). + WebRtc_UWord32 maxNumImpPackets = numMediaPackets / 2 + 1; for (WebRtc_UWord32 numImpPackets = 0; - numImpPackets <= numMediaPackets && - numImpPackets <= kMaxNumberMediaPackets; + numImpPackets <= maxNumImpPackets && + numImpPackets <= kMaxNumberMediaPackets; numImpPackets++) { WebRtc_UWord8 protectionFactor = static_cast diff --git a/src/modules/rtp_rtcp/test/testFec/test_fec.gypi b/src/modules/rtp_rtcp/test/testFec/test_fec.gypi index b0b042b74..b7f933ba6 100644 --- a/src/modules/rtp_rtcp/test/testFec/test_fec.gypi +++ b/src/modules/rtp_rtcp/test/testFec/test_fec.gypi @@ -1,4 +1,4 @@ -# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. +# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source @@ -13,6 +13,7 @@ 'type': 'executable', 'dependencies': [ 'rtp_rtcp', + '<(webrtc_root)/../test/test.gyp:test_support_main', ], 'include_dirs': [