Use absl::make_unique in TestAudioDeviceModule factory methods
Bug: webrtc:10138 Change-Id: Ibe9f4b4343b8e5c9a5e1a6d41bd06b24d69db878 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133166 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27646}
This commit is contained in:
parent
7eb4248b02
commit
dd1c16f00c
@ -479,24 +479,23 @@ std::unique_ptr<TestAudioDeviceModule::PulsedNoiseCapturer>
|
|||||||
TestAudioDeviceModule::CreatePulsedNoiseCapturer(int16_t max_amplitude,
|
TestAudioDeviceModule::CreatePulsedNoiseCapturer(int16_t max_amplitude,
|
||||||
int sampling_frequency_in_hz,
|
int sampling_frequency_in_hz,
|
||||||
int num_channels) {
|
int num_channels) {
|
||||||
return std::unique_ptr<TestAudioDeviceModule::PulsedNoiseCapturer>(
|
return absl::make_unique<PulsedNoiseCapturerImpl>(
|
||||||
new PulsedNoiseCapturerImpl(max_amplitude, sampling_frequency_in_hz,
|
max_amplitude, sampling_frequency_in_hz, num_channels);
|
||||||
num_channels));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TestAudioDeviceModule::Renderer>
|
std::unique_ptr<TestAudioDeviceModule::Renderer>
|
||||||
TestAudioDeviceModule::CreateDiscardRenderer(int sampling_frequency_in_hz,
|
TestAudioDeviceModule::CreateDiscardRenderer(int sampling_frequency_in_hz,
|
||||||
int num_channels) {
|
int num_channels) {
|
||||||
return std::unique_ptr<TestAudioDeviceModule::Renderer>(
|
return absl::make_unique<DiscardRenderer>(sampling_frequency_in_hz,
|
||||||
new DiscardRenderer(sampling_frequency_in_hz, num_channels));
|
num_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TestAudioDeviceModule::Capturer>
|
std::unique_ptr<TestAudioDeviceModule::Capturer>
|
||||||
TestAudioDeviceModule::CreateWavFileReader(std::string filename,
|
TestAudioDeviceModule::CreateWavFileReader(std::string filename,
|
||||||
int sampling_frequency_in_hz,
|
int sampling_frequency_in_hz,
|
||||||
int num_channels) {
|
int num_channels) {
|
||||||
return std::unique_ptr<TestAudioDeviceModule::Capturer>(
|
return absl::make_unique<WavFileReader>(filename, sampling_frequency_in_hz,
|
||||||
new WavFileReader(filename, sampling_frequency_in_hz, num_channels));
|
num_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TestAudioDeviceModule::Capturer>
|
std::unique_ptr<TestAudioDeviceModule::Capturer>
|
||||||
@ -504,33 +503,32 @@ TestAudioDeviceModule::CreateWavFileReader(std::string filename) {
|
|||||||
WavReader reader(filename);
|
WavReader reader(filename);
|
||||||
int sampling_frequency_in_hz = reader.sample_rate();
|
int sampling_frequency_in_hz = reader.sample_rate();
|
||||||
int num_channels = rtc::checked_cast<int>(reader.num_channels());
|
int num_channels = rtc::checked_cast<int>(reader.num_channels());
|
||||||
return std::unique_ptr<TestAudioDeviceModule::Capturer>(
|
return absl::make_unique<WavFileReader>(filename, sampling_frequency_in_hz,
|
||||||
new WavFileReader(filename, sampling_frequency_in_hz, num_channels));
|
num_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TestAudioDeviceModule::Renderer>
|
std::unique_ptr<TestAudioDeviceModule::Renderer>
|
||||||
TestAudioDeviceModule::CreateWavFileWriter(std::string filename,
|
TestAudioDeviceModule::CreateWavFileWriter(std::string filename,
|
||||||
int sampling_frequency_in_hz,
|
int sampling_frequency_in_hz,
|
||||||
int num_channels) {
|
int num_channels) {
|
||||||
return std::unique_ptr<TestAudioDeviceModule::Renderer>(
|
return absl::make_unique<WavFileWriter>(filename, sampling_frequency_in_hz,
|
||||||
new WavFileWriter(filename, sampling_frequency_in_hz, num_channels));
|
num_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TestAudioDeviceModule::Renderer>
|
std::unique_ptr<TestAudioDeviceModule::Renderer>
|
||||||
TestAudioDeviceModule::CreateBoundedWavFileWriter(std::string filename,
|
TestAudioDeviceModule::CreateBoundedWavFileWriter(std::string filename,
|
||||||
int sampling_frequency_in_hz,
|
int sampling_frequency_in_hz,
|
||||||
int num_channels) {
|
int num_channels) {
|
||||||
return std::unique_ptr<TestAudioDeviceModule::Renderer>(
|
return absl::make_unique<BoundedWavFileWriter>(
|
||||||
new BoundedWavFileWriter(filename, sampling_frequency_in_hz,
|
filename, sampling_frequency_in_hz, num_channels);
|
||||||
num_channels));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TestAudioDeviceModule::Capturer>
|
std::unique_ptr<TestAudioDeviceModule::Capturer>
|
||||||
TestAudioDeviceModule::CreateWavFileReader(rtc::PlatformFile file,
|
TestAudioDeviceModule::CreateWavFileReader(rtc::PlatformFile file,
|
||||||
int sampling_frequency_in_hz,
|
int sampling_frequency_in_hz,
|
||||||
int num_channels) {
|
int num_channels) {
|
||||||
return std::unique_ptr<TestAudioDeviceModule::Capturer>(
|
return absl::make_unique<WavFileReader>(file, sampling_frequency_in_hz,
|
||||||
new WavFileReader(file, sampling_frequency_in_hz, num_channels));
|
num_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TestAudioDeviceModule::Capturer>
|
std::unique_ptr<TestAudioDeviceModule::Capturer>
|
||||||
@ -538,24 +536,24 @@ TestAudioDeviceModule::CreateWavFileReader(rtc::PlatformFile file) {
|
|||||||
WavReader reader(file);
|
WavReader reader(file);
|
||||||
int sampling_frequency_in_hz = reader.sample_rate();
|
int sampling_frequency_in_hz = reader.sample_rate();
|
||||||
int num_channels = rtc::checked_cast<int>(reader.num_channels());
|
int num_channels = rtc::checked_cast<int>(reader.num_channels());
|
||||||
return std::unique_ptr<TestAudioDeviceModule::Capturer>(
|
return absl::make_unique<WavFileReader>(file, sampling_frequency_in_hz,
|
||||||
new WavFileReader(file, sampling_frequency_in_hz, num_channels));
|
num_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TestAudioDeviceModule::Renderer>
|
std::unique_ptr<TestAudioDeviceModule::Renderer>
|
||||||
TestAudioDeviceModule::CreateWavFileWriter(rtc::PlatformFile file,
|
TestAudioDeviceModule::CreateWavFileWriter(rtc::PlatformFile file,
|
||||||
int sampling_frequency_in_hz,
|
int sampling_frequency_in_hz,
|
||||||
int num_channels) {
|
int num_channels) {
|
||||||
return std::unique_ptr<TestAudioDeviceModule::Renderer>(
|
return absl::make_unique<WavFileWriter>(file, sampling_frequency_in_hz,
|
||||||
new WavFileWriter(file, sampling_frequency_in_hz, num_channels));
|
num_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TestAudioDeviceModule::Renderer>
|
std::unique_ptr<TestAudioDeviceModule::Renderer>
|
||||||
TestAudioDeviceModule::CreateBoundedWavFileWriter(rtc::PlatformFile file,
|
TestAudioDeviceModule::CreateBoundedWavFileWriter(rtc::PlatformFile file,
|
||||||
int sampling_frequency_in_hz,
|
int sampling_frequency_in_hz,
|
||||||
int num_channels) {
|
int num_channels) {
|
||||||
return std::unique_ptr<TestAudioDeviceModule::Renderer>(
|
return absl::make_unique<BoundedWavFileWriter>(file, sampling_frequency_in_hz,
|
||||||
new BoundedWavFileWriter(file, sampling_frequency_in_hz, num_channels));
|
num_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user