blob: 0184ff18cca8b43a6135d9aa4b72a3560a9db949 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
niklase@google.com470e71d2011-07-07 08:21:25 +000011
12#include <stdlib.h>
13#include <string.h>
14
pbos@webrtc.orga4407322013-07-16 12:32:05 +000015#include "gflags/gflags.h"
Henrik Kjellander2557b862015-11-18 22:00:21 +010016#include "webrtc/modules/video_coding/include/video_coding.h"
17#include "webrtc/modules/video_coding/test/receiver_tests.h"
stefan@webrtc.org2baf5f52013-03-13 08:46:25 +000018#include "webrtc/test/testsupport/fileutils.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000019
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000020DEFINE_string(codec, "VP8", "Codec to use (VP8 or I420).");
21DEFINE_int32(width, 352, "Width in pixels of the frames in the input file.");
22DEFINE_int32(height, 288, "Height in pixels of the frames in the input file.");
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000023DEFINE_int32(rtt, 0, "RTT (round-trip time), in milliseconds.");
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000024DEFINE_string(input_filename, webrtc::test::ProjectRootPath() +
25 "/resources/foreman_cif.yuv", "Input file.");
26DEFINE_string(output_filename, webrtc::test::OutputPath() +
27 "video_coding_test_output_352x288.yuv", "Output file.");
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000028
niklase@google.com470e71d2011-07-07 08:21:25 +000029using namespace webrtc;
30
31/*
henrik.lundin@webrtc.org7d8c72e2011-12-21 15:24:01 +000032 * Build with EVENT_DEBUG defined
33 * to build the tests with simulated events.
niklase@google.com470e71d2011-07-07 08:21:25 +000034 */
35
holmer@google.come0f7d7b2011-08-03 07:49:56 +000036int vcmMacrosTests = 0;
37int vcmMacrosErrors = 0;
38
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000039int ParseArguments(CmdArgs& args) {
40 args.width = FLAGS_width;
41 args.height = FLAGS_height;
pbos@webrtc.orgd21406d2015-03-19 08:18:53 +000042 if (args.width < 1 || args.height < 1) {
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000043 return -1;
44 }
45 args.codecName = FLAGS_codec;
46 if (args.codecName == "VP8") {
47 args.codecType = kVideoCodecVP8;
marpan@webrtc.org5b883172014-11-01 06:10:48 +000048 } else if (args.codecName == "VP9") {
49 args.codecType = kVideoCodecVP9;
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000050 } else if (args.codecName == "I420") {
51 args.codecType = kVideoCodecI420;
52 } else {
53 printf("Invalid codec: %s\n", args.codecName.c_str());
54 return -1;
55 }
56 args.inputFile = FLAGS_input_filename;
57 args.outputFile = FLAGS_output_filename;
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000058 args.rtt = FLAGS_rtt;
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000059 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000060}
61
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000062int main(int argc, char **argv) {
63 // Initialize WebRTC fileutils.h so paths to resources can be resolved.
64 webrtc::test::SetExecutablePath(argv[0]);
65 google::ParseCommandLineFlags(&argc, &argv, true);
niklase@google.com470e71d2011-07-07 08:21:25 +000066
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000067 CmdArgs args;
68 if (ParseArguments(args) != 0) {
brykt@google.come8ef8072012-11-09 16:16:41 +000069 printf("Unable to parse input arguments\n");
brykt@google.come8ef8072012-11-09 16:16:41 +000070 return -1;
71 }
mikhal@webrtc.orgd70b77d2011-08-22 21:08:15 +000072
kjellander@webrtc.org971278a2013-03-08 10:20:53 +000073 printf("Running video coding tests...\n");
pbos@webrtc.orgd21406d2015-03-19 08:18:53 +000074 return RtpPlay(args);
niklase@google.com470e71d2011-07-07 08:21:25 +000075}