henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 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 | |
Ivo Creusen | f81b0f1 | 2018-09-11 10:30:58 +0200 | [diff] [blame] | 11 | #include <iostream> |
| 12 | #include <string> |
henrik.lundin@webrtc.org | d94659d | 2013-01-29 12:09:21 +0000 | [diff] [blame] | 13 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 14 | #include "modules/audio_coding/neteq/tools/neteq_test.h" |
Ivo Creusen | 55de08e | 2018-09-03 11:49:27 +0200 | [diff] [blame] | 15 | #include "modules/audio_coding/neteq/tools/neteq_test_factory.h" |
Ivo Creusen | f81b0f1 | 2018-09-11 10:30:58 +0200 | [diff] [blame] | 16 | #include "rtc_base/flags.h" |
| 17 | #include "system_wrappers/include/field_trial_default.h" |
| 18 | #include "test/field_trial.h" |
| 19 | |
| 20 | DEFINE_bool(codec_map, |
| 21 | false, |
| 22 | "Prints the mapping between RTP payload type and " |
| 23 | "codec"); |
| 24 | DEFINE_string( |
| 25 | force_fieldtrials, |
| 26 | "", |
| 27 | "Field trials control experimental feature code which can be forced. " |
| 28 | "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" |
| 29 | " will assign the group Enable to field trial WebRTC-FooFeature."); |
| 30 | DEFINE_bool(help, false, "Prints this message"); |
henrik.lundin | 303d3e1 | 2016-05-26 05:56:03 -0700 | [diff] [blame] | 31 | |
| 32 | int main(int argc, char* argv[]) { |
Ivo Creusen | 55de08e | 2018-09-03 11:49:27 +0200 | [diff] [blame] | 33 | webrtc::test::NetEqTestFactory factory; |
Ivo Creusen | f81b0f1 | 2018-09-11 10:30:58 +0200 | [diff] [blame] | 34 | std::string program_name = argv[0]; |
| 35 | std::string usage = |
| 36 | "Tool for decoding an RTP dump file using NetEq.\n" |
| 37 | "Run " + |
| 38 | program_name + |
| 39 | " --help for usage.\n" |
| 40 | "Example usage:\n" + |
| 41 | program_name + " input.rtp output.{pcm, wav}\n"; |
| 42 | if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true)) { |
| 43 | exit(1); |
| 44 | } |
| 45 | if (FLAG_help) { |
| 46 | std::cout << usage; |
| 47 | rtc::FlagList::Print(nullptr, false); |
| 48 | exit(0); |
| 49 | } |
| 50 | if (FLAG_codec_map) { |
| 51 | factory.PrintCodecMap(); |
| 52 | } |
| 53 | if (argc != 3) { |
| 54 | if (FLAG_codec_map) { |
| 55 | // We have already printed the codec map. Just end the program. |
| 56 | exit(0); |
| 57 | } |
| 58 | // Print usage information. |
| 59 | std::cout << usage; |
| 60 | exit(0); |
| 61 | } |
| 62 | webrtc::test::ValidateFieldTrialsStringOrDie(FLAG_force_fieldtrials); |
| 63 | webrtc::field_trial::InitFieldTrialsFromString(FLAG_force_fieldtrials); |
Ivo Creusen | 55de08e | 2018-09-03 11:49:27 +0200 | [diff] [blame] | 64 | std::unique_ptr<webrtc::test::NetEqTest> test = |
Ivo Creusen | f81b0f1 | 2018-09-11 10:30:58 +0200 | [diff] [blame] | 65 | factory.InitializeTest(argv[1], argv[2]); |
Ivo Creusen | 55de08e | 2018-09-03 11:49:27 +0200 | [diff] [blame] | 66 | test->Run(); |
| 67 | return 0; |
henrik.lundin | 303d3e1 | 2016-05-26 05:56:03 -0700 | [diff] [blame] | 68 | } |