Adopt absl::string_view in modules/audio_processing/
Bug: webrtc:13579 Change-Id: Idb05a64cfd16aed68d40cd427a6b516caa5e2077 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269387 Reviewed-by: Ivo Creusen <ivoc@webrtc.org> Commit-Queue: Ali Tofigh <alito@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37800}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
13b9f81b23
commit
f3592cb2a2
@ -311,7 +311,10 @@ rtc_library("apm_logging") {
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:stringutils",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
defines = []
|
||||
}
|
||||
|
||||
@ -425,7 +428,10 @@ if (rtc_include_tests) {
|
||||
"vad:vad_unittests",
|
||||
"//testing/gtest",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
defines = []
|
||||
|
||||
@ -498,6 +504,7 @@ if (rtc_include_tests) {
|
||||
"../../test:perf_test",
|
||||
"../../test:test_support",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
}
|
||||
|
||||
rtc_library("analog_mic_simulation") {
|
||||
@ -648,5 +655,8 @@ rtc_library("audioproc_test_utils") {
|
||||
"../audio_coding:neteq_input_audio_tools",
|
||||
"//testing/gtest",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
@ -157,7 +157,10 @@ rtc_library("aec3") {
|
||||
"../../../system_wrappers:metrics",
|
||||
"../utility:cascaded_biquad_filter",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||
deps += [ ":aec3_avx2" ]
|
||||
@ -208,6 +211,7 @@ rtc_source_set("adaptive_fir_filter") {
|
||||
"../../../api:array_view",
|
||||
"../../../rtc_base/system:arch",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
}
|
||||
|
||||
rtc_source_set("adaptive_fir_filter_erl") {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "modules/audio_processing/aec3/aec3_common.h"
|
||||
#include "modules/audio_processing/aec3/aec3_fft.h"
|
||||
@ -141,7 +142,7 @@ class AdaptiveFirFilter {
|
||||
// Returns the maximum number of partitions for the filter.
|
||||
size_t max_filter_size_partitions() const { return max_size_partitions_; }
|
||||
|
||||
void DumpFilter(const char* name_frequency_domain) {
|
||||
void DumpFilter(absl::string_view name_frequency_domain) {
|
||||
for (size_t p = 0; p < max_size_partitions_; ++p) {
|
||||
data_dumper_->DumpRaw(name_frequency_domain, H_[p][0].re);
|
||||
data_dumper_->DumpRaw(name_frequency_domain, H_[p][0].im);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/aec3/aec3_common.h"
|
||||
#include "modules/audio_processing/high_pass_filter.h"
|
||||
#include "modules/audio_processing/logging/apm_data_dumper.h"
|
||||
@ -37,7 +38,7 @@ bool DetectSaturation(rtc::ArrayView<const float> y) {
|
||||
// Retrieves a value from a field trial if it is available. If no value is
|
||||
// present, the default value is returned. If the retrieved value is beyond the
|
||||
// specified limits, the default value is returned instead.
|
||||
void RetrieveFieldTrialValue(const char* trial_name,
|
||||
void RetrieveFieldTrialValue(absl::string_view trial_name,
|
||||
float min,
|
||||
float max,
|
||||
float* value_to_update) {
|
||||
@ -57,7 +58,7 @@ void RetrieveFieldTrialValue(const char* trial_name,
|
||||
}
|
||||
}
|
||||
|
||||
void RetrieveFieldTrialValue(const char* trial_name,
|
||||
void RetrieveFieldTrialValue(absl::string_view trial_name,
|
||||
int min,
|
||||
int max,
|
||||
int* value_to_update) {
|
||||
|
@ -17,6 +17,7 @@ rtc_source_set("aec_dump") {
|
||||
"../../../rtc_base/system:file_wrapper",
|
||||
"../../../rtc_base/system:rtc_export",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
}
|
||||
|
||||
if (rtc_include_tests) {
|
||||
@ -75,6 +76,7 @@ if (rtc_enable_protobuf) {
|
||||
"../../../rtc_base/system:file_wrapper",
|
||||
"../../../system_wrappers",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
|
||||
deps += [ "../:audioproc_debug_proto" ]
|
||||
}
|
||||
@ -106,4 +108,5 @@ rtc_library("null_aec_dump_factory") {
|
||||
":aec_dump",
|
||||
"..:aec_dump_interface",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
#define MODULES_AUDIO_PROCESSING_AEC_DUMP_AEC_DUMP_FACTORY_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/include/aec_dump.h"
|
||||
#include "rtc_base/system/file_wrapper.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
@ -35,7 +35,7 @@ class RTC_EXPORT AecDumpFactory {
|
||||
static std::unique_ptr<AecDump> Create(webrtc::FileWrapper file,
|
||||
int64_t max_log_size_bytes,
|
||||
rtc::TaskQueue* worker_queue);
|
||||
static std::unique_ptr<AecDump> Create(std::string file_name,
|
||||
static std::unique_ptr<AecDump> Create(absl::string_view file_name,
|
||||
int64_t max_log_size_bytes,
|
||||
rtc::TaskQueue* worker_queue);
|
||||
static std::unique_ptr<AecDump> Create(FILE* handle,
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/aec_dump/aec_dump_factory.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/event.h"
|
||||
@ -264,7 +265,7 @@ std::unique_ptr<AecDump> AecDumpFactory::Create(webrtc::FileWrapper file,
|
||||
worker_queue);
|
||||
}
|
||||
|
||||
std::unique_ptr<AecDump> AecDumpFactory::Create(std::string file_name,
|
||||
std::unique_ptr<AecDump> AecDumpFactory::Create(absl::string_view file_name,
|
||||
int64_t max_log_size_bytes,
|
||||
rtc::TaskQueue* worker_queue) {
|
||||
return Create(FileWrapper::OpenWriteOnly(file_name), max_log_size_bytes,
|
||||
|
@ -8,6 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/aec_dump/aec_dump_factory.h"
|
||||
#include "modules/audio_processing/include/aec_dump.h"
|
||||
|
||||
@ -19,7 +20,7 @@ std::unique_ptr<AecDump> AecDumpFactory::Create(webrtc::FileWrapper file,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<AecDump> AecDumpFactory::Create(std::string file_name,
|
||||
std::unique_ptr<AecDump> AecDumpFactory::Create(absl::string_view file_name,
|
||||
int64_t max_log_size_bytes,
|
||||
rtc::TaskQueue* worker_queue) {
|
||||
return nullptr;
|
||||
|
@ -185,6 +185,9 @@ if (rtc_include_tests) {
|
||||
"../../../test:test_support",
|
||||
"//testing/gtest",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,9 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/agc/utility.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/file_utils.h"
|
||||
@ -35,7 +37,7 @@ const double kRelativeErrTol = 1e-10;
|
||||
|
||||
class LoudnessHistogramTest : public ::testing::Test {
|
||||
protected:
|
||||
void RunTest(bool enable_circular_buff, const char* filename);
|
||||
void RunTest(bool enable_circular_buff, absl::string_view filename);
|
||||
|
||||
private:
|
||||
void TestClean();
|
||||
@ -49,8 +51,8 @@ void LoudnessHistogramTest::TestClean() {
|
||||
}
|
||||
|
||||
void LoudnessHistogramTest::RunTest(bool enable_circular_buff,
|
||||
const char* filename) {
|
||||
FILE* in_file = fopen(filename, "rb");
|
||||
absl::string_view filename) {
|
||||
FILE* in_file = fopen(std::string(filename).c_str(), "rb");
|
||||
ASSERT_TRUE(in_file != NULL);
|
||||
if (enable_circular_buff) {
|
||||
int buffer_size;
|
||||
|
@ -101,8 +101,10 @@ rtc_library("fixed_digital") {
|
||||
"../../../rtc_base:gtest_prod",
|
||||
"../../../rtc_base:safe_conversions",
|
||||
"../../../rtc_base:safe_minmax",
|
||||
"../../../rtc_base:stringutils",
|
||||
"../../../system_wrappers:metrics",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
}
|
||||
|
||||
rtc_library("gain_applier") {
|
||||
|
@ -13,9 +13,11 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/agc2/agc2_common.h"
|
||||
#include "modules/audio_processing/logging/apm_data_dumper.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -30,15 +32,21 @@ constexpr std::array<float, kInterpolatedGainCurveTotalPoints>
|
||||
|
||||
InterpolatedGainCurve::InterpolatedGainCurve(
|
||||
ApmDataDumper* apm_data_dumper,
|
||||
const std::string& histogram_name_prefix)
|
||||
: region_logger_("WebRTC.Audio." + histogram_name_prefix +
|
||||
".FixedDigitalGainCurveRegion.Identity",
|
||||
"WebRTC.Audio." + histogram_name_prefix +
|
||||
".FixedDigitalGainCurveRegion.Knee",
|
||||
"WebRTC.Audio." + histogram_name_prefix +
|
||||
".FixedDigitalGainCurveRegion.Limiter",
|
||||
"WebRTC.Audio." + histogram_name_prefix +
|
||||
".FixedDigitalGainCurveRegion.Saturation"),
|
||||
absl::string_view histogram_name_prefix)
|
||||
: region_logger_(
|
||||
(rtc::StringBuilder("WebRTC.Audio.")
|
||||
<< histogram_name_prefix << ".FixedDigitalGainCurveRegion.Identity")
|
||||
.str(),
|
||||
(rtc::StringBuilder("WebRTC.Audio.")
|
||||
<< histogram_name_prefix << ".FixedDigitalGainCurveRegion.Knee")
|
||||
.str(),
|
||||
(rtc::StringBuilder("WebRTC.Audio.")
|
||||
<< histogram_name_prefix << ".FixedDigitalGainCurveRegion.Limiter")
|
||||
.str(),
|
||||
(rtc::StringBuilder("WebRTC.Audio.")
|
||||
<< histogram_name_prefix
|
||||
<< ".FixedDigitalGainCurveRegion.Saturation")
|
||||
.str()),
|
||||
apm_data_dumper_(apm_data_dumper) {}
|
||||
|
||||
InterpolatedGainCurve::~InterpolatedGainCurve() {
|
||||
@ -57,10 +65,10 @@ InterpolatedGainCurve::~InterpolatedGainCurve() {
|
||||
}
|
||||
|
||||
InterpolatedGainCurve::RegionLogger::RegionLogger(
|
||||
const std::string& identity_histogram_name,
|
||||
const std::string& knee_histogram_name,
|
||||
const std::string& limiter_histogram_name,
|
||||
const std::string& saturation_histogram_name)
|
||||
absl::string_view identity_histogram_name,
|
||||
absl::string_view knee_histogram_name,
|
||||
absl::string_view limiter_histogram_name,
|
||||
absl::string_view saturation_histogram_name)
|
||||
: identity_histogram(
|
||||
metrics::HistogramFactoryGetCounts(identity_histogram_name,
|
||||
1,
|
||||
|
@ -12,8 +12,8 @@
|
||||
#define MODULES_AUDIO_PROCESSING_AGC2_INTERPOLATED_GAIN_CURVE_H_
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/agc2/agc2_common.h"
|
||||
#include "rtc_base/gtest_prod_util.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
@ -60,7 +60,7 @@ class InterpolatedGainCurve {
|
||||
};
|
||||
|
||||
InterpolatedGainCurve(ApmDataDumper* apm_data_dumper,
|
||||
const std::string& histogram_name_prefix);
|
||||
absl::string_view histogram_name_prefix);
|
||||
~InterpolatedGainCurve();
|
||||
|
||||
InterpolatedGainCurve(const InterpolatedGainCurve&) = delete;
|
||||
@ -86,10 +86,10 @@ class InterpolatedGainCurve {
|
||||
metrics::Histogram* limiter_histogram;
|
||||
metrics::Histogram* saturation_histogram;
|
||||
|
||||
RegionLogger(const std::string& identity_histogram_name,
|
||||
const std::string& knee_histogram_name,
|
||||
const std::string& limiter_histogram_name,
|
||||
const std::string& saturation_histogram_name);
|
||||
RegionLogger(absl::string_view identity_histogram_name,
|
||||
absl::string_view knee_histogram_name,
|
||||
absl::string_view limiter_histogram_name,
|
||||
absl::string_view saturation_histogram_name);
|
||||
|
||||
~RegionLogger();
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "modules/audio_processing/agc2/agc2_common.h"
|
||||
#include "modules/audio_processing/logging/apm_data_dumper.h"
|
||||
@ -95,7 +96,7 @@ void CheckLimiterSampleRate(int sample_rate_hz) {
|
||||
|
||||
Limiter::Limiter(int sample_rate_hz,
|
||||
ApmDataDumper* apm_data_dumper,
|
||||
const std::string& histogram_name)
|
||||
absl::string_view histogram_name)
|
||||
: interp_gain_curve_(apm_data_dumper, histogram_name),
|
||||
level_estimator_(sample_rate_hz, apm_data_dumper),
|
||||
apm_data_dumper_(apm_data_dumper) {
|
||||
|
@ -11,9 +11,9 @@
|
||||
#ifndef MODULES_AUDIO_PROCESSING_AGC2_LIMITER_H_
|
||||
#define MODULES_AUDIO_PROCESSING_AGC2_LIMITER_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/agc2/fixed_digital_level_estimator.h"
|
||||
#include "modules/audio_processing/agc2/interpolated_gain_curve.h"
|
||||
#include "modules/audio_processing/include/audio_frame_view.h"
|
||||
@ -25,7 +25,7 @@ class Limiter {
|
||||
public:
|
||||
Limiter(int sample_rate_hz,
|
||||
ApmDataDumper* apm_data_dumper,
|
||||
const std::string& histogram_name_prefix);
|
||||
absl::string_view histogram_name_prefix);
|
||||
Limiter(const Limiter& limiter) = delete;
|
||||
Limiter& operator=(const Limiter& limiter) = delete;
|
||||
~Limiter();
|
||||
|
@ -230,6 +230,7 @@ if (rtc_include_tests) {
|
||||
"../../../../test:fileutils",
|
||||
"../../../../test:test_support",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
}
|
||||
|
||||
unittest_resources = [
|
||||
|
@ -13,9 +13,11 @@
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/numerics/safe_compare.h"
|
||||
#include "test/gtest.h"
|
||||
@ -31,8 +33,8 @@ template <typename T>
|
||||
class FloatFileReader : public FileReader {
|
||||
public:
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
FloatFileReader(const std::string& filename)
|
||||
: is_(filename, std::ios::binary | std::ios::ate),
|
||||
explicit FloatFileReader(absl::string_view filename)
|
||||
: is_(std::string(filename), std::ios::binary | std::ios::ate),
|
||||
size_(is_.tellg() / sizeof(T)) {
|
||||
RTC_CHECK(is_);
|
||||
SeekBeginning();
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "modules/audio_processing/agc2/rnn_vad/common.h"
|
||||
#include "rtc_base/checks.h"
|
||||
@ -109,8 +110,8 @@ class PitchTestData {
|
||||
// Writer for binary files.
|
||||
class FileWriter {
|
||||
public:
|
||||
explicit FileWriter(const std::string& file_path)
|
||||
: os_(file_path, std::ios::binary) {}
|
||||
explicit FileWriter(absl::string_view file_path)
|
||||
: os_(std::string(file_path), std::ios::binary) {}
|
||||
FileWriter(const FileWriter&) = delete;
|
||||
FileWriter& operator=(const FileWriter&) = delete;
|
||||
~FileWriter() = default;
|
||||
|
@ -1654,8 +1654,8 @@ int AudioProcessingImpl::recommended_stream_analog_level_locked() const {
|
||||
bool AudioProcessingImpl::CreateAndAttachAecDump(absl::string_view file_name,
|
||||
int64_t max_log_size_bytes,
|
||||
rtc::TaskQueue* worker_queue) {
|
||||
std::unique_ptr<AecDump> aec_dump = AecDumpFactory::Create(
|
||||
std::string(file_name), max_log_size_bytes, worker_queue);
|
||||
std::unique_ptr<AecDump> aec_dump =
|
||||
AecDumpFactory::Create(file_name, max_log_size_bytes, worker_queue);
|
||||
if (!aec_dump) {
|
||||
return false;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "modules/audio_processing/audio_processing_impl.h"
|
||||
#include "modules/audio_processing/test/audio_processing_builder_for_testing.h"
|
||||
@ -212,7 +213,7 @@ class TimedThreadApiProcessor {
|
||||
bool Process();
|
||||
|
||||
// Method for printing out the simulation statistics.
|
||||
void print_processor_statistics(const std::string& processor_name) const {
|
||||
void print_processor_statistics(absl::string_view processor_name) const {
|
||||
const std::string modifier = "_api_call_duration";
|
||||
|
||||
const std::string sample_rate_name =
|
||||
|
@ -18,8 +18,10 @@
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio/echo_detector_creator.h"
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "common_audio/include/audio_util.h"
|
||||
@ -202,9 +204,9 @@ int16_t MaxAudioFrame(const Int16FrameData& frame) {
|
||||
return max_data;
|
||||
}
|
||||
|
||||
void OpenFileAndWriteMessage(const std::string& filename,
|
||||
void OpenFileAndWriteMessage(absl::string_view filename,
|
||||
const MessageLite& msg) {
|
||||
FILE* file = fopen(filename.c_str(), "wb");
|
||||
FILE* file = fopen(std::string(filename).c_str(), "wb");
|
||||
ASSERT_TRUE(file != NULL);
|
||||
|
||||
int32_t size = rtc::checked_cast<int32_t>(msg.ByteSizeLong());
|
||||
@ -218,7 +220,7 @@ void OpenFileAndWriteMessage(const std::string& filename,
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
std::string ResourceFilePath(const std::string& name, int sample_rate_hz) {
|
||||
std::string ResourceFilePath(absl::string_view name, int sample_rate_hz) {
|
||||
rtc::StringBuilder ss;
|
||||
// Resource files are all stereo.
|
||||
ss << name << sample_rate_hz / 1000 << "_stereo";
|
||||
@ -230,7 +232,7 @@ std::string ResourceFilePath(const std::string& name, int sample_rate_hz) {
|
||||
// have competing filenames.
|
||||
std::map<std::string, std::string> temp_filenames;
|
||||
|
||||
std::string OutputFilePath(const std::string& name,
|
||||
std::string OutputFilePath(absl::string_view name,
|
||||
int input_rate,
|
||||
int output_rate,
|
||||
int reverse_input_rate,
|
||||
@ -285,8 +287,8 @@ void ClearTempOutFiles() {
|
||||
}
|
||||
}
|
||||
|
||||
void OpenFileAndReadMessage(const std::string& filename, MessageLite* msg) {
|
||||
FILE* file = fopen(filename.c_str(), "rb");
|
||||
void OpenFileAndReadMessage(absl::string_view filename, MessageLite* msg) {
|
||||
FILE* file = fopen(std::string(filename).c_str(), "rb");
|
||||
ASSERT_TRUE(file != NULL);
|
||||
ReadMessageFromFile(file, msg);
|
||||
fclose(file);
|
||||
@ -447,8 +449,8 @@ class ApmTest : public ::testing::Test {
|
||||
void StreamParametersTest(Format format);
|
||||
int ProcessStreamChooser(Format format);
|
||||
int AnalyzeReverseStreamChooser(Format format);
|
||||
void ProcessDebugDump(const std::string& in_filename,
|
||||
const std::string& out_filename,
|
||||
void ProcessDebugDump(absl::string_view in_filename,
|
||||
absl::string_view out_filename,
|
||||
Format format,
|
||||
int max_size_bytes);
|
||||
void VerifyDebugDumpTest(Format format);
|
||||
@ -1457,12 +1459,12 @@ TEST_F(ApmTest, SplittingFilter) {
|
||||
}
|
||||
|
||||
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
|
||||
void ApmTest::ProcessDebugDump(const std::string& in_filename,
|
||||
const std::string& out_filename,
|
||||
void ApmTest::ProcessDebugDump(absl::string_view in_filename,
|
||||
absl::string_view out_filename,
|
||||
Format format,
|
||||
int max_size_bytes) {
|
||||
TaskQueueForTest worker_queue("ApmTest_worker_queue");
|
||||
FILE* in_file = fopen(in_filename.c_str(), "rb");
|
||||
FILE* in_file = fopen(std::string(in_filename).c_str(), "rb");
|
||||
ASSERT_TRUE(in_file != NULL);
|
||||
audioproc::Event event_msg;
|
||||
bool first_init = true;
|
||||
@ -1990,7 +1992,7 @@ class AudioProcessingTest
|
||||
size_t num_output_channels,
|
||||
size_t num_reverse_input_channels,
|
||||
size_t num_reverse_output_channels,
|
||||
const std::string& output_file_prefix) {
|
||||
absl::string_view output_file_prefix) {
|
||||
AudioProcessing::Config apm_config;
|
||||
apm_config.gain_controller1.analog_gain_controller.enabled = false;
|
||||
rtc::scoped_refptr<AudioProcessing> ap =
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "modules/audio_processing/logging/apm_data_dumper.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
|
||||
// Check to verify that the define is properly set.
|
||||
@ -29,17 +30,16 @@ constexpr char kPathDelimiter = '\\';
|
||||
constexpr char kPathDelimiter = '/';
|
||||
#endif
|
||||
|
||||
std::string FormFileName(const char* output_dir,
|
||||
const char* name,
|
||||
std::string FormFileName(absl::string_view output_dir,
|
||||
absl::string_view name,
|
||||
int instance_index,
|
||||
int reinit_index,
|
||||
const std::string& suffix) {
|
||||
absl::string_view suffix) {
|
||||
char buf[1024];
|
||||
rtc::SimpleStringBuilder ss(buf);
|
||||
const size_t output_dir_size = strlen(output_dir);
|
||||
if (output_dir_size > 0) {
|
||||
if (!output_dir.empty()) {
|
||||
ss << output_dir;
|
||||
if (output_dir[output_dir_size - 1] != kPathDelimiter) {
|
||||
if (output_dir.back() != kPathDelimiter) {
|
||||
ss << kPathDelimiter;
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ bool ApmDataDumper::recording_activated_ = false;
|
||||
absl::optional<int> ApmDataDumper::dump_set_to_use_;
|
||||
char ApmDataDumper::output_dir_[] = "";
|
||||
|
||||
FILE* ApmDataDumper::GetRawFile(const char* name) {
|
||||
FILE* ApmDataDumper::GetRawFile(absl::string_view name) {
|
||||
std::string filename = FormFileName(output_dir_, name, instance_index_,
|
||||
recording_set_index_, ".dat");
|
||||
auto& f = raw_files_[filename];
|
||||
@ -75,7 +75,7 @@ FILE* ApmDataDumper::GetRawFile(const char* name) {
|
||||
return f.get();
|
||||
}
|
||||
|
||||
WavWriter* ApmDataDumper::GetWavFile(const char* name,
|
||||
WavWriter* ApmDataDumper::GetWavFile(absl::string_view name,
|
||||
int sample_rate_hz,
|
||||
int num_channels,
|
||||
WavFile::SampleFormat format) {
|
||||
|
@ -13,19 +13,20 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#endif
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/array_view.h"
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
#include "common_audio/wav_file.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/string_utils.h"
|
||||
#endif
|
||||
|
||||
// Check to verify that the define is properly set.
|
||||
@ -87,10 +88,10 @@ class ApmDataDumper {
|
||||
}
|
||||
|
||||
// Set an optional output directory.
|
||||
static void SetOutputDirectory(const std::string& output_dir) {
|
||||
static void SetOutputDirectory(absl::string_view output_dir) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
RTC_CHECK_LT(output_dir.size(), kOutputDirMaxLength);
|
||||
strncpy(output_dir_, output_dir.c_str(), output_dir.size());
|
||||
rtc::strcpyn(output_dir_, output_dir.size(), output_dir);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -104,7 +105,9 @@ class ApmDataDumper {
|
||||
|
||||
// Methods for performing dumping of data of various types into
|
||||
// various formats.
|
||||
void DumpRaw(const char* name, double v, int dump_set = kDefaultDumpSet) {
|
||||
void DumpRaw(absl::string_view name,
|
||||
double v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
if (dump_set_to_use_ && *dump_set_to_use_ != dump_set)
|
||||
return;
|
||||
@ -116,7 +119,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
size_t v_length,
|
||||
const double* v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
@ -131,7 +134,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
rtc::ArrayView<const double> v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
@ -144,7 +147,9 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name, float v, int dump_set = kDefaultDumpSet) {
|
||||
void DumpRaw(absl::string_view name,
|
||||
float v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
if (dump_set_to_use_ && *dump_set_to_use_ != dump_set)
|
||||
return;
|
||||
@ -156,7 +161,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
size_t v_length,
|
||||
const float* v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
@ -171,7 +176,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
rtc::ArrayView<const float> v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
@ -184,7 +189,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name, bool v, int dump_set = kDefaultDumpSet) {
|
||||
void DumpRaw(absl::string_view name, bool v, int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
if (dump_set_to_use_ && *dump_set_to_use_ != dump_set)
|
||||
return;
|
||||
@ -195,7 +200,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
size_t v_length,
|
||||
const bool* v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
@ -213,7 +218,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
rtc::ArrayView<const bool> v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
@ -226,7 +231,9 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name, int16_t v, int dump_set = kDefaultDumpSet) {
|
||||
void DumpRaw(absl::string_view name,
|
||||
int16_t v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
if (dump_set_to_use_ && *dump_set_to_use_ != dump_set)
|
||||
return;
|
||||
@ -238,7 +245,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
size_t v_length,
|
||||
const int16_t* v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
@ -253,7 +260,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
rtc::ArrayView<const int16_t> v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
@ -266,7 +273,9 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name, int32_t v, int dump_set = kDefaultDumpSet) {
|
||||
void DumpRaw(absl::string_view name,
|
||||
int32_t v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
if (dump_set_to_use_ && *dump_set_to_use_ != dump_set)
|
||||
return;
|
||||
@ -278,7 +287,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
size_t v_length,
|
||||
const int32_t* v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
@ -293,7 +302,9 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name, size_t v, int dump_set = kDefaultDumpSet) {
|
||||
void DumpRaw(absl::string_view name,
|
||||
size_t v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
if (dump_set_to_use_ && *dump_set_to_use_ != dump_set)
|
||||
return;
|
||||
@ -305,7 +316,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
size_t v_length,
|
||||
const size_t* v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
@ -320,7 +331,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
rtc::ArrayView<const int32_t> v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
@ -333,7 +344,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpRaw(const char* name,
|
||||
void DumpRaw(absl::string_view name,
|
||||
rtc::ArrayView<const size_t> v,
|
||||
int dump_set = kDefaultDumpSet) {
|
||||
#if WEBRTC_APM_DEBUG_DUMP == 1
|
||||
@ -344,7 +355,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpWav(const char* name,
|
||||
void DumpWav(absl::string_view name,
|
||||
size_t v_length,
|
||||
const float* v,
|
||||
int sample_rate_hz,
|
||||
@ -362,7 +373,7 @@ class ApmDataDumper {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DumpWav(const char* name,
|
||||
void DumpWav(absl::string_view name,
|
||||
rtc::ArrayView<const float> v,
|
||||
int sample_rate_hz,
|
||||
int num_channels,
|
||||
@ -389,8 +400,8 @@ class ApmDataDumper {
|
||||
raw_files_;
|
||||
std::unordered_map<std::string, std::unique_ptr<WavWriter>> wav_files_;
|
||||
|
||||
FILE* GetRawFile(const char* name);
|
||||
WavWriter* GetWavFile(const char* name,
|
||||
FILE* GetRawFile(absl::string_view name);
|
||||
WavWriter* GetWavFile(absl::string_view name,
|
||||
int sample_rate_hz,
|
||||
int num_channels,
|
||||
WavFile::SampleFormat format);
|
||||
|
@ -15,7 +15,9 @@
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -72,9 +74,9 @@ void ApiCallStatistics::PrintReport() const {
|
||||
<< " avg: " << avg_capture << " us" << std::endl;
|
||||
}
|
||||
|
||||
void ApiCallStatistics::WriteReportToFile(const std::string& filename) const {
|
||||
void ApiCallStatistics::WriteReportToFile(absl::string_view filename) const {
|
||||
std::unique_ptr<std::ofstream> out =
|
||||
std::make_unique<std::ofstream>(filename);
|
||||
std::make_unique<std::ofstream>(std::string(filename));
|
||||
for (auto v : calls_) {
|
||||
if (v.call_type == CallType::kRender) {
|
||||
*out << "render, ";
|
||||
|
@ -11,9 +11,10 @@
|
||||
#ifndef MODULES_AUDIO_PROCESSING_TEST_API_CALL_STATISTICS_H_
|
||||
#define MODULES_AUDIO_PROCESSING_TEST_API_CALL_STATISTICS_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
@ -29,7 +30,7 @@ class ApiCallStatistics {
|
||||
void PrintReport() const;
|
||||
|
||||
// Writes the call information to a file.
|
||||
void WriteReportToFile(const std::string& filename) const;
|
||||
void WriteReportToFile(absl::string_view filename) const;
|
||||
|
||||
private:
|
||||
struct CallData {
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio/echo_canceller3_config_json.h"
|
||||
#include "api/audio/echo_canceller3_factory.h"
|
||||
#include "api/audio/echo_detector_creator.h"
|
||||
@ -35,10 +36,10 @@ namespace webrtc {
|
||||
namespace test {
|
||||
namespace {
|
||||
// Helper for reading JSON from a file and parsing it to an AEC3 configuration.
|
||||
EchoCanceller3Config ReadAec3ConfigFromJsonFile(const std::string& filename) {
|
||||
EchoCanceller3Config ReadAec3ConfigFromJsonFile(absl::string_view filename) {
|
||||
std::string json_string;
|
||||
std::string s;
|
||||
std::ifstream f(filename.c_str());
|
||||
std::ifstream f(std::string(filename).c_str());
|
||||
if (f.fail()) {
|
||||
std::cout << "Failed to open the file " << filename << std::endl;
|
||||
RTC_CHECK_NOTREACHED();
|
||||
@ -60,7 +61,7 @@ EchoCanceller3Config ReadAec3ConfigFromJsonFile(const std::string& filename) {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
std::string GetIndexedOutputWavFilename(const std::string& wav_name,
|
||||
std::string GetIndexedOutputWavFilename(absl::string_view wav_name,
|
||||
int counter) {
|
||||
rtc::StringBuilder ss;
|
||||
ss << wav_name.substr(0, wav_name.size() - 4) << "_" << counter
|
||||
@ -89,11 +90,11 @@ void WriteEchoLikelihoodGraphFileFooter(std::ofstream* output_file) {
|
||||
// leaving the enclosing scope.
|
||||
class ScopedTimer {
|
||||
public:
|
||||
ScopedTimer(ApiCallStatistics* api_call_statistics_,
|
||||
ScopedTimer(ApiCallStatistics* api_call_statistics,
|
||||
ApiCallStatistics::CallType call_type)
|
||||
: start_time_(rtc::TimeNanos()),
|
||||
call_type_(call_type),
|
||||
api_call_statistics_(api_call_statistics_) {}
|
||||
api_call_statistics_(api_call_statistics) {}
|
||||
|
||||
~ScopedTimer() {
|
||||
api_call_statistics_->Add(rtc::TimeNanos() - start_time_, call_type_);
|
||||
|
@ -334,10 +334,10 @@ const char kUsageDescription[] =
|
||||
"processing module, either based on wav files or "
|
||||
"protobuf debug dump recordings.\n";
|
||||
|
||||
void SetSettingIfSpecified(const std::string& value,
|
||||
void SetSettingIfSpecified(absl::string_view value,
|
||||
absl::optional<std::string>* parameter) {
|
||||
if (value.compare("") != 0) {
|
||||
*parameter = value;
|
||||
*parameter = std::string(value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ SimulationSettings CreateSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
void ReportConditionalErrorAndExit(bool condition, const std::string& message) {
|
||||
void ReportConditionalErrorAndExit(bool condition, absl::string_view message) {
|
||||
if (condition) {
|
||||
std::cerr << message << std::endl;
|
||||
exit(1);
|
||||
@ -640,7 +640,7 @@ void PerformBasicParameterSanityChecks(
|
||||
"Error: --simulated_mic_kind must be specified when mic simulation is "
|
||||
"enabled\n");
|
||||
|
||||
auto valid_wav_name = [](const std::string& wav_file_name) {
|
||||
auto valid_wav_name = [](absl::string_view wav_file_name) {
|
||||
if (wav_file_name.size() < 5) {
|
||||
return false;
|
||||
}
|
||||
|
@ -74,5 +74,8 @@ rtc_library("unittest") {
|
||||
"../../../../test:test_support",
|
||||
"//testing/gtest",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
@ -13,14 +13,16 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
namespace conversational_speech {
|
||||
|
||||
struct Config {
|
||||
Config(const std::string& audiotracks_path,
|
||||
const std::string& timing_filepath,
|
||||
const std::string& output_path)
|
||||
Config(absl::string_view audiotracks_path,
|
||||
absl::string_view timing_filepath,
|
||||
absl::string_view output_path)
|
||||
: audiotracks_path_(audiotracks_path),
|
||||
timing_filepath_(timing_filepath),
|
||||
output_path_(output_path) {}
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "common_audio/wav_file.h"
|
||||
#include "modules/audio_processing/test/conversational_speech/config.h"
|
||||
@ -98,7 +99,7 @@ std::unique_ptr<MockWavReaderFactory> CreateMockWavReaderFactory() {
|
||||
kDefaultMockWavReaderFactoryParamsMap));
|
||||
}
|
||||
|
||||
void CreateSineWavFile(const std::string& filepath,
|
||||
void CreateSineWavFile(absl::string_view filepath,
|
||||
const MockWavReaderFactory::Params& params,
|
||||
float frequency = 440.0f) {
|
||||
// Create samples.
|
||||
@ -139,7 +140,7 @@ std::string CreateTemporarySineAudioTracks(
|
||||
}
|
||||
|
||||
void CheckAudioTrackParams(const WavReaderFactory& wav_reader_factory,
|
||||
const std::string& filepath,
|
||||
absl::string_view filepath,
|
||||
const MockWavReaderFactory::Params& expeted_params) {
|
||||
auto wav_reader = wav_reader_factory.Create(filepath);
|
||||
EXPECT_EQ(expeted_params.sample_rate, wav_reader->SampleRate());
|
||||
@ -147,7 +148,7 @@ void CheckAudioTrackParams(const WavReaderFactory& wav_reader_factory,
|
||||
EXPECT_EQ(expeted_params.num_samples, wav_reader->NumSamples());
|
||||
}
|
||||
|
||||
void DeleteFolderAndContents(const std::string& dir) {
|
||||
void DeleteFolderAndContents(absl::string_view dir) {
|
||||
if (!DirExists(dir)) {
|
||||
return;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "modules/audio_processing/test/conversational_speech/mock_wavreader_factory.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/test/conversational_speech/mock_wavreader.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "test/gmock.h"
|
||||
@ -36,11 +37,11 @@ MockWavReaderFactory::MockWavReaderFactory(const Params& default_params)
|
||||
MockWavReaderFactory::~MockWavReaderFactory() = default;
|
||||
|
||||
std::unique_ptr<WavReaderInterface> MockWavReaderFactory::CreateMock(
|
||||
const std::string& filepath) {
|
||||
absl::string_view filepath) {
|
||||
// Search the parameters corresponding to filepath.
|
||||
size_t delimiter = filepath.find_last_of("/\\"); // Either windows or posix
|
||||
std::string filename =
|
||||
filepath.substr(delimiter == std::string::npos ? 0 : delimiter + 1);
|
||||
std::string filename(filepath.substr(
|
||||
delimiter == absl::string_view::npos ? 0 : delimiter + 1));
|
||||
const auto it = audiotrack_names_params_.find(filename);
|
||||
|
||||
// If not found, use default parameters.
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/test/conversational_speech/wavreader_abstract_factory.h"
|
||||
#include "modules/audio_processing/test/conversational_speech/wavreader_interface.h"
|
||||
#include "test/gmock.h"
|
||||
@ -38,14 +39,14 @@ class MockWavReaderFactory : public WavReaderAbstractFactory {
|
||||
|
||||
MOCK_METHOD(std::unique_ptr<WavReaderInterface>,
|
||||
Create,
|
||||
(const std::string&),
|
||||
(absl::string_view),
|
||||
(const, override));
|
||||
|
||||
private:
|
||||
// Creates a MockWavReader instance using the parameters in
|
||||
// audiotrack_names_params_ if the entry corresponding to filepath exists,
|
||||
// otherwise creates a MockWavReader instance using the default parameters.
|
||||
std::unique_ptr<WavReaderInterface> CreateMock(const std::string& filepath);
|
||||
std::unique_ptr<WavReaderInterface> CreateMock(absl::string_view filepath);
|
||||
|
||||
const Params& default_params_;
|
||||
std::map<std::string, const Params> audiotrack_names_params_;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "test/testsupport/file_utils.h"
|
||||
|
||||
@ -22,7 +23,7 @@ namespace conversational_speech {
|
||||
|
||||
MultiEndCall::MultiEndCall(
|
||||
rtc::ArrayView<const Turn> timing,
|
||||
const std::string& audiotracks_path,
|
||||
absl::string_view audiotracks_path,
|
||||
std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory)
|
||||
: timing_(timing),
|
||||
audiotracks_path_(audiotracks_path),
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "modules/audio_processing/test/conversational_speech/timing.h"
|
||||
#include "modules/audio_processing/test/conversational_speech/wavreader_abstract_factory.h"
|
||||
@ -33,13 +34,13 @@ class MultiEndCall {
|
||||
public:
|
||||
struct SpeakingTurn {
|
||||
// Constructor required in order to use std::vector::emplace_back().
|
||||
SpeakingTurn(std::string new_speaker_name,
|
||||
std::string new_audiotrack_file_name,
|
||||
SpeakingTurn(absl::string_view new_speaker_name,
|
||||
absl::string_view new_audiotrack_file_name,
|
||||
size_t new_begin,
|
||||
size_t new_end,
|
||||
int gain)
|
||||
: speaker_name(std::move(new_speaker_name)),
|
||||
audiotrack_file_name(std::move(new_audiotrack_file_name)),
|
||||
: speaker_name(new_speaker_name),
|
||||
audiotrack_file_name(new_audiotrack_file_name),
|
||||
begin(new_begin),
|
||||
end(new_end),
|
||||
gain(gain) {}
|
||||
@ -52,7 +53,7 @@ class MultiEndCall {
|
||||
|
||||
MultiEndCall(
|
||||
rtc::ArrayView<const Turn> timing,
|
||||
const std::string& audiotracks_path,
|
||||
absl::string_view audiotracks_path,
|
||||
std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory);
|
||||
~MultiEndCall();
|
||||
|
||||
@ -85,7 +86,7 @@ class MultiEndCall {
|
||||
bool CheckTiming();
|
||||
|
||||
rtc::ArrayView<const Turn> timing_;
|
||||
const std::string& audiotracks_path_;
|
||||
std::string audiotracks_path_;
|
||||
std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory_;
|
||||
std::set<std::string> speaker_names_;
|
||||
std::map<std::string, std::unique_ptr<WavReaderInterface>>
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "common_audio/include/audio_util.h"
|
||||
#include "common_audio/wav_file.h"
|
||||
@ -38,7 +39,7 @@ using conversational_speech::WavReaderInterface;
|
||||
// the near-end and far=end audio tracks.
|
||||
std::unique_ptr<std::map<std::string, SpeakerOutputFilePaths>>
|
||||
InitSpeakerOutputFilePaths(const std::set<std::string>& speaker_names,
|
||||
const std::string& output_path) {
|
||||
absl::string_view output_path) {
|
||||
// Create map.
|
||||
auto speaker_output_file_paths_map =
|
||||
std::make_unique<std::map<std::string, SpeakerOutputFilePaths>>();
|
||||
@ -174,7 +175,7 @@ namespace conversational_speech {
|
||||
|
||||
std::unique_ptr<std::map<std::string, SpeakerOutputFilePaths>> Simulate(
|
||||
const MultiEndCall& multiend_call,
|
||||
const std::string& output_path) {
|
||||
absl::string_view output_path) {
|
||||
// Set output file paths and initialize wav writers.
|
||||
const auto& speaker_names = multiend_call.speaker_names();
|
||||
auto speaker_output_file_paths =
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/test/conversational_speech/multiend_call.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -23,8 +24,8 @@ namespace test {
|
||||
namespace conversational_speech {
|
||||
|
||||
struct SpeakerOutputFilePaths {
|
||||
SpeakerOutputFilePaths(const std::string& new_near_end,
|
||||
const std::string& new_far_end)
|
||||
SpeakerOutputFilePaths(absl::string_view new_near_end,
|
||||
absl::string_view new_far_end)
|
||||
: near_end(new_near_end), far_end(new_far_end) {}
|
||||
// Paths to the near-end and far-end audio track files.
|
||||
const std::string near_end;
|
||||
@ -34,7 +35,7 @@ struct SpeakerOutputFilePaths {
|
||||
// Generates the near-end and far-end audio track pairs for each speaker.
|
||||
std::unique_ptr<std::map<std::string, SpeakerOutputFilePaths>> Simulate(
|
||||
const MultiEndCall& multiend_call,
|
||||
const std::string& output_path);
|
||||
absl::string_view output_path);
|
||||
|
||||
} // namespace conversational_speech
|
||||
} // namespace test
|
||||
|
@ -12,7 +12,9 @@
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/string_encode.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -25,9 +27,9 @@ bool Turn::operator==(const Turn& b) const {
|
||||
b.gain == gain;
|
||||
}
|
||||
|
||||
std::vector<Turn> LoadTiming(const std::string& timing_filepath) {
|
||||
std::vector<Turn> LoadTiming(absl::string_view timing_filepath) {
|
||||
// Line parser.
|
||||
auto parse_line = [](const std::string& line) {
|
||||
auto parse_line = [](absl::string_view line) {
|
||||
std::vector<absl::string_view> fields = rtc::split(line, ' ');
|
||||
RTC_CHECK_GE(fields.size(), 3);
|
||||
RTC_CHECK_LE(fields.size(), 4);
|
||||
@ -44,7 +46,7 @@ std::vector<Turn> LoadTiming(const std::string& timing_filepath) {
|
||||
|
||||
// Parse lines.
|
||||
std::string line;
|
||||
std::ifstream infile(timing_filepath);
|
||||
std::ifstream infile(std::string{timing_filepath});
|
||||
while (std::getline(infile, line)) {
|
||||
if (line.empty())
|
||||
continue;
|
||||
@ -55,9 +57,9 @@ std::vector<Turn> LoadTiming(const std::string& timing_filepath) {
|
||||
return timing;
|
||||
}
|
||||
|
||||
void SaveTiming(const std::string& timing_filepath,
|
||||
void SaveTiming(absl::string_view timing_filepath,
|
||||
rtc::ArrayView<const Turn> timing) {
|
||||
std::ofstream outfile(timing_filepath);
|
||||
std::ofstream outfile(std::string{timing_filepath});
|
||||
RTC_CHECK(outfile.is_open());
|
||||
for (const Turn& turn : timing) {
|
||||
outfile << turn.speaker_name << " " << turn.audiotrack_file_name << " "
|
||||
|
@ -38,10 +38,10 @@ struct Turn {
|
||||
};
|
||||
|
||||
// Loads a list of turns from a file.
|
||||
std::vector<Turn> LoadTiming(const std::string& timing_filepath);
|
||||
std::vector<Turn> LoadTiming(absl::string_view timing_filepath);
|
||||
|
||||
// Writes a list of turns into a file.
|
||||
void SaveTiming(const std::string& timing_filepath,
|
||||
void SaveTiming(absl::string_view timing_filepath,
|
||||
rtc::ArrayView<const Turn> timing);
|
||||
|
||||
} // namespace conversational_speech
|
||||
|
@ -12,8 +12,8 @@
|
||||
#define MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_WAVREADER_ABSTRACT_FACTORY_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/test/conversational_speech/wavreader_interface.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -24,7 +24,7 @@ class WavReaderAbstractFactory {
|
||||
public:
|
||||
virtual ~WavReaderAbstractFactory() = default;
|
||||
virtual std::unique_ptr<WavReaderInterface> Create(
|
||||
const std::string& filepath) const = 0;
|
||||
absl::string_view filepath) const = 0;
|
||||
};
|
||||
|
||||
} // namespace conversational_speech
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "common_audio/wav_file.h"
|
||||
#include "rtc_base/checks.h"
|
||||
@ -24,7 +25,7 @@ using conversational_speech::WavReaderInterface;
|
||||
|
||||
class WavReaderAdaptor final : public WavReaderInterface {
|
||||
public:
|
||||
explicit WavReaderAdaptor(const std::string& filepath)
|
||||
explicit WavReaderAdaptor(absl::string_view filepath)
|
||||
: wav_reader_(filepath) {}
|
||||
~WavReaderAdaptor() override = default;
|
||||
|
||||
@ -55,7 +56,7 @@ WavReaderFactory::WavReaderFactory() = default;
|
||||
WavReaderFactory::~WavReaderFactory() = default;
|
||||
|
||||
std::unique_ptr<WavReaderInterface> WavReaderFactory::Create(
|
||||
const std::string& filepath) const {
|
||||
absl::string_view filepath) const {
|
||||
return std::unique_ptr<WavReaderAdaptor>(new WavReaderAdaptor(filepath));
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
#define MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_WAVREADER_FACTORY_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/test/conversational_speech/wavreader_abstract_factory.h"
|
||||
#include "modules/audio_processing/test/conversational_speech/wavreader_interface.h"
|
||||
|
||||
@ -26,7 +26,7 @@ class WavReaderFactory : public WavReaderAbstractFactory {
|
||||
WavReaderFactory();
|
||||
~WavReaderFactory() override;
|
||||
std::unique_ptr<WavReaderInterface> Create(
|
||||
const std::string& filepath) const override;
|
||||
absl::string_view filepath) const override;
|
||||
};
|
||||
|
||||
} // namespace conversational_speech
|
||||
|
@ -10,6 +10,9 @@
|
||||
|
||||
#include "modules/audio_processing/test/debug_dump_replayer.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/test/audio_processing_builder_for_testing.h"
|
||||
#include "modules/audio_processing/test/protobuf_utils.h"
|
||||
#include "modules/audio_processing/test/runtime_setting_util.h"
|
||||
@ -44,8 +47,8 @@ DebugDumpReplayer::~DebugDumpReplayer() {
|
||||
fclose(debug_file_);
|
||||
}
|
||||
|
||||
bool DebugDumpReplayer::SetDumpFile(const std::string& filename) {
|
||||
debug_file_ = fopen(filename.c_str(), "rb");
|
||||
bool DebugDumpReplayer::SetDumpFile(absl::string_view filename) {
|
||||
debug_file_ = fopen(std::string(filename).c_str(), "rb");
|
||||
LoadNextMessage();
|
||||
return debug_file_;
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
#define MODULES_AUDIO_PROCESSING_TEST_DEBUG_DUMP_REPLAYER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "common_audio/channel_buffer.h"
|
||||
#include "modules/audio_processing/include/audio_processing.h"
|
||||
#include "rtc_base/ignore_wundef.h"
|
||||
@ -31,7 +31,7 @@ class DebugDumpReplayer {
|
||||
~DebugDumpReplayer();
|
||||
|
||||
// Set dump file
|
||||
bool SetDumpFile(const std::string& filename);
|
||||
bool SetDumpFile(absl::string_view filename);
|
||||
|
||||
// Return next event.
|
||||
absl::optional<audioproc::Event> GetNextEvent() const;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio/echo_canceller3_factory.h"
|
||||
#include "modules/audio_coding/neteq/tools/resample_input_audio_file.h"
|
||||
#include "modules/audio_processing/aec_dump/aec_dump_factory.h"
|
||||
@ -41,13 +42,13 @@ void MaybeResetBuffer(std::unique_ptr<ChannelBuffer<float>>* buffer,
|
||||
|
||||
class DebugDumpGenerator {
|
||||
public:
|
||||
DebugDumpGenerator(const std::string& input_file_name,
|
||||
DebugDumpGenerator(absl::string_view input_file_name,
|
||||
int input_rate_hz,
|
||||
int input_channels,
|
||||
const std::string& reverse_file_name,
|
||||
absl::string_view reverse_file_name,
|
||||
int reverse_rate_hz,
|
||||
int reverse_channels,
|
||||
const std::string& dump_file_name,
|
||||
absl::string_view dump_file_name,
|
||||
bool enable_pre_amplifier);
|
||||
|
||||
// Constructor that uses default input files.
|
||||
@ -115,13 +116,13 @@ class DebugDumpGenerator {
|
||||
const std::string dump_file_name_;
|
||||
};
|
||||
|
||||
DebugDumpGenerator::DebugDumpGenerator(const std::string& input_file_name,
|
||||
DebugDumpGenerator::DebugDumpGenerator(absl::string_view input_file_name,
|
||||
int input_rate_hz,
|
||||
int input_channels,
|
||||
const std::string& reverse_file_name,
|
||||
absl::string_view reverse_file_name,
|
||||
int reverse_rate_hz,
|
||||
int reverse_channels,
|
||||
const std::string& dump_file_name,
|
||||
absl::string_view dump_file_name,
|
||||
bool enable_pre_amplifier)
|
||||
: input_config_(input_rate_hz, input_channels),
|
||||
reverse_config_(reverse_rate_hz, reverse_channels),
|
||||
@ -254,13 +255,13 @@ class DebugDumpTest : public ::testing::Test {
|
||||
// VerifyDebugDump replays a debug dump using APM and verifies that the result
|
||||
// is bit-exact-identical to the output channel in the dump. This is only
|
||||
// guaranteed if the debug dump is started on the first frame.
|
||||
void VerifyDebugDump(const std::string& in_filename);
|
||||
void VerifyDebugDump(absl::string_view in_filename);
|
||||
|
||||
private:
|
||||
DebugDumpReplayer debug_dump_replayer_;
|
||||
};
|
||||
|
||||
void DebugDumpTest::VerifyDebugDump(const std::string& in_filename) {
|
||||
void DebugDumpTest::VerifyDebugDump(absl::string_view in_filename) {
|
||||
ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(in_filename));
|
||||
|
||||
while (const absl::optional<audioproc::Event> event =
|
||||
|
@ -105,6 +105,7 @@ if (!build_with_chromium) {
|
||||
output_dir = "${root_out_dir}/py_quality_assessment/quality_assessment"
|
||||
deps = [
|
||||
"../../../../rtc_base:checks",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,9 @@
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -21,9 +23,9 @@ const char* const kErrorMessage = "-Out /path/to/output/file is mandatory";
|
||||
|
||||
// Writes fake output intended to be parsed by
|
||||
// quality_assessment.eval_scores.PolqaScore.
|
||||
void WriteOutputFile(const std::string& output_file_path) {
|
||||
void WriteOutputFile(absl::string_view output_file_path) {
|
||||
RTC_CHECK_NE(output_file_path, "");
|
||||
std::ofstream out(output_file_path);
|
||||
std::ofstream out(std::string{output_file_path});
|
||||
RTC_CHECK(!out.bad());
|
||||
out << "* Fake Polqa output" << std::endl;
|
||||
out << "FakeField1\tPolqaScore\tFakeField2" << std::endl;
|
||||
|
@ -10,8 +10,10 @@
|
||||
|
||||
#include "modules/audio_processing/test/test_utils.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/system/arch.h"
|
||||
|
||||
@ -68,10 +70,11 @@ void ChannelBufferVectorWriter::Write(const ChannelBuffer<float>& buffer) {
|
||||
output_->data() + old_size);
|
||||
}
|
||||
|
||||
FILE* OpenFile(const std::string& filename, const char* mode) {
|
||||
FILE* file = fopen(filename.c_str(), mode);
|
||||
FILE* OpenFile(absl::string_view filename, absl::string_view mode) {
|
||||
std::string filename_str(filename);
|
||||
FILE* file = fopen(filename_str.c_str(), std::string(mode).c_str());
|
||||
if (!file) {
|
||||
printf("Unable to open file %s\n", filename.c_str());
|
||||
printf("Unable to open file %s\n", filename_str.c_str());
|
||||
exit(1);
|
||||
}
|
||||
return file;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "common_audio/channel_buffer.h"
|
||||
#include "common_audio/wav_file.h"
|
||||
#include "modules/audio_processing/include/audio_processing.h"
|
||||
@ -112,7 +113,7 @@ class ChannelBufferVectorWriter final {
|
||||
};
|
||||
|
||||
// Exits on failure; do not use in unit tests.
|
||||
FILE* OpenFile(const std::string& filename, const char* mode);
|
||||
FILE* OpenFile(absl::string_view filename, absl::string_view mode);
|
||||
|
||||
void SetFrameSampleRate(Int16FrameData* frame, int sample_rate_hz);
|
||||
|
||||
@ -151,10 +152,11 @@ float ComputeSNR(const T* ref, const T* test, size_t length, float* variance) {
|
||||
// Returns a vector<T> parsed from whitespace delimited values in to_parse,
|
||||
// or an empty vector if the string could not be parsed.
|
||||
template <typename T>
|
||||
std::vector<T> ParseList(const std::string& to_parse) {
|
||||
std::vector<T> ParseList(absl::string_view to_parse) {
|
||||
std::vector<T> values;
|
||||
|
||||
std::istringstream str(to_parse);
|
||||
std::istringstream str( // no-presubmit-check TODO(webrtc:8982)
|
||||
std::string{to_parse});
|
||||
std::copy(
|
||||
std::istream_iterator<T>(str), // no-presubmit-check TODO(webrtc:8982)
|
||||
std::istream_iterator<T>(), // no-presubmit-check TODO(webrtc:8982)
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/logging/apm_data_dumper.h"
|
||||
#include "modules/audio_processing/test/test_utils.h"
|
||||
#include "rtc_base/checks.h"
|
||||
@ -23,7 +24,7 @@ namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
std::vector<WavBasedSimulator::SimulationEventType>
|
||||
WavBasedSimulator::GetCustomEventChain(const std::string& filename) {
|
||||
WavBasedSimulator::GetCustomEventChain(absl::string_view filename) {
|
||||
std::vector<WavBasedSimulator::SimulationEventType> call_chain;
|
||||
FileWrapper file_wrapper = FileWrapper::OpenReadOnly(filename);
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_processing/test/audio_processing_simulator.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -51,7 +52,7 @@ class WavBasedSimulator final : public AudioProcessingSimulator {
|
||||
void PrepareReverseProcessStreamCall();
|
||||
static std::vector<SimulationEventType> GetDefaultEventChain();
|
||||
static std::vector<SimulationEventType> GetCustomEventChain(
|
||||
const std::string& filename);
|
||||
absl::string_view filename);
|
||||
|
||||
std::vector<SimulationEventType> call_chain_;
|
||||
};
|
||||
|
@ -125,6 +125,9 @@ if (rtc_include_tests) {
|
||||
"../../../test:test_support",
|
||||
"//testing/gtest",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/system/file_wrapper.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/file_utils.h"
|
||||
@ -49,8 +50,8 @@ class TransientFileUtilsTest : public ::testing::Test {
|
||||
|
||||
~TransientFileUtilsTest() override { CleanupTempFiles(); }
|
||||
|
||||
std::string CreateTempFilename(const std::string& dir,
|
||||
const std::string& prefix) {
|
||||
std::string CreateTempFilename(absl::string_view dir,
|
||||
absl::string_view prefix) {
|
||||
std::string filename = test::TempFilename(dir, prefix);
|
||||
temp_filenames_.push_back(filename);
|
||||
return filename;
|
||||
|
Reference in New Issue
Block a user