Adopt absl::string_view in modules/audio_coding/
Bug: webrtc:13579 Change-Id: Ifec66fb6ba9724d18539de7245a358c2d13c7939 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268547 Reviewed-by: Ivo Creusen <ivoc@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Ali Tofigh <alito@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37573}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
761072f68e
commit
714e3cbb48
@ -130,7 +130,10 @@ rtc_library("red") {
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:logging",
|
||||
]
|
||||
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("g711") {
|
||||
@ -906,6 +909,7 @@ rtc_library("audio_network_adaptor") {
|
||||
]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/algorithm:container",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
@ -1121,7 +1125,10 @@ rtc_library("neteq_test_tools") {
|
||||
"../../test:rtp_test_utils",
|
||||
"../rtp_rtcp:rtp_rtcp_format",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
if (rtc_enable_protobuf) {
|
||||
sources += [
|
||||
@ -1179,6 +1186,7 @@ rtc_library("neteq_input_audio_tools") {
|
||||
"../../common_audio",
|
||||
"../../rtc_base:checks",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
|
||||
}
|
||||
|
||||
if (rtc_enable_protobuf) {
|
||||
@ -1197,7 +1205,10 @@ if (rtc_enable_protobuf) {
|
||||
"../rtp_rtcp",
|
||||
"../rtp_rtcp:rtp_rtcp_format",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
public_deps = # no-presubmit-check TODO(webrtc:8603)
|
||||
[ "../../logging:rtc_event_log_proto" ]
|
||||
}
|
||||
@ -1546,7 +1557,10 @@ if (rtc_include_tests) {
|
||||
"../../rtc_base:refcount",
|
||||
"../../test:fileutils",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
sources = [
|
||||
"neteq/tools/neteq_test_factory.cc",
|
||||
"neteq/tools/neteq_test_factory.h",
|
||||
@ -1689,7 +1703,10 @@ if (rtc_include_tests) {
|
||||
"../../test:test_support",
|
||||
"//testing/gtest",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/flags:flag",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_executable("rtp_encode") {
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
@ -57,7 +58,7 @@ AcmSendTestOldApi::AcmSendTestOldApi(InputAudioFile* audio_source,
|
||||
|
||||
AcmSendTestOldApi::~AcmSendTestOldApi() = default;
|
||||
|
||||
bool AcmSendTestOldApi::RegisterCodec(const char* payload_name,
|
||||
bool AcmSendTestOldApi::RegisterCodec(absl::string_view payload_name,
|
||||
int clockrate_hz,
|
||||
int num_channels,
|
||||
int payload_type,
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio/audio_frame.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module.h"
|
||||
#include "modules/audio_coding/neteq/tools/packet_source.h"
|
||||
@ -38,7 +39,7 @@ class AcmSendTestOldApi : public AudioPacketizationCallback,
|
||||
AcmSendTestOldApi& operator=(const AcmSendTestOldApi&) = delete;
|
||||
|
||||
// Registers the send codec. Returns true on success, false otherwise.
|
||||
bool RegisterCodec(const char* payload_name,
|
||||
bool RegisterCodec(absl::string_view payload_name,
|
||||
int sampling_freq_hz,
|
||||
int channels,
|
||||
int payload_type,
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "modules/audio_coding/acm2/acm_receiver.h"
|
||||
#include "modules/audio_coding/acm2/acm_remixing.h"
|
||||
@ -112,7 +113,7 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
|
||||
// the value has changed since the last time (and always for the first call).
|
||||
class ChangeLogger {
|
||||
public:
|
||||
explicit ChangeLogger(const std::string& histogram_name)
|
||||
explicit ChangeLogger(absl::string_view histogram_name)
|
||||
: histogram_name_(histogram_name) {}
|
||||
// Logs the new value if it is different from the last logged value, or if
|
||||
// this is the first call.
|
||||
@ -135,7 +136,7 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
|
||||
|
||||
int InitializeReceiverSafe() RTC_EXCLUSIVE_LOCKS_REQUIRED(acm_mutex_);
|
||||
|
||||
bool HaveValidEncoder(const char* caller_name) const
|
||||
bool HaveValidEncoder(absl::string_view caller_name) const
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(acm_mutex_);
|
||||
|
||||
// Preprocessing of input audio, including resampling and down-mixing if
|
||||
@ -589,7 +590,8 @@ int AudioCodingModuleImpl::GetNetworkStatistics(NetworkStatistics* statistics) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const {
|
||||
bool AudioCodingModuleImpl::HaveValidEncoder(
|
||||
absl::string_view caller_name) const {
|
||||
if (!encoder_stack_) {
|
||||
RTC_LOG(LS_ERROR) << caller_name << " failed: No send codec is registered.";
|
||||
return false;
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
@ -860,7 +861,7 @@ class AcmSenderBitExactnessOldApi : public ::testing::Test,
|
||||
|
||||
// Sets up the test::AcmSendTest object. Returns true on success, otherwise
|
||||
// false.
|
||||
bool SetUpSender(std::string input_file_name, int source_rate) {
|
||||
bool SetUpSender(absl::string_view input_file_name, int source_rate) {
|
||||
// Note that `audio_source_` will loop forever. The test duration is set
|
||||
// explicitly by `kTestDurationMs`.
|
||||
audio_source_.reset(new test::InputAudioFile(input_file_name));
|
||||
@ -871,7 +872,7 @@ class AcmSenderBitExactnessOldApi : public ::testing::Test,
|
||||
|
||||
// Registers a send codec in the test::AcmSendTest object. Returns true on
|
||||
// success, false on failure.
|
||||
bool RegisterSendCodec(const char* payload_name,
|
||||
bool RegisterSendCodec(absl::string_view payload_name,
|
||||
int sampling_freq_hz,
|
||||
int channels,
|
||||
int payload_type,
|
||||
@ -895,8 +896,8 @@ class AcmSenderBitExactnessOldApi : public ::testing::Test,
|
||||
|
||||
// Runs the test. SetUpSender() and RegisterSendCodec() must have been called
|
||||
// before calling this method.
|
||||
void Run(const std::string& audio_checksum_ref,
|
||||
const std::string& payload_checksum_ref,
|
||||
void Run(absl::string_view audio_checksum_ref,
|
||||
absl::string_view payload_checksum_ref,
|
||||
int expected_packets,
|
||||
test::AcmReceiveTestOldApi::NumOutputChannels expected_channels,
|
||||
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory = nullptr) {
|
||||
@ -943,12 +944,12 @@ class AcmSenderBitExactnessOldApi : public ::testing::Test,
|
||||
}
|
||||
|
||||
// Helper: result must be one the "|"-separated checksums.
|
||||
void ExpectChecksumEq(std::string ref, std::string result) {
|
||||
void ExpectChecksumEq(absl::string_view ref, absl::string_view result) {
|
||||
if (ref.size() == result.size()) {
|
||||
// Only one checksum: clearer message.
|
||||
EXPECT_EQ(ref, result);
|
||||
} else {
|
||||
EXPECT_NE(ref.find(result), std::string::npos)
|
||||
EXPECT_NE(ref.find(result), absl::string_view::npos)
|
||||
<< result << " must be one of these:\n"
|
||||
<< ref;
|
||||
}
|
||||
@ -988,7 +989,7 @@ class AcmSenderBitExactnessOldApi : public ::testing::Test,
|
||||
packet->payload_length_bytes());
|
||||
}
|
||||
|
||||
void SetUpTest(const char* codec_name,
|
||||
void SetUpTest(absl::string_view codec_name,
|
||||
int codec_sample_rate_hz,
|
||||
int channels,
|
||||
int payload_type,
|
||||
@ -1284,7 +1285,7 @@ class AcmSetBitRateTest : public ::testing::Test {
|
||||
|
||||
// Registers a send codec in the test::AcmSendTest object. Returns true on
|
||||
// success, false on failure.
|
||||
virtual bool RegisterSendCodec(const char* payload_name,
|
||||
virtual bool RegisterSendCodec(absl::string_view payload_name,
|
||||
int sampling_freq_hz,
|
||||
int channels,
|
||||
int payload_type,
|
||||
@ -1310,7 +1311,7 @@ class AcmSetBitRateTest : public ::testing::Test {
|
||||
EXPECT_GE(max_expected_total_bits, nr_bytes * 8);
|
||||
}
|
||||
|
||||
void SetUpTest(const char* codec_name,
|
||||
void SetUpTest(absl::string_view codec_name,
|
||||
int codec_sample_rate_hz,
|
||||
int channels,
|
||||
int payload_type,
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/bitrate_controller.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/channel_controller.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/debug_dump_writer.h"
|
||||
@ -219,7 +220,7 @@ ControllerManagerImpl::Config::Config(int min_reordering_time_ms,
|
||||
ControllerManagerImpl::Config::~Config() = default;
|
||||
|
||||
std::unique_ptr<ControllerManager> ControllerManagerImpl::Create(
|
||||
const std::string& config_string,
|
||||
absl::string_view config_string,
|
||||
size_t num_encoder_channels,
|
||||
rtc::ArrayView<const int> encoder_frame_lengths_ms,
|
||||
int min_encoder_bitrate_bps,
|
||||
@ -235,7 +236,7 @@ std::unique_ptr<ControllerManager> ControllerManagerImpl::Create(
|
||||
}
|
||||
|
||||
std::unique_ptr<ControllerManager> ControllerManagerImpl::Create(
|
||||
const std::string& config_string,
|
||||
absl::string_view config_string,
|
||||
size_t num_encoder_channels,
|
||||
rtc::ArrayView<const int> encoder_frame_lengths_ms,
|
||||
int min_encoder_bitrate_bps,
|
||||
@ -247,7 +248,8 @@ std::unique_ptr<ControllerManager> ControllerManagerImpl::Create(
|
||||
DebugDumpWriter* debug_dump_writer) {
|
||||
#if WEBRTC_ENABLE_PROTOBUF
|
||||
audio_network_adaptor::config::ControllerManager controller_manager_config;
|
||||
RTC_CHECK(controller_manager_config.ParseFromString(config_string));
|
||||
RTC_CHECK(
|
||||
controller_manager_config.ParseFromString(std::string(config_string)));
|
||||
if (debug_dump_writer)
|
||||
debug_dump_writer->DumpControllerManagerConfig(controller_manager_config,
|
||||
rtc::TimeMillis());
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/controller.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -46,7 +47,7 @@ class ControllerManagerImpl final : public ControllerManager {
|
||||
};
|
||||
|
||||
static std::unique_ptr<ControllerManager> Create(
|
||||
const std::string& config_string,
|
||||
absl::string_view config_string,
|
||||
size_t num_encoder_channels,
|
||||
rtc::ArrayView<const int> encoder_frame_lengths_ms,
|
||||
int min_encoder_bitrate_bps,
|
||||
@ -57,7 +58,7 @@ class ControllerManagerImpl final : public ControllerManager {
|
||||
bool initial_dtx_enabled);
|
||||
|
||||
static std::unique_ptr<ControllerManager> Create(
|
||||
const std::string& config_string,
|
||||
absl::string_view config_string,
|
||||
size_t num_encoder_channels,
|
||||
rtc::ArrayView<const int> encoder_frame_lengths_ms,
|
||||
int min_encoder_bitrate_bps,
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/mock/mock_controller.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/mock/mock_debug_dump_writer.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
@ -276,7 +277,7 @@ constexpr int kInitialFrameLengthMs = 60;
|
||||
constexpr int kMinBitrateBps = 6000;
|
||||
|
||||
ControllerManagerStates CreateControllerManager(
|
||||
const std::string& config_string) {
|
||||
absl::string_view config_string) {
|
||||
ControllerManagerStates states;
|
||||
constexpr size_t kNumEncoderChannels = 2;
|
||||
const std::vector<int> encoder_frame_lengths_ms = {20, 60};
|
||||
|
||||
@ -178,7 +178,7 @@ TEST(AudioDecoderFactoryTest, CreateOpus) {
|
||||
for (int hz : {8000, 16000, 32000, 48000}) {
|
||||
for (int channels : {0, 1, 2, 3}) {
|
||||
for (std::string stereo : {"XX", "0", "1", "2"}) {
|
||||
std::map<std::string, std::string> params;
|
||||
SdpAudioFormat::Parameters params;
|
||||
if (stereo != "XX") {
|
||||
params["stereo"] = stereo;
|
||||
}
|
||||
|
||||
@ -10,11 +10,13 @@
|
||||
|
||||
#include "modules/audio_coding/codecs/opus/audio_coder_opus_common.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
absl::optional<std::string> GetFormatParameter(const SdpAudioFormat& format,
|
||||
const std::string& param) {
|
||||
auto it = format.parameters.find(param);
|
||||
absl::string_view param) {
|
||||
auto it = format.parameters.find(std::string(param));
|
||||
if (it == format.parameters.end())
|
||||
return absl::nullopt;
|
||||
|
||||
@ -25,7 +27,7 @@ absl::optional<std::string> GetFormatParameter(const SdpAudioFormat& format,
|
||||
template <>
|
||||
absl::optional<std::vector<unsigned char>> GetFormatParameter(
|
||||
const SdpAudioFormat& format,
|
||||
const std::string& param) {
|
||||
absl::string_view param) {
|
||||
std::vector<unsigned char> result;
|
||||
const std::string comma_separated_list =
|
||||
GetFormatParameter(format, param).value_or("");
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
@ -23,18 +24,18 @@
|
||||
namespace webrtc {
|
||||
|
||||
absl::optional<std::string> GetFormatParameter(const SdpAudioFormat& format,
|
||||
const std::string& param);
|
||||
absl::string_view param);
|
||||
|
||||
template <typename T>
|
||||
absl::optional<T> GetFormatParameter(const SdpAudioFormat& format,
|
||||
const std::string& param) {
|
||||
absl::string_view param) {
|
||||
return rtc::StringToNumber<T>(GetFormatParameter(format, param).value_or(""));
|
||||
}
|
||||
|
||||
template <>
|
||||
absl::optional<std::vector<unsigned char>> GetFormatParameter(
|
||||
const SdpAudioFormat& format,
|
||||
const std::string& param);
|
||||
absl::string_view param);
|
||||
|
||||
class OpusFrame : public AudioDecoder::EncodedAudioFrame {
|
||||
public:
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/controller_manager.h"
|
||||
#include "modules/audio_coding/codecs/opus/audio_coder_opus_common.h"
|
||||
@ -349,7 +350,7 @@ AudioEncoderOpusImpl::AudioEncoderOpusImpl(const AudioEncoderOpusConfig& config,
|
||||
: AudioEncoderOpusImpl(
|
||||
config,
|
||||
payload_type,
|
||||
[this](const std::string& config_string, RtcEventLog* event_log) {
|
||||
[this](absl::string_view config_string, RtcEventLog* event_log) {
|
||||
return DefaultAudioNetworkAdaptorCreator(config_string, event_log);
|
||||
},
|
||||
// We choose 5sec as initial time constant due to empirical data.
|
||||
@ -777,7 +778,7 @@ void AudioEncoderOpusImpl::ApplyAudioNetworkAdaptor() {
|
||||
|
||||
std::unique_ptr<AudioNetworkAdaptor>
|
||||
AudioEncoderOpusImpl::DefaultAudioNetworkAdaptorCreator(
|
||||
const std::string& config_string,
|
||||
absl::string_view config_string,
|
||||
RtcEventLog* event_log) const {
|
||||
AudioNetworkAdaptorImpl::Config config;
|
||||
config.event_log = event_log;
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
@ -45,7 +46,7 @@ class AudioEncoderOpusImpl final : public AudioEncoder {
|
||||
OpusEncInst* inst);
|
||||
|
||||
using AudioNetworkAdaptorCreator =
|
||||
std::function<std::unique_ptr<AudioNetworkAdaptor>(const std::string&,
|
||||
std::function<std::unique_ptr<AudioNetworkAdaptor>(absl::string_view,
|
||||
RtcEventLog*)>;
|
||||
|
||||
AudioEncoderOpusImpl(const AudioEncoderOpusConfig& config, int payload_type);
|
||||
@ -146,7 +147,7 @@ class AudioEncoderOpusImpl final : public AudioEncoder {
|
||||
|
||||
void ApplyAudioNetworkAdaptor();
|
||||
std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator(
|
||||
const std::string& config_string,
|
||||
absl::string_view config_string,
|
||||
RtcEventLog* event_log) const;
|
||||
|
||||
void MaybeUpdateUplinkBandwidth();
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "common_audio/mocks/mock_smoothing_filter.h"
|
||||
#include "modules/audio_coding/audio_network_adaptor/mock/mock_audio_network_adaptor.h"
|
||||
#include "modules/audio_coding/codecs/opus/audio_encoder_opus.h"
|
||||
@ -61,7 +62,7 @@ std::unique_ptr<AudioEncoderOpusStates> CreateCodec(int sample_rate_hz,
|
||||
|
||||
MockAudioNetworkAdaptor** mock_ptr = &states->mock_audio_network_adaptor;
|
||||
AudioEncoderOpusImpl::AudioNetworkAdaptorCreator creator =
|
||||
[mock_ptr](const std::string&, RtcEventLog* event_log) {
|
||||
[mock_ptr](absl::string_view, RtcEventLog* event_log) {
|
||||
std::unique_ptr<MockAudioNetworkAdaptor> adaptor(
|
||||
new NiceMock<MockAudioNetworkAdaptor>());
|
||||
EXPECT_CALL(*adaptor, Die());
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/byte_order.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
@ -39,7 +40,7 @@ DecoderDatabase::DecoderInfo::DecoderInfo(
|
||||
const SdpAudioFormat& audio_format,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
AudioDecoderFactory* factory,
|
||||
const std::string& codec_name)
|
||||
absl::string_view codec_name)
|
||||
: name_(codec_name),
|
||||
audio_format_(audio_format),
|
||||
codec_pair_id_(codec_pair_id),
|
||||
@ -71,14 +72,10 @@ AudioDecoder* DecoderDatabase::DecoderInfo::GetDecoder() const {
|
||||
return decoder_.get();
|
||||
}
|
||||
|
||||
bool DecoderDatabase::DecoderInfo::IsType(const char* name) const {
|
||||
bool DecoderDatabase::DecoderInfo::IsType(absl::string_view name) const {
|
||||
return absl::EqualsIgnoreCase(audio_format_.name, name);
|
||||
}
|
||||
|
||||
bool DecoderDatabase::DecoderInfo::IsType(const std::string& name) const {
|
||||
return IsType(name.c_str());
|
||||
}
|
||||
|
||||
absl::optional<DecoderDatabase::DecoderInfo::CngDecoder>
|
||||
DecoderDatabase::DecoderInfo::CngDecoder::Create(const SdpAudioFormat& format) {
|
||||
if (absl::EqualsIgnoreCase(format.name, "CN")) {
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio_codecs/audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
@ -41,7 +42,7 @@ class DecoderDatabase {
|
||||
DecoderInfo(const SdpAudioFormat& audio_format,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
AudioDecoderFactory* factory,
|
||||
const std::string& codec_name);
|
||||
absl::string_view codec_name);
|
||||
explicit DecoderInfo(const SdpAudioFormat& audio_format,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
AudioDecoderFactory* factory = nullptr);
|
||||
@ -80,9 +81,7 @@ class DecoderDatabase {
|
||||
bool IsRed() const { return subtype_ == Subtype::kRed; }
|
||||
|
||||
// Returns true if the decoder's format is named `name`.
|
||||
bool IsType(const char* name) const;
|
||||
// Returns true if the decoder's format is named `name`.
|
||||
bool IsType(const std::string& name) const;
|
||||
bool IsType(absl::string_view name) const;
|
||||
|
||||
const std::string& get_name() const { return name_; }
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
|
||||
#include "modules/audio_coding/neteq/expand_uma_logger.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
|
||||
@ -22,7 +23,7 @@ std::unique_ptr<TickTimer::Countdown> GetNewCountdown(
|
||||
}
|
||||
} // namespace
|
||||
|
||||
ExpandUmaLogger::ExpandUmaLogger(std::string uma_name,
|
||||
ExpandUmaLogger::ExpandUmaLogger(absl::string_view uma_name,
|
||||
int logging_period_s,
|
||||
const TickTimer* tick_timer)
|
||||
: uma_name_(uma_name),
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/neteq/tick_timer.h"
|
||||
|
||||
@ -29,7 +30,7 @@ namespace webrtc {
|
||||
// object that outlives the one constructed.
|
||||
class ExpandUmaLogger {
|
||||
public:
|
||||
ExpandUmaLogger(std::string uma_name,
|
||||
ExpandUmaLogger(absl::string_view uma_name,
|
||||
int logging_period_s,
|
||||
const TickTimer* tick_timer);
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/neteq/delay_manager.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
@ -38,7 +39,7 @@ constexpr int kInterruptionLenMs = 150;
|
||||
const size_t StatisticsCalculator::kLenWaitingTimes;
|
||||
|
||||
StatisticsCalculator::PeriodicUmaLogger::PeriodicUmaLogger(
|
||||
const std::string& uma_name,
|
||||
absl::string_view uma_name,
|
||||
int report_interval_ms,
|
||||
int max_value)
|
||||
: uma_name_(uma_name),
|
||||
@ -64,7 +65,7 @@ void StatisticsCalculator::PeriodicUmaLogger::LogToUma(int value) const {
|
||||
}
|
||||
|
||||
StatisticsCalculator::PeriodicUmaCount::PeriodicUmaCount(
|
||||
const std::string& uma_name,
|
||||
absl::string_view uma_name,
|
||||
int report_interval_ms,
|
||||
int max_value)
|
||||
: PeriodicUmaLogger(uma_name, report_interval_ms, max_value) {}
|
||||
@ -87,7 +88,7 @@ void StatisticsCalculator::PeriodicUmaCount::Reset() {
|
||||
}
|
||||
|
||||
StatisticsCalculator::PeriodicUmaAverage::PeriodicUmaAverage(
|
||||
const std::string& uma_name,
|
||||
absl::string_view uma_name,
|
||||
int report_interval_ms,
|
||||
int max_value)
|
||||
: PeriodicUmaLogger(uma_name, report_interval_ms, max_value) {}
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <deque>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/neteq/neteq.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -126,7 +127,7 @@ class StatisticsCalculator {
|
||||
|
||||
class PeriodicUmaLogger {
|
||||
public:
|
||||
PeriodicUmaLogger(const std::string& uma_name,
|
||||
PeriodicUmaLogger(absl::string_view uma_name,
|
||||
int report_interval_ms,
|
||||
int max_value);
|
||||
virtual ~PeriodicUmaLogger();
|
||||
@ -145,7 +146,7 @@ class StatisticsCalculator {
|
||||
|
||||
class PeriodicUmaCount final : public PeriodicUmaLogger {
|
||||
public:
|
||||
PeriodicUmaCount(const std::string& uma_name,
|
||||
PeriodicUmaCount(absl::string_view uma_name,
|
||||
int report_interval_ms,
|
||||
int max_value);
|
||||
~PeriodicUmaCount() override;
|
||||
@ -161,7 +162,7 @@ class StatisticsCalculator {
|
||||
|
||||
class PeriodicUmaAverage final : public PeriodicUmaLogger {
|
||||
public:
|
||||
PeriodicUmaAverage(const std::string& uma_name,
|
||||
PeriodicUmaAverage(absl::string_view uma_name,
|
||||
int report_interval_ms,
|
||||
int max_value);
|
||||
~PeriodicUmaAverage() override;
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include "modules/audio_coding/neteq/test/neteq_decoding_test.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "modules/audio_coding/neteq/default_neteq_factory.h"
|
||||
@ -93,7 +94,7 @@ void NetEqDecodingTest::SetUp() {
|
||||
|
||||
void NetEqDecodingTest::TearDown() {}
|
||||
|
||||
void NetEqDecodingTest::OpenInputFile(const std::string& rtp_file) {
|
||||
void NetEqDecodingTest::OpenInputFile(absl::string_view rtp_file) {
|
||||
rtp_source_.reset(test::RtpFileSource::Create(rtp_file));
|
||||
}
|
||||
|
||||
@ -131,9 +132,9 @@ void NetEqDecodingTest::Process() {
|
||||
}
|
||||
|
||||
void NetEqDecodingTest::DecodeAndCompare(
|
||||
const std::string& rtp_file,
|
||||
const std::string& output_checksum,
|
||||
const std::string& network_stats_checksum,
|
||||
absl::string_view rtp_file,
|
||||
absl::string_view output_checksum,
|
||||
absl::string_view network_stats_checksum,
|
||||
bool gen_ref) {
|
||||
OpenInputFile(rtp_file);
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio/audio_frame.h"
|
||||
#include "api/neteq/neteq.h"
|
||||
#include "api/rtp_headers.h"
|
||||
@ -39,12 +40,12 @@ class NetEqDecodingTest : public ::testing::Test {
|
||||
NetEqDecodingTest();
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
void OpenInputFile(const std::string& rtp_file);
|
||||
void OpenInputFile(absl::string_view rtp_file);
|
||||
void Process();
|
||||
|
||||
void DecodeAndCompare(const std::string& rtp_file,
|
||||
const std::string& output_checksum,
|
||||
const std::string& network_stats_checksum,
|
||||
void DecodeAndCompare(absl::string_view rtp_file,
|
||||
absl::string_view output_checksum,
|
||||
absl::string_view network_stats_checksum,
|
||||
bool gen_ref);
|
||||
|
||||
static void PopulateRtpInfo(int frame_index,
|
||||
|
||||
@ -106,8 +106,8 @@ NetEqOpusQualityTest::NetEqOpusQualityTest()
|
||||
|
||||
// Redefine decoder type if input is stereo.
|
||||
if (channels_ > 1) {
|
||||
audio_format_ = SdpAudioFormat(
|
||||
"opus", 48000, 2, std::map<std::string, std::string>{{"stereo", "1"}});
|
||||
audio_format_ = SdpAudioFormat("opus", 48000, 2,
|
||||
SdpAudioFormat::Parameters{{"stereo", "1"}});
|
||||
}
|
||||
application_ = absl::GetFlag(FLAGS_application);
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ void Convert(const webrtc::NetEqNetworkStatistics& stats_raw,
|
||||
|
||||
void AddMessage(FILE* file,
|
||||
rtc::MessageDigest* digest,
|
||||
const std::string& message) {
|
||||
absl::string_view message) {
|
||||
int32_t size = message.length();
|
||||
if (file)
|
||||
ASSERT_EQ(1u, fwrite(&size, sizeof(size), 1, file));
|
||||
@ -64,11 +64,11 @@ void AddMessage(FILE* file,
|
||||
|
||||
#endif // WEBRTC_NETEQ_UNITTEST_BITEXACT
|
||||
|
||||
ResultSink::ResultSink(const std::string& output_file)
|
||||
ResultSink::ResultSink(absl::string_view output_file)
|
||||
: output_fp_(nullptr),
|
||||
digest_(rtc::MessageDigestFactory::Create(rtc::DIGEST_SHA_1)) {
|
||||
if (!output_file.empty()) {
|
||||
output_fp_ = fopen(output_file.c_str(), "wb");
|
||||
output_fp_ = fopen(std::string(output_file).c_str(), "wb");
|
||||
EXPECT_TRUE(output_fp_ != NULL);
|
||||
}
|
||||
}
|
||||
@ -91,7 +91,7 @@ void ResultSink::AddResult(const NetEqNetworkStatistics& stats_raw) {
|
||||
#endif // WEBRTC_NETEQ_UNITTEST_BITEXACT
|
||||
}
|
||||
|
||||
void ResultSink::VerifyChecksum(const std::string& checksum) {
|
||||
void ResultSink::VerifyChecksum(absl::string_view checksum) {
|
||||
std::string buffer;
|
||||
buffer.resize(digest_->Size());
|
||||
digest_->Finish(buffer.data(), buffer.size());
|
||||
@ -100,7 +100,7 @@ void ResultSink::VerifyChecksum(const std::string& checksum) {
|
||||
EXPECT_EQ(checksum, result);
|
||||
} else {
|
||||
// Check result is one the '|'-separated checksums.
|
||||
EXPECT_NE(checksum.find(result), std::string::npos)
|
||||
EXPECT_NE(checksum.find(result), absl::string_view::npos)
|
||||
<< result << " should be one of these:\n"
|
||||
<< checksum;
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/neteq/neteq.h"
|
||||
#include "rtc_base/message_digest.h"
|
||||
|
||||
@ -22,7 +23,7 @@ namespace webrtc {
|
||||
|
||||
class ResultSink {
|
||||
public:
|
||||
explicit ResultSink(const std::string& output_file);
|
||||
explicit ResultSink(absl::string_view output_file);
|
||||
~ResultSink();
|
||||
|
||||
template <typename T>
|
||||
@ -30,7 +31,7 @@ class ResultSink {
|
||||
|
||||
void AddResult(const NetEqNetworkStatistics& stats);
|
||||
|
||||
void VerifyChecksum(const std::string& ref_check_sum);
|
||||
void VerifyChecksum(absl::string_view ref_check_sum);
|
||||
|
||||
private:
|
||||
FILE* output_fp_;
|
||||
|
||||
@ -13,13 +13,15 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
bool AudioLoop::Init(const std::string file_name,
|
||||
bool AudioLoop::Init(absl::string_view file_name,
|
||||
size_t max_loop_length_samples,
|
||||
size_t block_length_samples) {
|
||||
FILE* fp = fopen(file_name.c_str(), "rb");
|
||||
FILE* fp = fopen(std::string(file_name).c_str(), "rb");
|
||||
if (!fp)
|
||||
return false;
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -36,7 +37,7 @@ class AudioLoop {
|
||||
// greater. Otherwise, the loop length is the same as the file length.
|
||||
// The audio will be delivered in blocks of `block_length_samples`.
|
||||
// Returns false if the initialization failed, otherwise true.
|
||||
bool Init(std::string file_name,
|
||||
bool Init(absl::string_view file_name,
|
||||
size_t max_loop_length_samples,
|
||||
size_t block_length_samples);
|
||||
|
||||
|
||||
@ -10,14 +10,15 @@
|
||||
|
||||
#include "modules/audio_coding/neteq/tools/input_audio_file.h"
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
InputAudioFile::InputAudioFile(const std::string file_name, bool loop_at_end)
|
||||
InputAudioFile::InputAudioFile(absl::string_view file_name, bool loop_at_end)
|
||||
: loop_at_end_(loop_at_end) {
|
||||
fp_ = fopen(file_name.c_str(), "rb");
|
||||
fp_ = fopen(std::string(file_name).c_str(), "rb");
|
||||
RTC_DCHECK(fp_) << file_name << " could not be opened.";
|
||||
}
|
||||
|
||||
|
||||
@ -15,13 +15,15 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
// Class for handling a looping input audio file.
|
||||
class InputAudioFile {
|
||||
public:
|
||||
explicit InputAudioFile(std::string file_name, bool loop_at_end = true);
|
||||
explicit InputAudioFile(absl::string_view file_name, bool loop_at_end = true);
|
||||
|
||||
virtual ~InputAudioFile();
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ void PrintDelays(const NetEqDelayAnalyzer::Delays& delays,
|
||||
absl::string_view var_name_x,
|
||||
absl::string_view var_name_y,
|
||||
std::ofstream& output,
|
||||
const std::string& terminator = "") {
|
||||
absl::string_view terminator = "") {
|
||||
output << var_name_x << " = [ ";
|
||||
for (const std::pair<int64_t, float>& delay : delays) {
|
||||
output << (delay.first - ref_time_ms) / 1000.f << ", ";
|
||||
@ -185,7 +185,7 @@ void NetEqDelayAnalyzer::CreateGraphs(Delays* arrival_delay_ms,
|
||||
}
|
||||
|
||||
void NetEqDelayAnalyzer::CreateMatlabScript(
|
||||
const std::string& script_name) const {
|
||||
absl::string_view script_name) const {
|
||||
Delays arrival_delay_ms;
|
||||
Delays corrected_arrival_delay_ms;
|
||||
Delays playout_delay_ms;
|
||||
@ -198,7 +198,7 @@ void NetEqDelayAnalyzer::CreateMatlabScript(
|
||||
const int64_t ref_time_ms = arrival_delay_ms.front().first;
|
||||
|
||||
// Create an output file stream to Matlab script file.
|
||||
std::ofstream output(script_name);
|
||||
std::ofstream output(std::string{script_name});
|
||||
|
||||
PrintDelays(corrected_arrival_delay_ms, ref_time_ms, kArrivalDelayX,
|
||||
kArrivalDelayY, output, ";");
|
||||
@ -241,7 +241,7 @@ void NetEqDelayAnalyzer::CreateMatlabScript(
|
||||
}
|
||||
|
||||
void NetEqDelayAnalyzer::CreatePythonScript(
|
||||
const std::string& script_name) const {
|
||||
absl::string_view script_name) const {
|
||||
Delays arrival_delay_ms;
|
||||
Delays corrected_arrival_delay_ms;
|
||||
Delays playout_delay_ms;
|
||||
@ -254,7 +254,7 @@ void NetEqDelayAnalyzer::CreatePythonScript(
|
||||
const int64_t ref_time_ms = arrival_delay_ms.front().first;
|
||||
|
||||
// Create an output file stream to the python script file.
|
||||
std::ofstream output(script_name);
|
||||
std::ofstream output(std::string{script_name});
|
||||
|
||||
// Necessary includes
|
||||
output << "import numpy as np" << std::endl;
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/audio_coding/neteq/tools/neteq_input.h"
|
||||
#include "modules/audio_coding/neteq/tools/neteq_test.h"
|
||||
@ -45,12 +46,12 @@ class NetEqDelayAnalyzer : public test::NetEqPostInsertPacket,
|
||||
// Creates a matlab script with file name script_name. When executed in
|
||||
// Matlab, the script will generate graphs with the same timing information
|
||||
// as provided by CreateGraphs.
|
||||
void CreateMatlabScript(const std::string& script_name) const;
|
||||
void CreateMatlabScript(absl::string_view script_name) const;
|
||||
|
||||
// Creates a python script with file name `script_name`. When executed in
|
||||
// Python, the script will generate graphs with the same timing information
|
||||
// as provided by CreateGraphs.
|
||||
void CreatePythonScript(const std::string& script_name) const;
|
||||
void CreatePythonScript(absl::string_view script_name) const;
|
||||
|
||||
private:
|
||||
struct TimingData {
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/neteq/tools/rtc_event_log_source.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
@ -20,7 +21,7 @@ namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
NetEqEventLogInput* NetEqEventLogInput::CreateFromFile(
|
||||
const std::string& file_name,
|
||||
absl::string_view file_name,
|
||||
absl::optional<uint32_t> ssrc_filter) {
|
||||
auto event_log_src =
|
||||
RtcEventLogSource::CreateFromFile(file_name, ssrc_filter);
|
||||
@ -31,7 +32,7 @@ NetEqEventLogInput* NetEqEventLogInput::CreateFromFile(
|
||||
}
|
||||
|
||||
NetEqEventLogInput* NetEqEventLogInput::CreateFromString(
|
||||
const std::string& file_contents,
|
||||
absl::string_view file_contents,
|
||||
absl::optional<uint32_t> ssrc_filter) {
|
||||
auto event_log_src =
|
||||
RtcEventLogSource::CreateFromString(file_contents, ssrc_filter);
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/neteq/tools/neteq_packet_source_input.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
|
||||
@ -28,10 +29,10 @@ class RtcEventLogSource;
|
||||
class NetEqEventLogInput final : public NetEqPacketSourceInput {
|
||||
public:
|
||||
static NetEqEventLogInput* CreateFromFile(
|
||||
const std::string& file_name,
|
||||
absl::string_view file_name,
|
||||
absl::optional<uint32_t> ssrc_filter);
|
||||
static NetEqEventLogInput* CreateFromString(
|
||||
const std::string& file_contents,
|
||||
absl::string_view file_contents,
|
||||
absl::optional<uint32_t> ssrc_filter);
|
||||
|
||||
absl::optional<int64_t> NextOutputEventTime() const override;
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/neteq/tools/rtp_file_source.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
@ -58,7 +59,7 @@ std::unique_ptr<NetEqInput::PacketData> NetEqPacketSourceInput::PopPacket() {
|
||||
return packet_data;
|
||||
}
|
||||
|
||||
NetEqRtpDumpInput::NetEqRtpDumpInput(const std::string& file_name,
|
||||
NetEqRtpDumpInput::NetEqRtpDumpInput(absl::string_view file_name,
|
||||
const RtpHeaderExtensionMap& hdr_ext_map,
|
||||
absl::optional<uint32_t> ssrc_filter)
|
||||
: source_(RtpFileSource::Create(file_name, ssrc_filter)) {
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/audio_coding/neteq/tools/neteq_input.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
@ -48,7 +49,7 @@ class NetEqPacketSourceInput : public NetEqInput {
|
||||
// Implementation of NetEqPacketSourceInput to be used with an RtpFileSource.
|
||||
class NetEqRtpDumpInput final : public NetEqPacketSourceInput {
|
||||
public:
|
||||
NetEqRtpDumpInput(const std::string& file_name,
|
||||
NetEqRtpDumpInput(absl::string_view file_name,
|
||||
const RtpHeaderExtensionMap& hdr_ext_map,
|
||||
absl::optional<uint32_t> ssrc_filter);
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/neteq/default_neteq_factory.h"
|
||||
#include "modules/audio_coding/neteq/tools/neteq_quality_test.h"
|
||||
#include "modules/audio_coding/neteq/tools/output_audio_file.h"
|
||||
@ -105,13 +106,13 @@ const int kInitSeed = 0x12345678;
|
||||
const int kPacketLossTimeUnitMs = 10;
|
||||
|
||||
// Common validator for file names.
|
||||
static bool ValidateFilename(const std::string& value, bool is_output) {
|
||||
static bool ValidateFilename(absl::string_view value, bool is_output) {
|
||||
if (!is_output) {
|
||||
RTC_CHECK_NE(value.substr(value.find_last_of('.') + 1), "wav")
|
||||
<< "WAV file input is not supported";
|
||||
}
|
||||
FILE* fid =
|
||||
is_output ? fopen(value.c_str(), "wb") : fopen(value.c_str(), "rb");
|
||||
FILE* fid = is_output ? fopen(std::string(value).c_str(), "wb")
|
||||
: fopen(std::string(value).c_str(), "rb");
|
||||
if (fid == nullptr)
|
||||
return false;
|
||||
fclose(fid);
|
||||
|
||||
@ -159,7 +159,7 @@ namespace {
|
||||
// Parses the input string for a valid SSRC (at the start of the string). If a
|
||||
// valid SSRC is found, it is written to the output variable `ssrc`, and true is
|
||||
// returned. Otherwise, false is returned.
|
||||
bool ParseSsrc(const std::string& str, uint32_t* ssrc) {
|
||||
bool ParseSsrc(absl::string_view str, uint32_t* ssrc) {
|
||||
if (str.empty())
|
||||
return true;
|
||||
int base = 10;
|
||||
@ -168,12 +168,13 @@ bool ParseSsrc(const std::string& str, uint32_t* ssrc) {
|
||||
base = 16;
|
||||
errno = 0;
|
||||
char* end_ptr;
|
||||
unsigned long value = strtoul(str.c_str(), &end_ptr, base); // NOLINT
|
||||
std::string str_str = std::string(str);
|
||||
unsigned long value = strtoul(str_str.c_str(), &end_ptr, base); // NOLINT
|
||||
if (value == ULONG_MAX && errno == ERANGE)
|
||||
return false; // Value out of range for unsigned long.
|
||||
if (sizeof(unsigned long) > sizeof(uint32_t) && value > 0xFFFFFFFF) // NOLINT
|
||||
return false; // Value out of range for uint32_t.
|
||||
if (end_ptr - str.c_str() < static_cast<ptrdiff_t>(str.length()))
|
||||
if (end_ptr - str_str.c_str() < static_cast<ptrdiff_t>(str.length()))
|
||||
return false; // Part of the string was not parsed.
|
||||
*ssrc = static_cast<uint32_t>(value);
|
||||
return true;
|
||||
@ -196,15 +197,15 @@ bool ValidatePayloadType(int value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ValidateSsrcValue(const std::string& str) {
|
||||
bool ValidateSsrcValue(absl::string_view str) {
|
||||
uint32_t dummy_ssrc;
|
||||
if (ParseSsrc(str, &dummy_ssrc)) // Value is ok.
|
||||
return true;
|
||||
printf("Invalid SSRC: %s\n", str.c_str());
|
||||
printf("Invalid SSRC: %.*s\n", static_cast<int>(str.size()), str.data());
|
||||
return false;
|
||||
}
|
||||
|
||||
void PrintCodecMappingEntry(const char* codec, int flag) {
|
||||
void PrintCodecMappingEntry(absl::string_view codec, int flag) {
|
||||
std::cout << codec << ": " << flag << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@ -15,13 +15,15 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
NetEqStatsPlotter::NetEqStatsPlotter(bool make_matlab_plot,
|
||||
bool make_python_plot,
|
||||
bool show_concealment_events,
|
||||
std::string base_file_name)
|
||||
absl::string_view base_file_name)
|
||||
: make_matlab_plot_(make_matlab_plot),
|
||||
make_python_plot_(make_python_plot),
|
||||
show_concealment_events_(show_concealment_events),
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/neteq/tools/neteq_delay_analyzer.h"
|
||||
#include "modules/audio_coding/neteq/tools/neteq_stats_getter.h"
|
||||
#include "modules/audio_coding/neteq/tools/neteq_test.h"
|
||||
@ -26,7 +27,7 @@ class NetEqStatsPlotter : public NetEqSimulationEndedCallback {
|
||||
NetEqStatsPlotter(bool make_matlab_plot,
|
||||
bool make_python_plot,
|
||||
bool show_concealment_events,
|
||||
std::string base_file_name);
|
||||
absl::string_view base_file_name);
|
||||
|
||||
void SimulationEnded(int64_t simulation_time_ms) override;
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/neteq/neteq.h"
|
||||
#include "modules/audio_coding/neteq/tools/audio_sink.h"
|
||||
@ -108,7 +109,7 @@ NetEqTestFactory::Config::Config(const Config& other) = default;
|
||||
NetEqTestFactory::Config::~Config() = default;
|
||||
|
||||
std::unique_ptr<NetEqTest> NetEqTestFactory::InitializeTestFromString(
|
||||
const std::string& input_string,
|
||||
absl::string_view input_string,
|
||||
NetEqFactory* factory,
|
||||
const Config& config) {
|
||||
std::unique_ptr<NetEqInput> input(
|
||||
@ -121,7 +122,7 @@ std::unique_ptr<NetEqTest> NetEqTestFactory::InitializeTestFromString(
|
||||
}
|
||||
|
||||
std::unique_ptr<NetEqTest> NetEqTestFactory::InitializeTestFromFile(
|
||||
const std::string& input_file_name,
|
||||
absl::string_view input_file_name,
|
||||
NetEqFactory* factory,
|
||||
const Config& config) {
|
||||
// Gather RTP header extensions in a map.
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/audio_coding/neteq/tools/neteq_test.h"
|
||||
#include "test/field_trial.h"
|
||||
@ -146,11 +147,11 @@ class NetEqTestFactory {
|
||||
};
|
||||
|
||||
std::unique_ptr<NetEqTest> InitializeTestFromFile(
|
||||
const std::string& input_filename,
|
||||
absl::string_view input_filename,
|
||||
NetEqFactory* neteq_factory,
|
||||
const Config& config);
|
||||
std::unique_ptr<NetEqTest> InitializeTestFromString(
|
||||
const std::string& input_string,
|
||||
absl::string_view input_string,
|
||||
NetEqFactory* neteq_factory,
|
||||
const Config& config);
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/neteq/tools/audio_sink.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -24,8 +25,8 @@ class OutputAudioFile : public AudioSink {
|
||||
public:
|
||||
// Creates an OutputAudioFile, opening a file named `file_name` for writing.
|
||||
// The file format is 16-bit signed host-endian PCM.
|
||||
explicit OutputAudioFile(const std::string& file_name) {
|
||||
out_file_ = fopen(file_name.c_str(), "wb");
|
||||
explicit OutputAudioFile(absl::string_view file_name) {
|
||||
out_file_ = fopen(std::string(file_name).c_str(), "wb");
|
||||
}
|
||||
|
||||
virtual ~OutputAudioFile() {
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "common_audio/wav_file.h"
|
||||
#include "modules/audio_coding/neteq/tools/audio_sink.h"
|
||||
|
||||
@ -23,7 +24,7 @@ class OutputWavFile : public AudioSink {
|
||||
public:
|
||||
// Creates an OutputWavFile, opening a file named `file_name` for writing.
|
||||
// The output file is a PCM encoded wav file.
|
||||
OutputWavFile(const std::string& file_name,
|
||||
OutputWavFile(absl::string_view file_name,
|
||||
int sample_rate_hz,
|
||||
int num_channels = 1)
|
||||
: wav_writer_(file_name, sample_rate_hz, num_channels) {}
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "common_audio/resampler/include/resampler.h"
|
||||
#include "modules/audio_coding/neteq/tools/input_audio_file.h"
|
||||
|
||||
@ -22,13 +23,13 @@ namespace test {
|
||||
// Class for handling a looping input audio file with resampling.
|
||||
class ResampleInputAudioFile : public InputAudioFile {
|
||||
public:
|
||||
ResampleInputAudioFile(const std::string file_name,
|
||||
ResampleInputAudioFile(absl::string_view file_name,
|
||||
int file_rate_hz,
|
||||
bool loop_at_end = true)
|
||||
: InputAudioFile(file_name, loop_at_end),
|
||||
file_rate_hz_(file_rate_hz),
|
||||
output_rate_hz_(-1) {}
|
||||
ResampleInputAudioFile(const std::string file_name,
|
||||
ResampleInputAudioFile(absl::string_view file_name,
|
||||
int file_rate_hz,
|
||||
int output_rate_hz,
|
||||
bool loop_at_end = true)
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "logging/rtc_event_log/rtc_event_processor.h"
|
||||
#include "modules/audio_coding/neteq/tools/packet.h"
|
||||
#include "rtc_base/checks.h"
|
||||
@ -38,7 +39,7 @@ bool ShouldSkipStream(ParsedRtcEventLog::MediaType media_type,
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<RtcEventLogSource> RtcEventLogSource::CreateFromFile(
|
||||
const std::string& file_name,
|
||||
absl::string_view file_name,
|
||||
absl::optional<uint32_t> ssrc_filter) {
|
||||
auto source = std::unique_ptr<RtcEventLogSource>(new RtcEventLogSource());
|
||||
ParsedRtcEventLog parsed_log;
|
||||
@ -57,7 +58,7 @@ std::unique_ptr<RtcEventLogSource> RtcEventLogSource::CreateFromFile(
|
||||
}
|
||||
|
||||
std::unique_ptr<RtcEventLogSource> RtcEventLogSource::CreateFromString(
|
||||
const std::string& file_contents,
|
||||
absl::string_view file_contents,
|
||||
absl::optional<uint32_t> ssrc_filter) {
|
||||
auto source = std::unique_ptr<RtcEventLogSource>(new RtcEventLogSource());
|
||||
ParsedRtcEventLog parsed_log;
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log_parser.h"
|
||||
#include "modules/audio_coding/neteq/tools/packet_source.h"
|
||||
@ -33,11 +34,11 @@ class RtcEventLogSource : public PacketSource {
|
||||
// Creates an RtcEventLogSource reading from `file_name`. If the file cannot
|
||||
// be opened, or has the wrong format, NULL will be returned.
|
||||
static std::unique_ptr<RtcEventLogSource> CreateFromFile(
|
||||
const std::string& file_name,
|
||||
absl::string_view file_name,
|
||||
absl::optional<uint32_t> ssrc_filter);
|
||||
// Same as above, but uses a string with the file contents.
|
||||
static std::unique_ptr<RtcEventLogSource> CreateFromString(
|
||||
const std::string& file_contents,
|
||||
absl::string_view file_contents,
|
||||
absl::optional<uint32_t> ssrc_filter);
|
||||
|
||||
virtual ~RtcEventLogSource();
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#include "modules/audio_coding/neteq/tools/rtp_file_source.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#ifndef WIN32
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
@ -24,20 +26,20 @@
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
RtpFileSource* RtpFileSource::Create(const std::string& file_name,
|
||||
RtpFileSource* RtpFileSource::Create(absl::string_view file_name,
|
||||
absl::optional<uint32_t> ssrc_filter) {
|
||||
RtpFileSource* source = new RtpFileSource(ssrc_filter);
|
||||
RTC_CHECK(source->OpenFile(file_name));
|
||||
return source;
|
||||
}
|
||||
|
||||
bool RtpFileSource::ValidRtpDump(const std::string& file_name) {
|
||||
bool RtpFileSource::ValidRtpDump(absl::string_view file_name) {
|
||||
std::unique_ptr<RtpFileReader> temp_file(
|
||||
RtpFileReader::Create(RtpFileReader::kRtpDump, file_name));
|
||||
return !!temp_file;
|
||||
}
|
||||
|
||||
bool RtpFileSource::ValidPcap(const std::string& file_name) {
|
||||
bool RtpFileSource::ValidPcap(absl::string_view file_name) {
|
||||
std::unique_ptr<RtpFileReader> temp_file(
|
||||
RtpFileReader::Create(RtpFileReader::kPcap, file_name));
|
||||
return !!temp_file;
|
||||
@ -81,7 +83,7 @@ RtpFileSource::RtpFileSource(absl::optional<uint32_t> ssrc_filter)
|
||||
: PacketSource(),
|
||||
ssrc_filter_(ssrc_filter) {}
|
||||
|
||||
bool RtpFileSource::OpenFile(const std::string& file_name) {
|
||||
bool RtpFileSource::OpenFile(absl::string_view file_name) {
|
||||
rtp_reader_.reset(RtpFileReader::Create(RtpFileReader::kRtpDump, file_name));
|
||||
if (rtp_reader_)
|
||||
return true;
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/audio_coding/neteq/tools/packet_source.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
@ -31,12 +32,12 @@ class RtpFileSource : public PacketSource {
|
||||
// Creates an RtpFileSource reading from `file_name`. If the file cannot be
|
||||
// opened, or has the wrong format, NULL will be returned.
|
||||
static RtpFileSource* Create(
|
||||
const std::string& file_name,
|
||||
absl::string_view file_name,
|
||||
absl::optional<uint32_t> ssrc_filter = absl::nullopt);
|
||||
|
||||
// Checks whether a files is a valid RTP dump or PCAP (Wireshark) file.
|
||||
static bool ValidRtpDump(const std::string& file_name);
|
||||
static bool ValidPcap(const std::string& file_name);
|
||||
static bool ValidRtpDump(absl::string_view file_name);
|
||||
static bool ValidPcap(absl::string_view file_name);
|
||||
|
||||
~RtpFileSource() override;
|
||||
|
||||
@ -55,7 +56,7 @@ class RtpFileSource : public PacketSource {
|
||||
|
||||
explicit RtpFileSource(absl::optional<uint32_t> ssrc_filter);
|
||||
|
||||
bool OpenFile(const std::string& file_name);
|
||||
bool OpenFile(absl::string_view file_name);
|
||||
|
||||
std::unique_ptr<RtpFileReader> rtp_reader_;
|
||||
const absl::optional<uint32_t> ssrc_filter_;
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module.h"
|
||||
@ -51,7 +52,7 @@ Sender::Sender()
|
||||
|
||||
void Sender::Setup(AudioCodingModule* acm,
|
||||
RTPStream* rtpStream,
|
||||
std::string in_file_name,
|
||||
absl::string_view in_file_name,
|
||||
int in_sample_rate,
|
||||
int payload_type,
|
||||
SdpAudioFormat format) {
|
||||
@ -103,7 +104,7 @@ Receiver::Receiver()
|
||||
|
||||
void Receiver::Setup(AudioCodingModule* acm,
|
||||
RTPStream* rtpStream,
|
||||
std::string out_file_name,
|
||||
absl::string_view out_file_name,
|
||||
size_t channels,
|
||||
int file_num) {
|
||||
EXPECT_EQ(0, acm->InitializeReceiver());
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module.h"
|
||||
#include "modules/audio_coding/test/PCMFile.h"
|
||||
#include "modules/audio_coding/test/RTPFile.h"
|
||||
@ -51,7 +52,7 @@ class Sender {
|
||||
Sender();
|
||||
void Setup(AudioCodingModule* acm,
|
||||
RTPStream* rtpStream,
|
||||
std::string in_file_name,
|
||||
absl::string_view in_file_name,
|
||||
int in_sample_rate,
|
||||
int payload_type,
|
||||
SdpAudioFormat format);
|
||||
@ -74,7 +75,7 @@ class Receiver {
|
||||
virtual ~Receiver() {}
|
||||
void Setup(AudioCodingModule* acm,
|
||||
RTPStream* rtpStream,
|
||||
std::string out_file_name,
|
||||
absl::string_view out_file_name,
|
||||
size_t channels,
|
||||
int file_num);
|
||||
void Teardown();
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
@ -103,12 +104,13 @@ int16_t PCMFile::ChooseFile(std::string* file_name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PCMFile::Open(const std::string& file_name,
|
||||
void PCMFile::Open(absl::string_view file_name,
|
||||
uint16_t frequency,
|
||||
const char* mode,
|
||||
absl::string_view mode,
|
||||
bool auto_rewind) {
|
||||
if ((pcm_file_ = fopen(file_name.c_str(), mode)) == NULL) {
|
||||
printf("Cannot open file %s.\n", file_name.c_str());
|
||||
if ((pcm_file_ = fopen(std::string(file_name).c_str(),
|
||||
std::string(mode).c_str())) == NULL) {
|
||||
printf("Cannot open file %s.\n", std::string(file_name).c_str());
|
||||
ADD_FAILURE() << "Unable to read file";
|
||||
}
|
||||
frequency_ = frequency;
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/audio/audio_frame.h"
|
||||
|
||||
@ -27,9 +28,9 @@ class PCMFile {
|
||||
PCMFile(uint32_t timestamp);
|
||||
~PCMFile();
|
||||
|
||||
void Open(const std::string& filename,
|
||||
void Open(absl::string_view filename,
|
||||
uint16_t frequency,
|
||||
const char* mode,
|
||||
absl::string_view mode,
|
||||
bool auto_rewind = false);
|
||||
|
||||
int32_t Read10MsData(AudioFrame& audio_frame);
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/gtest.h"
|
||||
@ -28,7 +29,7 @@ ReceiverWithPacketLoss::ReceiverWithPacketLoss()
|
||||
|
||||
void ReceiverWithPacketLoss::Setup(AudioCodingModule* acm,
|
||||
RTPStream* rtpStream,
|
||||
std::string out_file_name,
|
||||
absl::string_view out_file_name,
|
||||
int channels,
|
||||
int file_num,
|
||||
int loss_rate,
|
||||
@ -89,7 +90,7 @@ SenderWithFEC::SenderWithFEC() : expected_loss_rate_(0) {}
|
||||
|
||||
void SenderWithFEC::Setup(AudioCodingModule* acm,
|
||||
RTPStream* rtpStream,
|
||||
std::string in_file_name,
|
||||
absl::string_view in_file_name,
|
||||
int payload_type,
|
||||
SdpAudioFormat format,
|
||||
int expected_loss_rate) {
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "modules/audio_coding/test/EncodeDecodeTest.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -22,7 +23,7 @@ class ReceiverWithPacketLoss : public Receiver {
|
||||
ReceiverWithPacketLoss();
|
||||
void Setup(AudioCodingModule* acm,
|
||||
RTPStream* rtpStream,
|
||||
std::string out_file_name,
|
||||
absl::string_view out_file_name,
|
||||
int channels,
|
||||
int file_num,
|
||||
int loss_rate,
|
||||
@ -43,7 +44,7 @@ class SenderWithFEC : public Sender {
|
||||
SenderWithFEC();
|
||||
void Setup(AudioCodingModule* acm,
|
||||
RTPStream* rtpStream,
|
||||
std::string in_file_name,
|
||||
absl::string_view in_file_name,
|
||||
int payload_type,
|
||||
SdpAudioFormat format,
|
||||
int expected_loss_rate);
|
||||
|
||||
@ -14,6 +14,8 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Winsock2.h>
|
||||
#else
|
||||
@ -122,9 +124,11 @@ bool RTPBuffer::EndOfFile() const {
|
||||
return _rtpQueue.empty();
|
||||
}
|
||||
|
||||
void RTPFile::Open(const char* filename, const char* mode) {
|
||||
if ((_rtpFile = fopen(filename, mode)) == NULL) {
|
||||
printf("Cannot write file %s.\n", filename);
|
||||
void RTPFile::Open(absl::string_view filename, absl::string_view mode) {
|
||||
std::string filename_str = std::string(filename);
|
||||
if ((_rtpFile = fopen(filename_str.c_str(), std::string(mode).c_str())) ==
|
||||
NULL) {
|
||||
printf("Cannot write file %s.\n", filename_str.c_str());
|
||||
ADD_FAILURE() << "Unable to write file";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
@ -100,7 +101,7 @@ class RTPFile : public RTPStream {
|
||||
|
||||
RTPFile() : _rtpFile(NULL), _rtpEOF(false) {}
|
||||
|
||||
void Open(const char* outFilename, const char* mode);
|
||||
void Open(absl::string_view outFilename, absl::string_view mode);
|
||||
|
||||
void Close();
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio_codecs/audio_decoder_factory_template.h"
|
||||
#include "api/audio_codecs/audio_encoder_factory_template.h"
|
||||
#include "api/audio_codecs/ilbc/audio_decoder_ilbc.h"
|
||||
@ -114,10 +115,10 @@ bool TestVadDtx::RegisterCodec(const SdpAudioFormat& codec_format,
|
||||
|
||||
// Encoding a file and see if the numbers that various packets occur follow
|
||||
// the expectation.
|
||||
void TestVadDtx::Run(std::string in_filename,
|
||||
void TestVadDtx::Run(absl::string_view in_filename,
|
||||
int frequency,
|
||||
int channels,
|
||||
std::string out_filename,
|
||||
absl::string_view out_filename,
|
||||
bool append,
|
||||
const int* expects) {
|
||||
packetization_callback_->ResetStatistics();
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio_codecs/audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/audio_encoder_factory.h"
|
||||
#include "common_audio/vad/include/vad.h"
|
||||
@ -73,10 +74,10 @@ class TestVadDtx {
|
||||
// 0 - kEmptyFrame
|
||||
// 1 - kAudioFrameSpeech
|
||||
// 2 - kAudioFrameCN
|
||||
void Run(std::string in_filename,
|
||||
void Run(absl::string_view in_filename,
|
||||
int frequency,
|
||||
int channels,
|
||||
std::string out_filename,
|
||||
absl::string_view out_filename,
|
||||
bool append,
|
||||
const int* expects);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user