Index: webrtc/modules/audio_coding/neteq/test/neteq_pcmu_quality_test.cc |
diff --git a/webrtc/modules/audio_coding/neteq/test/neteq_pcmu_quality_test.cc b/webrtc/modules/audio_coding/neteq/test/neteq_pcmu_quality_test.cc |
index eb75fda029260af5bb2d89211981e06373518785..5ea90569a558c11f70109a0798ebfb90d7c91c8d 100644 |
--- a/webrtc/modules/audio_coding/neteq/test/neteq_pcmu_quality_test.cc |
+++ b/webrtc/modules/audio_coding/neteq/test/neteq_pcmu_quality_test.cc |
@@ -13,11 +13,10 @@ |
#include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h" |
#include "webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h" |
#include "webrtc/rtc_base/checks.h" |
+#include "webrtc/rtc_base/flags.h" |
#include "webrtc/rtc_base/safe_conversions.h" |
#include "webrtc/test/testsupport/fileutils.h" |
-using google::RegisterFlagValidator; |
-using google::ParseCommandLineFlags; |
using testing::InitGoogleTest; |
namespace webrtc { |
@@ -26,33 +25,27 @@ namespace { |
static const int kInputSampleRateKhz = 8; |
static const int kOutputSampleRateKhz = 8; |
-// Define switch for frame size. |
-static bool ValidateFrameSize(const char* flagname, int32_t value) { |
- if (value >= 10 && value <= 60 && (value % 10) == 0) |
- return true; |
- printf("Invalid frame size, should be 10, 20, ..., 60 ms."); |
- return false; |
-} |
- |
-DEFINE_int32(frame_size_ms, 20, "Codec frame size (milliseconds)."); |
- |
-static const bool frame_size_dummy = |
- RegisterFlagValidator(&FLAGS_frame_size_ms, &ValidateFrameSize); |
+DEFINE_int(frame_size_ms, 20, "Codec frame size (milliseconds)."); |
} // namespace |
class NetEqPcmuQualityTest : public NetEqQualityTest { |
protected: |
NetEqPcmuQualityTest() |
- : NetEqQualityTest(FLAGS_frame_size_ms, |
+ : NetEqQualityTest(FLAG_frame_size_ms, |
kInputSampleRateKhz, |
kOutputSampleRateKhz, |
- NetEqDecoder::kDecoderPCMu) {} |
+ NetEqDecoder::kDecoderPCMu) { |
+ // Flag validation |
+ RTC_CHECK(FLAG_frame_size_ms >= 10 && FLAG_frame_size_ms <= 60 && |
+ (FLAG_frame_size_ms % 10) == 0) |
+ << "Invalid frame size, should be 10, 20, ..., 60 ms."; |
+ } |
void SetUp() override { |
ASSERT_EQ(1u, channels_) << "PCMu supports only mono audio."; |
AudioEncoderPcmU::Config config; |
- config.frame_size_ms = FLAGS_frame_size_ms; |
+ config.frame_size_ms = FLAG_frame_size_ms; |
encoder_.reset(new AudioEncoderPcmU(config)); |
NetEqQualityTest::SetUp(); |
} |