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