Revert "Delete rtc::Pathname"

This reverts commit 6b9dec0d16f2df59fa2820c5ec1341be52fb9f32.

Reason for revert: speculative revert for breaking internal projects

Original change's description:
> Delete rtc::Pathname
> 
> Bug: webrtc:6424
> Change-Id: Iec01dc5dd1426d4558983b828b67af872107d723
> Reviewed-on: https://webrtc-review.googlesource.com/c/108400
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25479}

TBR=kwiberg@webrtc.org,nisse@webrtc.org

Change-Id: I3129a81a1d8e36b3e6c67572410bdc478ec4d5e9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:6424
Reviewed-on: https://webrtc-review.googlesource.com/c/109201
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25490}
This commit is contained in:
Qingsi Wang
2018-11-02 16:30:10 +00:00
committed by Commit Bot
parent 273d0296a4
commit 2039ee7dce
21 changed files with 405 additions and 98 deletions

View File

@ -51,7 +51,6 @@ rtc_static_library("lib") {
"../../../../common_audio",
"../../../../rtc_base:checks",
"../../../../rtc_base:rtc_base_approved",
"../../../../test:fileutils",
"//third_party/abseil-cpp/absl/memory",
]
visibility = [ ":*" ] # Only targets in this file can depend on this.

View File

@ -12,6 +12,7 @@
#include "modules/audio_processing/test/conversational_speech/mock_wavreader.h"
#include "rtc_base/logging.h"
#include "rtc_base/pathutils.h"
#include "test/gmock.h"
namespace webrtc {
@ -38,10 +39,9 @@ MockWavReaderFactory::~MockWavReaderFactory() = default;
std::unique_ptr<WavReaderInterface> MockWavReaderFactory::CreateMock(
const std::string& 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);
const auto it = audiotrack_names_params_.find(filename);
const rtc::Pathname audiotrack_file_path(filepath);
const auto it =
audiotrack_names_params_.find(audiotrack_file_path.filename());
// If not found, use default parameters.
if (it == audiotrack_names_params_.end()) {

View File

@ -14,7 +14,7 @@
#include <iterator>
#include "rtc_base/logging.h"
#include "test/testsupport/fileutils.h"
#include "rtc_base/pathutils.h"
namespace webrtc {
namespace test {
@ -50,13 +50,13 @@ bool MultiEndCall::CreateAudioTrackReaders() {
if (it != audiotrack_readers_.end())
continue;
const std::string audiotrack_file_path =
test::JoinFilename(audiotracks_path_, turn.audiotrack_file_name);
// Instance Pathname to retrieve the full path to the audiotrack file.
const rtc::Pathname audiotrack_file_path(audiotracks_path_,
turn.audiotrack_file_name);
// Map the audiotrack file name to a new instance of WavReaderInterface.
std::unique_ptr<WavReaderInterface> wavreader =
wavreader_abstract_factory_->Create(
test::JoinFilename(audiotracks_path_, turn.audiotrack_file_name));
wavreader_abstract_factory_->Create(audiotrack_file_path.pathname());
if (sample_rate_hz_ == 0) {
sample_rate_hz_ = wavreader->SampleRate();

View File

@ -25,7 +25,7 @@
#include "rtc_base/constructormagic.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "test/testsupport/fileutils.h"
#include "rtc_base/pathutils.h"
namespace webrtc {
namespace test {
@ -46,20 +46,21 @@ InitSpeakerOutputFilePaths(const std::set<std::string>& speaker_names,
// Add near-end and far-end output paths into the map.
for (const auto& speaker_name : speaker_names) {
const std::string near_end_path =
test::JoinFilename(output_path, "s_" + speaker_name + "-near_end.wav");
const rtc::Pathname near_end_path(output_path,
"s_" + speaker_name + "-near_end.wav");
RTC_LOG(LS_VERBOSE) << "The near-end audio track will be created in "
<< near_end_path << ".";
<< near_end_path.pathname() << ".";
const std::string far_end_path =
test::JoinFilename(output_path, "s_" + speaker_name + "-far_end.wav");
const rtc::Pathname far_end_path(output_path,
"s_" + speaker_name + "-far_end.wav");
RTC_LOG(LS_VERBOSE) << "The far-end audio track will be created in "
<< far_end_path << ".";
<< far_end_path.pathname() << ".";
// Add to map.
speaker_output_file_paths_map->emplace(
std::piecewise_construct, std::forward_as_tuple(speaker_name),
std::forward_as_tuple(near_end_path, far_end_path));
std::forward_as_tuple(near_end_path.pathname(),
far_end_path.pathname()));
}
return speaker_output_file_paths_map;