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:
Ali Tofigh
2022-08-16 14:44:38 +02:00
committed by WebRTC LUCI CQ
parent 13b9f81b23
commit f3592cb2a2
52 changed files with 257 additions and 165 deletions

View File

@ -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;