Delete variant of rtc::split that copies the output fields
Bug: webrtc:13579 Change-Id: I065a32704d48d5eed21aee0e9757cac9ecf7aa99 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261951 Reviewed-by: Alessio Bazzica <alessiob@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Ali Tofigh <alito@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37160}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
774b4725a2
commit
f1d822b03b
@ -52,6 +52,7 @@ rtc_library("lib") {
|
||||
"../../../../rtc_base:stringutils",
|
||||
"../../../../test:fileutils",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
}
|
||||
|
||||
|
||||
@ -28,15 +28,15 @@ bool Turn::operator==(const Turn& b) const {
|
||||
std::vector<Turn> LoadTiming(const std::string& timing_filepath) {
|
||||
// Line parser.
|
||||
auto parse_line = [](const std::string& line) {
|
||||
std::vector<std::string> fields;
|
||||
rtc::split(line, ' ', &fields);
|
||||
std::vector<absl::string_view> fields = rtc::split(line, ' ');
|
||||
RTC_CHECK_GE(fields.size(), 3);
|
||||
RTC_CHECK_LE(fields.size(), 4);
|
||||
int gain = 0;
|
||||
if (fields.size() == 4) {
|
||||
gain = std::atof(fields[3].c_str());
|
||||
gain = rtc::StringToNumber<int>(fields[3]).value_or(0);
|
||||
}
|
||||
return Turn(fields[0], fields[1], std::atol(fields[2].c_str()), gain);
|
||||
return Turn(fields[0], fields[1],
|
||||
rtc::StringToNumber<int>(fields[2]).value_or(0), gain);
|
||||
};
|
||||
|
||||
// Init.
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -21,8 +22,8 @@ namespace test {
|
||||
namespace conversational_speech {
|
||||
|
||||
struct Turn {
|
||||
Turn(std::string new_speaker_name,
|
||||
std::string new_audiotrack_file_name,
|
||||
Turn(absl::string_view new_speaker_name,
|
||||
absl::string_view new_audiotrack_file_name,
|
||||
int new_offset,
|
||||
int gain)
|
||||
: speaker_name(new_speaker_name),
|
||||
|
||||
Reference in New Issue
Block a user