OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <stdlib.h> | 11 #include <stdlib.h> |
12 #include <string.h> | 12 #include <string.h> |
13 | 13 |
14 #include "gflags/gflags.h" | 14 #include "gflags/gflags.h" |
15 #include "webrtc/modules/video_coding/include/video_coding.h" | 15 #include "webrtc/modules/video_coding/include/video_coding.h" |
16 #include "webrtc/modules/video_coding/test/receiver_tests.h" | 16 #include "webrtc/modules/video_coding/test/receiver_tests.h" |
17 #include "webrtc/test/testsupport/fileutils.h" | 17 #include "webrtc/test/testsupport/fileutils.h" |
18 | 18 |
19 DEFINE_string(codec, "VP8", "Codec to use (VP8 or I420)."); | |
20 DEFINE_int32(width, 352, "Width in pixels of the frames in the input file."); | |
21 DEFINE_int32(height, 288, "Height in pixels of the frames in the input file."); | |
22 DEFINE_int32(rtt, 0, "RTT (round-trip time), in milliseconds."); | |
23 DEFINE_string(input_filename, | 19 DEFINE_string(input_filename, |
24 webrtc::test::ResourcePath("foreman_cif", "yuv"), | 20 webrtc::test::ResourcePath("foreman_cif", "yuv"), |
25 "Input file."); | 21 "Input file."); |
26 DEFINE_string(output_filename, | 22 DEFINE_string(output_filename, |
27 webrtc::test::OutputPath() + | 23 webrtc::test::OutputPath() + |
28 "video_coding_test_output_352x288.yuv", | 24 "video_coding_test_output_352x288.yuv", |
29 "Output file."); | 25 "Output file."); |
30 | 26 |
31 namespace webrtc { | 27 namespace webrtc { |
32 | 28 |
33 /* | 29 /* |
34 * Build with EVENT_DEBUG defined | 30 * Build with EVENT_DEBUG defined |
35 * to build the tests with simulated events. | 31 * to build the tests with simulated events. |
36 */ | 32 */ |
37 | 33 |
38 int vcmMacrosTests = 0; | 34 int vcmMacrosTests = 0; |
39 int vcmMacrosErrors = 0; | 35 int vcmMacrosErrors = 0; |
40 | 36 |
41 int ParseArguments(CmdArgs* args) { | 37 int 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; | 38 args->inputFile = FLAGS_input_filename; |
59 args->outputFile = FLAGS_output_filename; | 39 args->outputFile = FLAGS_output_filename; |
60 args->rtt = FLAGS_rtt; | 40 |
61 return 0; | 41 return 0; |
62 } | 42 } |
63 } // namespace webrtc | 43 } // namespace webrtc |
64 | 44 |
65 int main(int argc, char** argv) { | 45 int main(int argc, char** argv) { |
66 // Initialize WebRTC fileutils.h so paths to resources can be resolved. | 46 // Initialize WebRTC fileutils.h so paths to resources can be resolved. |
67 webrtc::test::SetExecutablePath(argv[0]); | 47 webrtc::test::SetExecutablePath(argv[0]); |
68 google::ParseCommandLineFlags(&argc, &argv, true); | 48 google::ParseCommandLineFlags(&argc, &argv, true); |
69 | 49 |
70 CmdArgs args; | 50 CmdArgs args; |
71 if (webrtc::ParseArguments(&args) != 0) { | 51 if (webrtc::ParseArguments(&args) != 0) { |
72 printf("Unable to parse input arguments\n"); | 52 printf("Unable to parse input arguments\n"); |
73 return -1; | 53 return -1; |
74 } | 54 } |
75 | 55 |
76 printf("Running video coding tests...\n"); | 56 printf("Running video coding tests...\n"); |
77 return RtpPlay(args); | 57 return RtpPlay(args); |
78 } | 58 } |
OLD | NEW |