Move gflags usage to video_loopback.

gflags aren't used by the test environment and is an unnecessary
dependency. They're only used by the video_loopback target, so moving
them there.

R=mflodman@webrtc.org
BUG=3113

Review URL: https://webrtc-codereview.appspot.com/12379006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6120 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-05-13 11:26:40 +00:00
parent b5a22b1464
commit 023b101f4e
7 changed files with 42 additions and 105 deletions

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2013 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.
*/
#include "webrtc/test/flags.h"
#include "gflags/gflags.h"
namespace webrtc {
namespace test {
namespace flags {
void Init(int* argc, char*** argv) {
// AllowCommandLineParsing allows us to ignore flags passed on to us by
// Chromium build bots without having to explicitly disable them.
google::AllowCommandLineReparsing();
google::ParseCommandLineFlags(argc, argv, true);
}
DEFINE_int32(width, 640, "Video width.");
size_t Width() { return static_cast<size_t>(FLAGS_width); }
DEFINE_int32(height, 480, "Video height.");
size_t Height() { return static_cast<size_t>(FLAGS_height); }
DEFINE_int32(fps, 30, "Frames per second.");
int Fps() { return static_cast<int>(FLAGS_fps); }
DEFINE_int32(min_bitrate, 50, "Minimum video bitrate.");
size_t MinBitrate() { return static_cast<size_t>(FLAGS_min_bitrate); }
DEFINE_int32(start_bitrate, 300, "Video starting bitrate.");
size_t StartBitrate() { return static_cast<size_t>(FLAGS_start_bitrate); }
DEFINE_int32(max_bitrate, 800, "Maximum video bitrate.");
size_t MaxBitrate() { return static_cast<size_t>(FLAGS_max_bitrate); }
} // flags
} // test
} // webrtc

View File

@ -1,32 +0,0 @@
/*
* Copyright (c) 2013 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.
*/
#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_FLAGS_H_
#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FLAGS_H_
#include <stddef.h>
namespace webrtc {
namespace test {
namespace flags {
void Init(int* argc, char ***argv);
size_t Width();
size_t Height();
int Fps();
size_t MinBitrate();
size_t StartBitrate();
size_t MaxBitrate();
} // flags
} // test
} // webrtc
#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FLAGS_H_

View File

@ -10,13 +10,11 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/test/flags.h"
#include "webrtc/test/run_tests.h"
#include "webrtc/test/testsupport/fileutils.h"
int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
webrtc::test::flags::Init(&argc, &argv);
webrtc::test::SetExecutablePath(argv[0]);
return webrtc::test::RunAllTests();

View File

@ -28,8 +28,6 @@
'fake_encoder.h',
'fake_network_pipe.cc',
'fake_network_pipe.h',
'flags.cc',
'flags.h',
'frame_generator_capturer.cc',
'frame_generator_capturer.h',
'mock_transport.h',
@ -84,7 +82,6 @@
},
'dependencies': [
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'<(webrtc_root)/modules/modules.gyp:video_capture_module',
'<(webrtc_root)/modules/modules.gyp:media_file',
'<(webrtc_root)/test/test.gyp:frame_generator',

View File

@ -12,7 +12,6 @@
#include <deque>
#include <map>
#include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/call.h"
@ -33,11 +32,10 @@
#include "webrtc/test/testsupport/fileutils.h"
#include "webrtc/typedefs.h"
DEFINE_int32(seconds, 10, "Seconds to run each clip.");
namespace webrtc {
static const uint32_t kSendSsrc = 0x654321;
static const int kFullStackTestDurationSecs = 10;
struct FullStackTestParams {
const char* test_label;
@ -391,7 +389,7 @@ TEST_P(FullStackTest, NoPacketLoss) {
params.test_label,
params.avg_psnr_threshold,
params.avg_ssim_threshold,
FLAGS_seconds * params.clip.fps);
kFullStackTestDurationSecs * params.clip.fps);
Call::Config call_config(&analyzer);

View File

@ -12,6 +12,7 @@
#include <map>
#include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/call.h"
@ -21,7 +22,6 @@
#include "webrtc/test/direct_transport.h"
#include "webrtc/test/encoder_settings.h"
#include "webrtc/test/fake_encoder.h"
#include "webrtc/test/flags.h"
#include "webrtc/test/run_loop.h"
#include "webrtc/test/run_tests.h"
#include "webrtc/test/video_capturer.h"
@ -29,20 +29,35 @@
#include "webrtc/typedefs.h"
namespace webrtc {
namespace flags {
class LoopbackTest : public ::testing::Test {
protected:
std::map<uint32_t, bool> reserved_ssrcs_;
};
DEFINE_int32(width, 640, "Video width.");
size_t Width() { return static_cast<size_t>(FLAGS_width); }
DEFINE_int32(height, 480, "Video height.");
size_t Height() { return static_cast<size_t>(FLAGS_height); }
DEFINE_int32(fps, 30, "Frames per second.");
int Fps() { return static_cast<int>(FLAGS_fps); }
DEFINE_int32(min_bitrate, 50, "Minimum video bitrate.");
size_t MinBitrate() { return static_cast<size_t>(FLAGS_min_bitrate); }
DEFINE_int32(start_bitrate, 300, "Video starting bitrate.");
size_t StartBitrate() { return static_cast<size_t>(FLAGS_start_bitrate); }
DEFINE_int32(max_bitrate, 800, "Maximum video bitrate.");
size_t MaxBitrate() { return static_cast<size_t>(FLAGS_max_bitrate); }
} // namespace flags
static const uint32_t kSendSsrc = 0x654321;
static const uint32_t kReceiverLocalSsrc = 0x123456;
TEST_F(LoopbackTest, Test) {
void Loopback() {
scoped_ptr<test::VideoRenderer> local_preview(test::VideoRenderer::Create(
"Local Preview", test::flags::Width(), test::flags::Height()));
"Local Preview", flags::Width(), flags::Height()));
scoped_ptr<test::VideoRenderer> loopback_video(test::VideoRenderer::Create(
"Loopback Video", test::flags::Width(), test::flags::Height()));
"Loopback Video", flags::Width(), flags::Height()));
test::DirectTransport transport;
Call::Config call_config(&transport);
@ -60,12 +75,12 @@ TEST_F(LoopbackTest, Test) {
send_config.encoder_settings =
test::CreateEncoderSettings(encoder.get(), "VP8", 124, 1);
VideoStream* stream = &send_config.encoder_settings.streams[0];
stream->width = test::flags::Width();
stream->height = test::flags::Height();
stream->min_bitrate_bps = static_cast<int>(test::flags::MinBitrate()) * 1000;
stream->width = flags::Width();
stream->height = flags::Height();
stream->min_bitrate_bps = static_cast<int>(flags::MinBitrate()) * 1000;
stream->target_bitrate_bps =
static_cast<int>(test::flags::MaxBitrate()) * 1000;
stream->max_bitrate_bps = static_cast<int>(test::flags::MaxBitrate()) * 1000;
static_cast<int>(flags::MaxBitrate()) * 1000;
stream->max_bitrate_bps = static_cast<int>(flags::MaxBitrate()) * 1000;
stream->max_framerate = 30;
stream->max_qp = 56;
@ -75,9 +90,9 @@ TEST_F(LoopbackTest, Test) {
scoped_ptr<test::VideoCapturer> camera(
test::VideoCapturer::Create(send_stream->Input(),
test::flags::Width(),
test::flags::Height(),
test::flags::Fps(),
flags::Width(),
flags::Height(),
flags::Fps(),
test_clock));
VideoReceiveStream::Config receive_config = call->GetDefaultReceiveConfig();
@ -107,3 +122,11 @@ TEST_F(LoopbackTest, Test) {
transport.StopSending();
}
} // namespace webrtc
int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
google::ParseCommandLineFlags(&argc, &argv, true);
webrtc::Loopback();
return 0;
}

View File

@ -21,10 +21,10 @@
'type': 'executable',
'sources': [
'video/loopback.cc',
'test/test_main.cc',
],
'dependencies': [
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'test/webrtc_test_common.gyp:webrtc_test_common',
'webrtc',
],
@ -43,7 +43,6 @@
],
'dependencies': [
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'modules/modules.gyp:rtp_rtcp',
'test/metrics.gyp:metrics',
'test/webrtc_test_common.gyp:webrtc_test_common',
@ -62,7 +61,6 @@
],
'dependencies': [
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'modules/modules.gyp:neteq_test_support', # Needed by neteq_performance_unittest.
'modules/modules.gyp:rtp_rtcp',
'test/webrtc_test_common.gyp:webrtc_test_common',