blob: 1aa2780f0f19e091cacebd4bcc06311666957ac5 [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#include <stdlib.h>
12#include <string.h>
13
pbos@webrtc.orga4407322013-07-16 12:32:05 +000014#include "gflags/gflags.h"
Henrik Kjellander2557b862015-11-18 22:00:21 +010015#include "webrtc/modules/video_coding/include/video_coding.h"
16#include "webrtc/modules/video_coding/test/receiver_tests.h"
stefan@webrtc.org2baf5f52013-03-13 08:46:25 +000017#include "webrtc/test/testsupport/fileutils.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000018
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000019DEFINE_string(codec, "VP8", "Codec to use (VP8 or I420).");
20DEFINE_int32(width, 352, "Width in pixels of the frames in the input file.");
21DEFINE_int32(height, 288, "Height in pixels of the frames in the input file.");
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000022DEFINE_int32(rtt, 0, "RTT (round-trip time), in milliseconds.");
philipel5908c712015-12-21 08:23:20 -080023DEFINE_string(input_filename,
kjellander02060002016-02-16 22:06:12 -080024 webrtc::test::ResourcePath("foreman_cif", "yuv"),
philipel5908c712015-12-21 08:23:20 -080025 "Input file.");
26DEFINE_string(output_filename,
27 webrtc::test::OutputPath() +
28 "video_coding_test_output_352x288.yuv",
29 "Output file.");
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000030
philipel5908c712015-12-21 08:23:20 -080031namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000032
33/*
henrik.lundin@webrtc.org7d8c72e2011-12-21 15:24:01 +000034 * Build with EVENT_DEBUG defined
35 * to build the tests with simulated events.
niklase@google.com470e71d2011-07-07 08:21:25 +000036 */
37
holmer@google.come0f7d7b2011-08-03 07:49:56 +000038int vcmMacrosTests = 0;
39int vcmMacrosErrors = 0;
40
philipel5908c712015-12-21 08:23:20 -080041int ParseArguments(CmdArgs* args) {
42 args->width = FLAGS_width;
43 args->height = FLAGS_height;
44 if (args->width < 1 || args->height < 1) {
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000045 return -1;
46 }
philipel5908c712015-12-21 08:23:20 -080047 args->codecName = FLAGS_codec;
48 if (args->codecName == "VP8") {
49 args->codecType = kVideoCodecVP8;
50 } else if (args->codecName == "VP9") {
51 args->codecType = kVideoCodecVP9;
52 } else if (args->codecName == "I420") {
53 args->codecType = kVideoCodecI420;
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000054 } else {
philipel5908c712015-12-21 08:23:20 -080055 printf("Invalid codec: %s\n", args->codecName.c_str());
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000056 return -1;
57 }
philipel5908c712015-12-21 08:23:20 -080058 args->inputFile = FLAGS_input_filename;
59 args->outputFile = FLAGS_output_filename;
60 args->rtt = FLAGS_rtt;
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000061 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000062}
philipel5908c712015-12-21 08:23:20 -080063} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000064
philipel5908c712015-12-21 08:23:20 -080065int main(int argc, char** argv) {
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000066 // Initialize WebRTC fileutils.h so paths to resources can be resolved.
67 webrtc::test::SetExecutablePath(argv[0]);
68 google::ParseCommandLineFlags(&argc, &argv, true);
niklase@google.com470e71d2011-07-07 08:21:25 +000069
kjellander@webrtc.org81fb7bf2012-11-28 08:40:16 +000070 CmdArgs args;
philipel5908c712015-12-21 08:23:20 -080071 if (webrtc::ParseArguments(&args) != 0) {
brykt@google.come8ef8072012-11-09 16:16:41 +000072 printf("Unable to parse input arguments\n");
brykt@google.come8ef8072012-11-09 16:16:41 +000073 return -1;
74 }
mikhal@webrtc.orgd70b77d2011-08-22 21:08:15 +000075
kjellander@webrtc.org971278a2013-03-08 10:20:53 +000076 printf("Running video coding tests...\n");
pbos@webrtc.orgd21406d2015-03-19 08:18:53 +000077 return RtpPlay(args);
niklase@google.com470e71d2011-07-07 08:21:25 +000078}