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

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