1/*
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
11#include <stdlib.h>
12#include <string.h>
13
14#include "gflags/gflags.h"
15#include "webrtc/modules/video_coding/include/video_coding.h"
16#include "webrtc/modules/video_coding/test/receiver_tests.h"
17#include "webrtc/test/testsupport/fileutils.h"
18
19DEFINE_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.");
22DEFINE_int32(rtt, 0, "RTT (round-trip time), in milliseconds.");
23DEFINE_string(input_filename,
24              webrtc::test::ProjectRootPath() + "/resources/foreman_cif.yuv",
25              "Input file.");
26DEFINE_string(output_filename,
27              webrtc::test::OutputPath() +
28                  "video_coding_test_output_352x288.yuv",
29              "Output file.");
30
31namespace webrtc {
32
33/*
34 * Build with EVENT_DEBUG defined
35 * to build the tests with simulated events.
36 */
37
38int vcmMacrosTests = 0;
39int vcmMacrosErrors = 0;
40
41int ParseArguments(CmdArgs* args) {
42  args->width = FLAGS_width;
43  args->height = FLAGS_height;
44  if (args->width < 1 || args->height < 1) {
45    return -1;
46  }
47  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;
54  } else {
55    printf("Invalid codec: %s\n", args->codecName.c_str());
56    return -1;
57  }
58  args->inputFile = FLAGS_input_filename;
59  args->outputFile = FLAGS_output_filename;
60  args->rtt = FLAGS_rtt;
61  return 0;
62}
63}  // namespace webrtc
64
65int main(int argc, char** argv) {
66  // Initialize WebRTC fileutils.h so paths to resources can be resolved.
67  webrtc::test::SetExecutablePath(argv[0]);
68  google::ParseCommandLineFlags(&argc, &argv, true);
69
70  CmdArgs args;
71  if (webrtc::ParseArguments(&args) != 0) {
72    printf("Unable to parse input arguments\n");
73    return -1;
74  }
75
76  printf("Running video coding tests...\n");
77  return RtpPlay(args);
78}
79