Adopt absl::string_view in AudioProcessing's interface

This is the first step of migrating
AudioProcessing::CreateAndAttachAecDump() from using std::string to
absl::string_view.

Bug: webrtc:13579
Change-Id: I8fc373e7ac55fd8e96bb0b01d1a30e28883ac9a2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269400
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37631}
This commit is contained in:
Ali Tofigh 2022-07-25 22:07:08 +02:00 committed by WebRTC LUCI CQ
parent 2f1a4370d5
commit 1fa87c44cb
4 changed files with 28 additions and 3 deletions

View File

@ -41,7 +41,10 @@ rtc_library("api") {
"../../rtc_base/system:rtc_export",
"agc:gain_control_interface",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
absl_deps = [
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
rtc_library("audio_frame_proxies") {

View File

@ -18,6 +18,7 @@
#include <utility>
#include "absl/strings/match.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
@ -1653,8 +1654,15 @@ int AudioProcessingImpl::recommended_stream_analog_level_locked() const {
bool AudioProcessingImpl::CreateAndAttachAecDump(const std::string& file_name,
int64_t max_log_size_bytes,
rtc::TaskQueue* worker_queue) {
std::unique_ptr<AecDump> aec_dump =
AecDumpFactory::Create(file_name, max_log_size_bytes, worker_queue);
return CreateAndAttachAecDump(absl::string_view(file_name),
max_log_size_bytes, worker_queue);
}
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);
if (!aec_dump) {
return false;
}

View File

@ -19,6 +19,7 @@
#include <string>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/function_view.h"
#include "modules/audio_processing/aec3/echo_canceller3.h"
@ -73,6 +74,9 @@ class AudioProcessingImpl : public AudioProcessing {
bool CreateAndAttachAecDump(const std::string& file_name,
int64_t max_log_size_bytes,
rtc::TaskQueue* worker_queue) override;
bool CreateAndAttachAecDump(absl::string_view file_name,
int64_t max_log_size_bytes,
rtc::TaskQueue* worker_queue) override;
bool CreateAndAttachAecDump(FILE* handle,
int64_t max_log_size_bytes,
rtc::TaskQueue* worker_queue) override;

View File

@ -23,6 +23,7 @@
#include <vector>
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h"
@ -622,9 +623,18 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
// return value of true indicates that the file has been
// sucessfully opened, while a value of false indicates that
// opening the file failed.
//
// TODO(webrtc:13579): Remove std::string version once downstream users have
// implemented the absl::string_view version.
virtual bool CreateAndAttachAecDump(const std::string& file_name,
int64_t max_log_size_bytes,
rtc::TaskQueue* worker_queue) = 0;
virtual bool CreateAndAttachAecDump(absl::string_view file_name,
int64_t max_log_size_bytes,
rtc::TaskQueue* worker_queue) {
return CreateAndAttachAecDump(std::string(file_name), max_log_size_bytes,
worker_queue);
}
virtual bool CreateAndAttachAecDump(FILE* handle,
int64_t max_log_size_bytes,
rtc::TaskQueue* worker_queue) = 0;