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

Unified Diff: webrtc/modules/audio_coding/neteq/test/neteq_ilbc_quality_test.cc

Issue 2995363002: Replace gflags usages with rtc_base/flags in all targets based on test_main (Closed)
Patch Set: Fix string use after free Created 3 years, 4 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
Index: webrtc/modules/audio_coding/neteq/test/neteq_ilbc_quality_test.cc
diff --git a/webrtc/modules/audio_coding/neteq/test/neteq_ilbc_quality_test.cc b/webrtc/modules/audio_coding/neteq/test/neteq_ilbc_quality_test.cc
index 4e5f1592cb26a1f75430de084349d2647b13cb87..2f8ca1b78f0ea9bb0dd0c821c7704400835e4ba0 100644
--- a/webrtc/modules/audio_coding/neteq/test/neteq_ilbc_quality_test.cc
+++ b/webrtc/modules/audio_coding/neteq/test/neteq_ilbc_quality_test.cc
@@ -13,11 +13,10 @@
#include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.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 == 20 || value == 30 || value == 40 || value == 60)
- return true;
- printf("Invalid frame size, should be 20, 30, 40, or 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 NetEqIlbcQualityTest : public NetEqQualityTest {
protected:
NetEqIlbcQualityTest()
- : NetEqQualityTest(FLAGS_frame_size_ms,
+ : NetEqQualityTest(FLAG_frame_size_ms,
kInputSampleRateKhz,
kOutputSampleRateKhz,
- NetEqDecoder::kDecoderILBC) {}
+ NetEqDecoder::kDecoderILBC) {
+ // Flag validation
+ RTC_CHECK(FLAG_frame_size_ms == 20 || FLAG_frame_size_ms == 30 ||
+ FLAG_frame_size_ms == 40 || FLAG_frame_size_ms == 60)
+ << "Invalid frame size, should be 20, 30, 40, or 60 ms.";
+ }
void SetUp() override {
ASSERT_EQ(1u, channels_) << "iLBC supports only mono audio.";
AudioEncoderIlbcConfig config;
- config.frame_size_ms = FLAGS_frame_size_ms;
+ config.frame_size_ms = FLAG_frame_size_ms;
encoder_.reset(new AudioEncoderIlbcImpl(config, 102));
NetEqQualityTest::SetUp();
}
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/test/neteq_isac_quality_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698