Revert "NetEQ RTP Play: Optionally write output audio file"
This reverts commit 6330818ec8159ee476481ba4a89f884fb3653f3f.
Reason for revert: This breaks api/test/neteq_simulator_factory.cc, which unfortunately was not caught by our bots.
Original change's description:
> NetEQ RTP Play: Optionally write output audio file
>
> This CL makes the output audio file optional to more
> quickly run neteq_rtpplay when no audio output is needed.
> The CL also includes necessary adaptations because of pre-existing
> dependencies (e.g., the output audio file name is used to create
> the plotting script file names).
>
> The command line arguments are retro-compatible - i.e., same behavior
> when specifying the output audio file and the new flag
> --output_files_base_name is not used.
>
> This CL also includes a test script with which the retro-compatibility
> has been verified.
>
> Bug: webrtc:10337
> Change-Id: Ie3f301b3b2ed0682fb74426d9cf452396f2b112b
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126224
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#27067}
TBR=henrik.lundin@webrtc.org,alessiob@webrtc.org,ivoc@webrtc.org
Change-Id: I0c63a8ba9566ef567ee398f571f2a511916fa742
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10337
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/127293
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27078}
diff --git a/modules/audio_coding/neteq/tools/neteq_rtpplay.cc b/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
index 7ebc326..36c03b8 100644
--- a/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
+++ b/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
@@ -11,12 +11,9 @@
#include <iostream>
#include <string>
-#include "absl/strings/string_view.h"
-#include "absl/types/optional.h"
#include "modules/audio_coding/neteq/tools/neteq_test.h"
#include "modules/audio_coding/neteq/tools/neteq_test_factory.h"
#include "rtc_base/flags.h"
-#include "rtc_base/strings/string_builder.h"
#include "system_wrappers/include/field_trial.h"
#include "test/field_trial.h"
@@ -120,10 +117,6 @@
WEBRTC_DEFINE_int(video_timing,
TestConfig::default_video_timing(),
"Extension ID for video timing");
-WEBRTC_DEFINE_string(output_files_base_name,
- "",
- "Custom path used as prefix for the output files - i.e., "
- "matlab plot, python plot, text log.");
WEBRTC_DEFINE_bool(matlabplot,
false,
"Generates a matlab script for plotting the delay profile");
@@ -217,54 +210,6 @@
PrintCodecMappingEntry("comfort noise (48 kHz)", FLAG_cn_swb48);
}
-bool ValidateOutputFilesOptions(bool textlog,
- bool plotting,
- absl::string_view output_files_base_name,
- absl::string_view output_audio_filename) {
- bool output_files_base_name_specified = !output_files_base_name.empty();
- if (!textlog && !plotting && output_files_base_name_specified) {
- std::cout << "Error: --output_files_base_name cannot be used without at "
- << "least one of the following flags: --textlog, --matlabplot, "
- << "--pythonplot." << std::endl;
- return false;
- }
- // Without |output_audio_filename|, |output_files_base_name| is required when
- // one or more output files must be generated (in order to form a valid output
- // file name).
- if (output_audio_filename.empty() && (textlog || plotting) &&
- !output_files_base_name_specified) {
- std::cout << "Error: when no output audio file is specified and --textlog, "
- << "--matlabplot and/or --pythonplot are used, "
- << "--output_files_base_name must be also used." << std::endl;
- return false;
- }
- return true;
-}
-
-absl::optional<std::string> CreateOptionalOutputFileName(
- bool output_requested,
- absl::string_view basename,
- absl::string_view output_audio_filename,
- absl::string_view suffix) {
- if (!output_requested) {
- return absl::nullopt;
- }
- if (!basename.empty()) {
- // Override the automatic assignment.
- rtc::StringBuilder sb(basename);
- sb << suffix;
- return sb.str();
- }
- if (!output_audio_filename.empty()) {
- // Automatically assign name.
- rtc::StringBuilder sb(output_audio_filename);
- sb << suffix;
- return sb.str();
- }
- std::cout << "Error: invalid text log file parameters.";
- return absl::nullopt;
-}
-
} // namespace
int main(int argc, char* argv[]) {
@@ -276,7 +221,7 @@
program_name +
" --help for usage.\n"
"Example usage:\n" +
- program_name + " input.rtp [output.{pcm, wav}]\n";
+ program_name + " input.rtp output.{pcm, wav}\n";
if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true)) {
exit(1);
}
@@ -289,16 +234,11 @@
PrintCodecMapping();
exit(0);
}
- if (argc < 2 || argc > 3) { // The output audio file is optional.
+ if (argc != 3) {
// Print usage information.
std::cout << usage;
exit(0);
}
- const std::string output_audio_filename((argc == 3) ? argv[2] : "");
- const std::string output_files_base_name(FLAG_output_files_base_name);
- RTC_CHECK(ValidateOutputFilesOptions(
- FLAG_textlog, FLAG_matlabplot || FLAG_pythonplot, output_files_base_name,
- output_audio_filename));
RTC_CHECK(ValidatePayloadType(FLAG_pcmu));
RTC_CHECK(ValidatePayloadType(FLAG_pcma));
RTC_CHECK(ValidatePayloadType(FLAG_ilbc));
@@ -357,19 +297,10 @@
config.video_timing = FLAG_video_timing;
config.matlabplot = FLAG_matlabplot;
config.pythonplot = FLAG_pythonplot;
+ config.textlog = FLAG_textlog;
config.concealment_events = FLAG_concealment_events;
config.max_nr_packets_in_buffer = FLAG_max_nr_packets_in_buffer;
config.enable_fast_accelerate = FLAG_enable_fast_accelerate;
- if (!output_audio_filename.empty()) {
- config.output_audio_filename = output_audio_filename;
- }
- config.textlog_filename =
- CreateOptionalOutputFileName(FLAG_textlog, output_files_base_name,
- output_audio_filename, ".text_log.txt");
- config.plot_scripts_basename = CreateOptionalOutputFileName(
- FLAG_matlabplot || FLAG_pythonplot, output_files_base_name,
- output_audio_filename, "");
-
// Check if an SSRC value was provided.
if (strlen(FLAG_ssrc) > 0) {
uint32_t ssrc;
@@ -377,8 +308,8 @@
config.ssrc_filter = absl::make_optional(ssrc);
}
- std::unique_ptr<webrtc::test::NetEqTest> test = factory.InitializeTest(
- /*input_filename=*/argv[1], config);
+ std::unique_ptr<webrtc::test::NetEqTest> test =
+ factory.InitializeTest(argv[1], argv[2], config);
test->Run();
return 0;
}