blob: d2dcdae4820a34e14858c424def09f6549ff91e3 [file] [log] [blame]
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +00001/*
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 Creusenf81b0f12018-09-11 10:30:58 +020011#include <iostream>
12#include <string>
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000013
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#include "modules/audio_coding/neteq/tools/neteq_test.h"
Ivo Creusen55de08e2018-09-03 11:49:27 +020015#include "modules/audio_coding/neteq/tools/neteq_test_factory.h"
Ivo Creusenf81b0f12018-09-11 10:30:58 +020016#include "rtc_base/flags.h"
17#include "system_wrappers/include/field_trial_default.h"
18#include "test/field_trial.h"
19
20DEFINE_bool(codec_map,
21 false,
22 "Prints the mapping between RTP payload type and "
23 "codec");
24DEFINE_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.");
30DEFINE_bool(help, false, "Prints this message");
henrik.lundin303d3e12016-05-26 05:56:03 -070031
32int main(int argc, char* argv[]) {
Ivo Creusen55de08e2018-09-03 11:49:27 +020033 webrtc::test::NetEqTestFactory factory;
Ivo Creusenf81b0f12018-09-11 10:30:58 +020034 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 Creusen55de08e2018-09-03 11:49:27 +020064 std::unique_ptr<webrtc::test::NetEqTest> test =
Ivo Creusenf81b0f12018-09-11 10:30:58 +020065 factory.InitializeTest(argv[1], argv[2]);
Ivo Creusen55de08e2018-09-03 11:49:27 +020066 test->Run();
67 return 0;
henrik.lundin303d3e12016-05-26 05:56:03 -070068}