[media][audio] MixerPtr -> std::unique_ptr<Mixer>
Cleanup while reading the code.
TEST: No behavior change. fx run-test audio_mixer_tests
Change-Id: Ic63d36dafe4e8bd122d34a05a8af09ebee943abb
diff --git a/garnet/bin/media/audio_core/mixer/linear_sampler.cc b/garnet/bin/media/audio_core/mixer/linear_sampler.cc
index 51b88a199..6714be2 100644
--- a/garnet/bin/media/audio_core/mixer/linear_sampler.cc
+++ b/garnet/bin/media/audio_core/mixer/linear_sampler.cc
@@ -669,15 +669,15 @@
// Templates used to expand all of the different combinations of the possible
// LinearSampler Mixer configurations.
template <size_t DestChanCount, typename SrcSampleType, size_t SrcChanCount>
-static inline MixerPtr SelectLSM(
+static inline std::unique_ptr<Mixer> SelectLSM(
const fuchsia::media::AudioStreamType& src_format,
const fuchsia::media::AudioStreamType& dest_format) {
- return MixerPtr(
- new LinearSamplerImpl<DestChanCount, SrcSampleType, SrcChanCount>());
+ return std::make_unique<
+ LinearSamplerImpl<DestChanCount, SrcSampleType, SrcChanCount>>();
}
template <size_t DestChanCount, typename SrcSampleType>
-static inline MixerPtr SelectLSM(
+static inline std::unique_ptr<Mixer> SelectLSM(
const fuchsia::media::AudioStreamType& src_format,
const fuchsia::media::AudioStreamType& dest_format) {
switch (src_format.channels) {
@@ -693,7 +693,7 @@
}
template <size_t DestChanCount>
-static inline MixerPtr SelectLSM(
+static inline std::unique_ptr<Mixer> SelectLSM(
const fuchsia::media::AudioStreamType& src_format,
const fuchsia::media::AudioStreamType& dest_format) {
switch (src_format.sample_format) {
@@ -710,23 +710,26 @@
}
}
-static inline MixerPtr SelectNxNLSM(
+static inline std::unique_ptr<Mixer> SelectNxNLSM(
const fuchsia::media::AudioStreamType& src_format) {
switch (src_format.sample_format) {
case fuchsia::media::AudioSampleFormat::UNSIGNED_8:
- return MixerPtr(new NxNLinearSamplerImpl<uint8_t>(src_format.channels));
+ return std::make_unique<NxNLinearSamplerImpl<uint8_t>>(
+ src_format.channels);
case fuchsia::media::AudioSampleFormat::SIGNED_16:
- return MixerPtr(new NxNLinearSamplerImpl<int16_t>(src_format.channels));
+ return std::make_unique<NxNLinearSamplerImpl<int16_t>>(
+ src_format.channels);
case fuchsia::media::AudioSampleFormat::SIGNED_24_IN_32:
- return MixerPtr(new NxNLinearSamplerImpl<int32_t>(src_format.channels));
+ return std::make_unique<NxNLinearSamplerImpl<int32_t>>(
+ src_format.channels);
case fuchsia::media::AudioSampleFormat::FLOAT:
- return MixerPtr(new NxNLinearSamplerImpl<float>(src_format.channels));
+ return std::make_unique<NxNLinearSamplerImpl<float>>(src_format.channels);
default:
return nullptr;
}
}
-MixerPtr LinearSampler::Select(
+std::unique_ptr<Mixer> LinearSampler::Select(
const fuchsia::media::AudioStreamType& src_format,
const fuchsia::media::AudioStreamType& dest_format) {
if (src_format.channels == dest_format.channels && src_format.channels > 2) {
diff --git a/garnet/bin/media/audio_core/mixer/linear_sampler.h b/garnet/bin/media/audio_core/mixer/linear_sampler.h
index 0de8edd..7a90138 100644
--- a/garnet/bin/media/audio_core/mixer/linear_sampler.h
+++ b/garnet/bin/media/audio_core/mixer/linear_sampler.h
@@ -13,8 +13,9 @@
class LinearSampler : public Mixer {
public:
- static MixerPtr Select(const fuchsia::media::AudioStreamType& src_format,
- const fuchsia::media::AudioStreamType& dest_format);
+ static std::unique_ptr<Mixer> Select(
+ const fuchsia::media::AudioStreamType& src_format,
+ const fuchsia::media::AudioStreamType& dest_format);
protected:
LinearSampler(uint32_t pos_filter_width, uint32_t neg_filter_width)
diff --git a/garnet/bin/media/audio_core/mixer/mixer.cc b/garnet/bin/media/audio_core/mixer/mixer.cc
index 94e604e..a8dad2b 100644
--- a/garnet/bin/media/audio_core/mixer/mixer.cc
+++ b/garnet/bin/media/audio_core/mixer/mixer.cc
@@ -7,8 +7,8 @@
#include "garnet/bin/media/audio_core/mixer/linear_sampler.h"
#include "garnet/bin/media/audio_core/mixer/no_op.h"
#include "garnet/bin/media/audio_core/mixer/point_sampler.h"
-#include "src/lib/fxl/logging.h"
#include "lib/media/timeline/timeline_rate.h"
+#include "src/lib/fxl/logging.h"
namespace media::audio {
@@ -30,9 +30,9 @@
// specified, or if Resampler::Default, the existing selection algorithm is
// used. Note that requiring a specific resampler may cause Mixer::Select() to
// fail (i.e. return nullptr), even in cases where 'Default' would succeed.
-MixerPtr Mixer::Select(const fuchsia::media::AudioStreamType& src_format,
- const fuchsia::media::AudioStreamType& dest_format,
- Resampler resampler) {
+std::unique_ptr<Mixer> Mixer::Select(
+ const fuchsia::media::AudioStreamType& src_format,
+ const fuchsia::media::AudioStreamType& dest_format, Resampler resampler) {
// If user specified a particular Resampler, directly select it.
switch (resampler) {
case Resampler::SampleAndHold:
diff --git a/garnet/bin/media/audio_core/mixer/mixer.h b/garnet/bin/media/audio_core/mixer/mixer.h
index 965d1d3..4181359 100644
--- a/garnet/bin/media/audio_core/mixer/mixer.h
+++ b/garnet/bin/media/audio_core/mixer/mixer.h
@@ -6,6 +6,7 @@
#define GARNET_BIN_MEDIA_AUDIO_CORE_MIXER_MIXER_H_
#include <fuchsia/media/cpp/fidl.h>
+
#include <memory>
#include "garnet/bin/media/audio_core/mixer/constants.h"
@@ -14,8 +15,6 @@
namespace media::audio {
-class Mixer;
-using MixerPtr = std::unique_ptr<Mixer>;
struct Bookkeeping;
class Mixer {
@@ -54,9 +53,10 @@
// For optimum system performance across changing conditions, callers should
// take care when directly specifying a resampler type, if they do so at all.
// The default should be allowed whenever possible.
- static MixerPtr Select(const fuchsia::media::AudioStreamType& src_format,
- const fuchsia::media::AudioStreamType& dest_format,
- Resampler resampler_type = Resampler::Default);
+ static std::unique_ptr<Mixer> Select(
+ const fuchsia::media::AudioStreamType& src_format,
+ const fuchsia::media::AudioStreamType& dest_format,
+ Resampler resampler_type = Resampler::Default);
//
// Mix
@@ -240,7 +240,7 @@
Bookkeeping() = default;
~Bookkeeping() = default;
- MixerPtr mixer;
+ std::unique_ptr<Mixer> mixer;
Gain gain;
uint32_t step_size = Mixer::FRAC_ONE;
diff --git a/garnet/bin/media/audio_core/mixer/point_sampler.cc b/garnet/bin/media/audio_core/mixer/point_sampler.cc
index 0e0621b..fab9cbe 100644
--- a/garnet/bin/media/audio_core/mixer/point_sampler.cc
+++ b/garnet/bin/media/audio_core/mixer/point_sampler.cc
@@ -448,15 +448,15 @@
// Templates used to expand all of the different combinations of the possible
// PointSampler Mixer configurations.
template <size_t DestChanCount, typename SrcSampleType, size_t SrcChanCount>
-static inline MixerPtr SelectPSM(
+static inline std::unique_ptr<Mixer> SelectPSM(
const fuchsia::media::AudioStreamType& src_format,
const fuchsia::media::AudioStreamType& dest_format) {
- return MixerPtr(
- new PointSamplerImpl<DestChanCount, SrcSampleType, SrcChanCount>());
+ return std::make_unique<
+ PointSamplerImpl<DestChanCount, SrcSampleType, SrcChanCount>>();
}
template <size_t DestChanCount, typename SrcSampleType>
-static inline MixerPtr SelectPSM(
+static inline std::unique_ptr<Mixer> SelectPSM(
const fuchsia::media::AudioStreamType& src_format,
const fuchsia::media::AudioStreamType& dest_format) {
switch (src_format.channels) {
@@ -472,7 +472,7 @@
}
template <size_t DestChanCount>
-static inline MixerPtr SelectPSM(
+static inline std::unique_ptr<Mixer> SelectPSM(
const fuchsia::media::AudioStreamType& src_format,
const fuchsia::media::AudioStreamType& dest_format) {
switch (src_format.sample_format) {
@@ -489,23 +489,26 @@
}
}
-static inline MixerPtr SelectNxNPSM(
+static inline std::unique_ptr<Mixer> SelectNxNPSM(
const fuchsia::media::AudioStreamType& src_format) {
switch (src_format.sample_format) {
case fuchsia::media::AudioSampleFormat::UNSIGNED_8:
- return MixerPtr(new NxNPointSamplerImpl<uint8_t>(src_format.channels));
+ return std::make_unique<NxNPointSamplerImpl<uint8_t>>(
+ src_format.channels);
case fuchsia::media::AudioSampleFormat::SIGNED_16:
- return MixerPtr(new NxNPointSamplerImpl<int16_t>(src_format.channels));
+ return std::make_unique<NxNPointSamplerImpl<int16_t>>(
+ src_format.channels);
case fuchsia::media::AudioSampleFormat::SIGNED_24_IN_32:
- return MixerPtr(new NxNPointSamplerImpl<int32_t>(src_format.channels));
+ return std::make_unique<NxNPointSamplerImpl<int32_t>>(
+ src_format.channels);
case fuchsia::media::AudioSampleFormat::FLOAT:
- return MixerPtr(new NxNPointSamplerImpl<float>(src_format.channels));
+ return std::make_unique<NxNPointSamplerImpl<float>>(src_format.channels);
default:
return nullptr;
}
}
-MixerPtr PointSampler::Select(
+std::unique_ptr<Mixer> PointSampler::Select(
const fuchsia::media::AudioStreamType& src_format,
const fuchsia::media::AudioStreamType& dest_format) {
if (src_format.channels == dest_format.channels && src_format.channels > 2) {
diff --git a/garnet/bin/media/audio_core/mixer/point_sampler.h b/garnet/bin/media/audio_core/mixer/point_sampler.h
index 63d8dda..f01987a 100644
--- a/garnet/bin/media/audio_core/mixer/point_sampler.h
+++ b/garnet/bin/media/audio_core/mixer/point_sampler.h
@@ -13,8 +13,9 @@
class PointSampler : public Mixer {
public:
- static MixerPtr Select(const fuchsia::media::AudioStreamType& src_format,
- const fuchsia::media::AudioStreamType& dest_format);
+ static std::unique_ptr<Mixer> Select(
+ const fuchsia::media::AudioStreamType& src_format,
+ const fuchsia::media::AudioStreamType& dest_format);
protected:
PointSampler(uint32_t pos_filter_width, uint32_t neg_filter_width)
diff --git a/garnet/bin/media/audio_core/mixer/test/audio_performance.cc b/garnet/bin/media/audio_core/mixer/test/audio_performance.cc
index 502785e..137b51d 100644
--- a/garnet/bin/media/audio_core/mixer/test/audio_performance.cc
+++ b/garnet/bin/media/audio_core/mixer/test/audio_performance.cc
@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "garnet/bin/media/audio_core/mixer/test/audio_performance.h"
+
#include <string>
-#include "garnet/bin/media/audio_core/mixer/test/audio_performance.h"
#include "garnet/bin/media/audio_core/mixer/test/frequency_set.h"
#include "garnet/bin/media/audio_core/mixer/test/mixer_tests_shared.h"
@@ -162,8 +163,8 @@
}
uint32_t dest_rate = 48000;
- MixerPtr mixer = SelectMixer(sample_format, num_input_chans, source_rate,
- num_output_chans, dest_rate, sampler_type);
+ auto mixer = SelectMixer(sample_format, num_input_chans, source_rate,
+ num_output_chans, dest_rate, sampler_type);
uint32_t source_buffer_size = kFreqTestBufSize * dest_rate / source_rate;
uint32_t source_frames = source_buffer_size + 1;
diff --git a/garnet/bin/media/audio_core/mixer/test/mixer_bitwise_tests.cc b/garnet/bin/media/audio_core/mixer/test/mixer_bitwise_tests.cc
index cef898a..10bad2d 100644
--- a/garnet/bin/media/audio_core/mixer/test/mixer_bitwise_tests.cc
+++ b/garnet/bin/media/audio_core/mixer/test/mixer_bitwise_tests.cc
@@ -128,14 +128,14 @@
-0x00100000, 0, 0x02600000, -0x01300000};
NormalizeInt28ToPipelineBitwidth(expect, fbl::count_of(expect));
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::UNSIGNED_8, 1,
- 48000, 1, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum));
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::UNSIGNED_8, 1,
+ 48000, 1, 48000, Resampler::SampleAndHold);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum));
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::UNSIGNED_8, 8, 48000,
8, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum) / 8);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum) / 8);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
}
@@ -151,16 +151,16 @@
NormalizeInt28ToPipelineBitwidth(expect, fbl::count_of(expect));
// Try in 2-channel mode
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 2,
- 48000, 2, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum) / 2);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 2,
+ 48000, 2, 48000, Resampler::SampleAndHold);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum) / 2);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
::memset(accum, 0, sizeof(accum));
// Now try in 4-channel mode
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 4, 48000, 4,
48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum) / 4);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum) / 4);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
}
@@ -177,17 +177,16 @@
NormalizeInt28ToPipelineBitwidth(expect, fbl::count_of(expect));
// Try in 1-channel mode
- MixerPtr mixer =
- SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_24_IN_32, 1, 48000,
- 1, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum));
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_24_IN_32,
+ 1, 48000, 1, 48000, Resampler::SampleAndHold);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum));
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
::memset(accum, 0, sizeof(accum));
// Now try in 8-channel mode
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_24_IN_32, 8,
48000, 8, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum) / 8);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum) / 8);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
}
@@ -204,22 +203,22 @@
NormalizeInt28ToPipelineBitwidth(expect, fbl::count_of(expect));
// Try in 1-channel mode
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 48000, 1, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum));
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 48000,
+ 1, 48000, Resampler::SampleAndHold);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum));
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
::memset(accum, 0, sizeof(accum));
// Now try in 4-channel mode
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 4, 48000, 4,
48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum) / 4);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum) / 4);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
}
// Does NoOp mixer behave as expected? (not update offsets, nor touch buffers)
TEST(PassThru, NoOp) {
- MixerPtr no_op_mixer = MixerPtr(new mixer::NoOp());
+ auto no_op_mixer = std::make_unique<mixer::NoOp>();
EXPECT_NE(nullptr, no_op_mixer);
int16_t source[] = {0x7FFF, -0x8000};
@@ -251,9 +250,9 @@
0x0001000, 0x00001000, 0x07FFF000, 0x07FFF000};
NormalizeInt28ToPipelineBitwidth(expect, fbl::count_of(expect));
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
- 48000, 2, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum) / 2);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
+ 48000, 2, 48000, Resampler::SampleAndHold);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum) / 2);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
}
@@ -263,10 +262,10 @@
1, -1, -13107, 13107, 3855, -3855};
float accum[6];
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 2,
- 48000, 1, 48000, Resampler::SampleAndHold);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 2,
+ 48000, 1, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum));
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum));
EXPECT_TRUE(CompareBufferToVal(accum, 0.0f, fbl::count_of(accum)));
}
@@ -282,9 +281,9 @@
-0x015C9800, 0x07FFF000, -0x08000000};
NormalizeInt28ToPipelineBitwidth(expect, fbl::count_of(expect));
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 2,
- 48000, 1, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum));
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 2,
+ 48000, 1, 48000, Resampler::SampleAndHold);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum));
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
}
@@ -297,9 +296,9 @@
NormalizeInt28ToPipelineBitwidth(accum, fbl::count_of(accum));
NormalizeInt28ToPipelineBitwidth(expect, fbl::count_of(expect));
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 2,
- 48000, 2, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, true, fbl::count_of(accum) / 2);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 2,
+ 48000, 2, 48000, Resampler::SampleAndHold);
+ DoMix(mixer.get(), source, accum, true, fbl::count_of(accum) / 2);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
float expect2[] = {-0x010E1000, 0x00929000, 0x01A85000,
@@ -307,7 +306,7 @@
NormalizeInt28ToPipelineBitwidth(expect2, fbl::count_of(expect2));
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 2, 48000, 2,
48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum) / 2);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum) / 2);
EXPECT_TRUE(CompareBuffers(accum, expect2, fbl::count_of(accum)));
}
diff --git a/garnet/bin/media/audio_core/mixer/test/mixer_gain_tests.cc b/garnet/bin/media/audio_core/mixer/test/mixer_gain_tests.cc
index 09dedda..60f6c93 100644
--- a/garnet/bin/media/audio_core/mixer/test/mixer_gain_tests.cc
+++ b/garnet/bin/media/audio_core/mixer/test/mixer_gain_tests.cc
@@ -669,9 +669,9 @@
// Validate that +20.00 dB leads to exactly 10x in value (within limits)
float stream_gain_db = 20.0f;
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
- 44100, 1, 44100, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum),
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
+ 44100, 1, 44100, Resampler::SampleAndHold);
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum),
stream_gain_db);
float expect[] = {0x080E8000, 0x07FF8000, 0x015E000, 0x00028000,
@@ -686,7 +686,7 @@
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1, 44100, 1,
44100, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum),
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum),
stream_gain_db);
float expect2[] = {0x00339000, 0x00333000, 0x00008C00, 0x00001000,
@@ -705,9 +705,9 @@
// kMinGainDbUnity is the lowest (furthest-from-Unity) with no observable
// attenuation on full-scale (i.e. the smallest indistinguishable from Unity).
// At this gain_scale, audio should be unchanged.
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
- 48000, 1, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), max_source, accum, false, fbl::count_of(accum),
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
+ 48000, 1, 48000, Resampler::SampleAndHold);
+ DoMix(mixer.get(), max_source, accum, false, fbl::count_of(accum),
AudioResult::kMinGainDbUnity);
// At this gain_scale, resulting audio should be unchanged.
@@ -719,7 +719,7 @@
// full-scale (i.e. the largest sub-Unity AScale distinguishable from Unity).
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1, 48000, 1,
48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), max_source, accum, false, fbl::count_of(accum),
+ DoMix(mixer.get(), max_source, accum, false, fbl::count_of(accum),
AudioResult::kMaxGainDbNonUnity);
// Float32 has 25-bit precision (not 28), hence our min delta is 8 (not 1).
@@ -734,7 +734,7 @@
int16_t min_source[] = {1, -1};
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1, 48000, 1,
48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), min_source, accum, false, fbl::count_of(accum),
+ DoMix(mixer.get(), min_source, accum, false, fbl::count_of(accum),
AudioResult::kMinGainDbNonMute);
// The method used elsewhere in this file for expected result arrays (28-bit
@@ -754,7 +754,7 @@
// here and expect no change in the accumulator, even with max inputs.
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1, 48000, 1,
48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), max_source, accum, true, fbl::count_of(accum),
+ DoMix(mixer.get(), max_source, accum, true, fbl::count_of(accum),
AudioResult::kMaxGainDbMute);
EXPECT_TRUE(CompareBuffers(accum, min_expect, fbl::count_of(accum)));
@@ -778,15 +778,15 @@
NormalizeInt28ToPipelineBitwidth(expect2, fbl::count_of(expect2));
// These values exceed the per-stream range of int16
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
- 48000, 1, 48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, true, fbl::count_of(accum));
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
+ 48000, 1, 48000, Resampler::SampleAndHold);
+ DoMix(mixer.get(), source, accum, true, fbl::count_of(accum));
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
// these values even exceed uint16
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 2, 48000, 2,
48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, true, 1);
+ DoMix(mixer.get(), source, accum, true, 1);
EXPECT_TRUE(CompareBuffers(accum, expect2, fbl::count_of(accum)));
}
@@ -798,17 +798,17 @@
float expect[] = {-32768, 32767};
// We will test both SampleAndHold and LinearInterpolation interpolators.
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
- 48000, 1, 48000, Resampler::SampleAndHold);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
+ 48000, 1, 48000, Resampler::SampleAndHold);
// Use the gain guaranteed to silence all signals: Gain::kMinScale.
- DoMix(std::move(mixer), source, accum, true, fbl::count_of(accum),
+ DoMix(mixer.get(), source, accum, true, fbl::count_of(accum),
Gain::kMinGainDb);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
// Try with the other sampler.
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1, 48000, 1,
48000, Resampler::LinearInterpolation);
- DoMix(std::move(mixer), source, accum, true, fbl::count_of(accum),
+ DoMix(mixer.get(), source, accum, true, fbl::count_of(accum),
Gain::kMinGainDb);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
@@ -817,14 +817,14 @@
//
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1, 48000, 1,
48000, Resampler::SampleAndHold);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum),
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum),
Gain::kMinGainDb);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
// Ensure that both samplers behave identically in this regard.
mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1, 48000, 1,
48000, Resampler::LinearInterpolation);
- DoMix(std::move(mixer), source, accum, false, fbl::count_of(accum),
+ DoMix(mixer.get(), source, accum, false, fbl::count_of(accum),
Gain::kMinGainDb);
EXPECT_TRUE(CompareBuffers(accum, expect, fbl::count_of(accum)));
}
diff --git a/garnet/bin/media/audio_core/mixer/test/mixer_range_tests.cc b/garnet/bin/media/audio_core/mixer/test/mixer_range_tests.cc
index ab485a1..e8e145f 100644
--- a/garnet/bin/media/audio_core/mixer/test/mixer_range_tests.cc
+++ b/garnet/bin/media/audio_core/mixer/test/mixer_range_tests.cc
@@ -15,8 +15,8 @@
// Ideal accompanying noise is ideal noise floor, minus the reduction in gain.
void MeasureSummaryDynamicRange(float gain_db, double* level_db,
double* sinad_db) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 48000, 1, 48000, Resampler::SampleAndHold);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 48000,
+ 1, 48000, Resampler::SampleAndHold);
std::vector<float> source(kFreqTestBufSize);
std::vector<float> accum(kFreqTestBufSize);
@@ -121,8 +121,8 @@
// Test our mix level and noise floor, when rechannelizing mono into stereo.
TEST(DynamicRange, MonoToStereo) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 48000, 2, 48000, Resampler::SampleAndHold);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 48000,
+ 2, 48000, Resampler::SampleAndHold);
std::vector<float> source(kFreqTestBufSize);
std::vector<float> accum(kFreqTestBufSize * 2);
@@ -166,8 +166,8 @@
// Test our mix level and noise floor, when rechannelizing stereo into mono.
TEST(DynamicRange, StereoToMono) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 2,
- 48000, 1, 48000, Resampler::SampleAndHold);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 2, 48000,
+ 1, 48000, Resampler::SampleAndHold);
std::vector<float> mono(kFreqTestBufSize);
std::vector<float> source(kFreqTestBufSize * 2);
@@ -240,7 +240,7 @@
// AudioRenderer (stream) gain, so it is pre-Sum.
template <typename T>
void MeasureMixFloor(double* level_mix_db, double* sinad_mix_db) {
- MixerPtr mixer;
+ std::unique_ptr<Mixer> mixer;
double amplitude, expected_amplitude;
// Why isn't expected_amplitude 1.0? int16 and int8 have more negative values
diff --git a/garnet/bin/media/audio_core/mixer/test/mixer_resampling_tests.cc b/garnet/bin/media/audio_core/mixer/test/mixer_resampling_tests.cc
index 92cf4ba..f7ef394 100644
--- a/garnet/bin/media/audio_core/mixer/test/mixer_resampling_tests.cc
+++ b/garnet/bin/media/audio_core/mixer/test/mixer_resampling_tests.cc
@@ -45,7 +45,7 @@
TEST(Bookkeeping, Reset) {
Bookkeeping info;
- info.mixer = MixerPtr(new mixer::NoOp());
+ info.mixer = std::make_unique<mixer::NoOp>();
info.src_pos_modulo = 4321u;
info.Reset();
EXPECT_EQ(info.src_pos_modulo, 0u);
@@ -80,8 +80,8 @@
// that it doesn't touch other buffer sections, regardless of 'accumulate'.
// This first test uses integer lengths/offsets, and a step_size of ONE.
TEST(Resampling, Position_Basic_Point) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
- 24000, 1, 24000, Resampler::SampleAndHold);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
+ 24000, 1, 24000, Resampler::SampleAndHold);
//
// Check: source supply exceeds destination demand.
@@ -132,8 +132,8 @@
// flag. Check scenarios when supply > demand, and vice versa, and ==.
// This first test uses integer lengths/offsets, and a step_size of ONE.
TEST(Resampling, Position_Basic_Linear) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
- 48000, 1, 48000, Resampler::LinearInterpolation);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
+ 48000, 1, 48000, Resampler::LinearInterpolation);
//
// Check: source supply equals destination demand.
@@ -208,8 +208,8 @@
// TODO(mpuryear): Change frac_src_frames parameter to be (integer) src_frames,
// as number of frames was never intended to be fractional.
TEST(Resampling, Position_Fractional_Point) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
- 44100, 1, 44100, Resampler::SampleAndHold);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
+ 44100, 1, 44100, Resampler::SampleAndHold);
//
// Check: source supply exceeds destination demand
@@ -261,8 +261,8 @@
// where supply equals demand are well-covered elsewhere.) This test uses
// fractional offsets, still with a step_size of ONE.
TEST(Resampling, Position_Fractional_Linear) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
- 48000, 1, 48000, Resampler::LinearInterpolation);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::SIGNED_16, 1,
+ 48000, 1, 48000, Resampler::LinearInterpolation);
//
// Check: Source supply exceeds destination demand
@@ -315,8 +315,8 @@
}
void TestRateModulo(Resampler sampler_type) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 32000, 1, 48000, sampler_type);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 32000,
+ 1, 48000, sampler_type);
float source[] = {0.0f, 0.1f, 0.2f};
float accum[3];
@@ -367,8 +367,8 @@
// For the provided sampler, validate src_pos_modulo for default, 0, non-zero.
// For these three input conditions, verify rollover and non-rollover cases.
void TestPositionModulo(Resampler sampler_type) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 44100, 1, 44100, sampler_type);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 44100,
+ 1, 44100, sampler_type);
float accum[3];
uint32_t dest_offset;
@@ -468,9 +468,9 @@
// fullest extent possible with 32-bit float and 13-bit subframe timestamps.
void TestInterpolation(uint32_t source_frames_per_second,
uint32_t dest_frames_per_second) {
- MixerPtr mixer = SelectMixer(
- fuchsia::media::AudioSampleFormat::FLOAT, 1, source_frames_per_second, 1,
- dest_frames_per_second, Resampler::LinearInterpolation);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
+ source_frames_per_second, 1, dest_frames_per_second,
+ Resampler::LinearInterpolation);
//
// Base check: interpolated value is exactly calculated, no rounding.
@@ -632,8 +632,8 @@
// Verify PointSampler filter widths.
TEST(Resampling, FilterWidth_Point) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::UNSIGNED_8, 1,
- 48000, 1, 48000, Resampler::SampleAndHold);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::UNSIGNED_8, 1,
+ 48000, 1, 48000, Resampler::SampleAndHold);
EXPECT_EQ(mixer->pos_filter_width(), 0u);
EXPECT_EQ(mixer->neg_filter_width(), Mixer::FRAC_ONE - 1);
@@ -646,8 +646,8 @@
// Verify LinearSampler filter widths.
TEST(Resampling, FilterWidth_Linear) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 44100, 1, 48000, Resampler::LinearInterpolation);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 44100,
+ 1, 48000, Resampler::LinearInterpolation);
EXPECT_EQ(mixer->pos_filter_width(), Mixer::FRAC_ONE - 1);
EXPECT_EQ(mixer->neg_filter_width(), Mixer::FRAC_ONE - 1);
diff --git a/garnet/bin/media/audio_core/mixer/test/mixer_response_tests.cc b/garnet/bin/media/audio_core/mixer/test/mixer_response_tests.cc
index 5e94fcf..d498aa3 100644
--- a/garnet/bin/media/audio_core/mixer/test/mixer_response_tests.cc
+++ b/garnet/bin/media/audio_core/mixer/test/mixer_response_tests.cc
@@ -28,7 +28,7 @@
// assuming an eventual 48kHz output sample rate.
template <typename T>
double MeasureSourceNoiseFloor(double* sinad_db) {
- MixerPtr mixer;
+ std::unique_ptr<Mixer> mixer;
double amplitude, expected_amplitude;
if (std::is_same<T, uint8_t>::value) {
@@ -262,8 +262,8 @@
// Ideal frequency response measurement is 0.00 dB across the audible spectrum
// Ideal SINAD is at least 6 dB per signal-bit (>96 dB, if 16-bit resolution).
// If UseFullFrequencySet is false, we test at only three summary frequencies.
-void MeasureFreqRespSinad(MixerPtr mixer, uint32_t src_buf_size,
- double* level_db, double* sinad_db) {
+void MeasureFreqRespSinad(Mixer* mixer, uint32_t src_buf_size, double* level_db,
+ double* sinad_db) {
if (!std::isnan(level_db[0])) {
// This run already has frequency response and SINAD test results for this
// sampler and resampling ratio; don't waste time and cycles rerunning it.
@@ -396,10 +396,10 @@
// SRC). We articulate this with source buffer length equal to dest length.
void TestUnitySampleRatio(Resampler sampler_type, double* freq_resp_results,
double* sinad_results) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 48000, 1, 48000, sampler_type);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 48000,
+ 1, 48000, sampler_type);
- MeasureFreqRespSinad(std::move(mixer), kFreqTestBufSize, freq_resp_results,
+ MeasureFreqRespSinad(mixer.get(), kFreqTestBufSize, freq_resp_results,
sinad_results);
}
@@ -407,10 +407,10 @@
// by specifying a source buffer three times the length of the destination.
void TestDownSampleRatio0(Resampler sampler_type, double* freq_resp_results,
double* sinad_results) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 48000 * 3, 1, 48000, sampler_type);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
+ 48000 * 3, 1, 48000, sampler_type);
- MeasureFreqRespSinad(std::move(mixer), round(kFreqTestBufSize * 3.0),
+ MeasureFreqRespSinad(mixer.get(), round(kFreqTestBufSize * 3.0),
freq_resp_results, sinad_results);
}
@@ -418,10 +418,10 @@
// by specifying a source buffer twice the length of the destination buffer.
void TestDownSampleRatio1(Resampler sampler_type, double* freq_resp_results,
double* sinad_results) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 48000 * 2, 1, 48000, sampler_type);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
+ 48000 * 2, 1, 48000, sampler_type);
- MeasureFreqRespSinad(std::move(mixer), round(kFreqTestBufSize * 2.0),
+ MeasureFreqRespSinad(mixer.get(), round(kFreqTestBufSize * 2.0),
freq_resp_results, sinad_results);
}
@@ -429,11 +429,10 @@
// by specifying a source buffer longer than destination buffer by that ratio.
void TestDownSampleRatio2(Resampler sampler_type, double* freq_resp_results,
double* sinad_results) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 88200, 1, 48000, sampler_type);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 88200,
+ 1, 48000, sampler_type);
- MeasureFreqRespSinad(std::move(mixer),
- round(kFreqTestBufSize * 88200.0 / 48000.0),
+ MeasureFreqRespSinad(mixer.get(), round(kFreqTestBufSize * 88200.0 / 48000.0),
freq_resp_results, sinad_results);
}
@@ -441,11 +440,10 @@
// by specifying a source buffer shorter than destination buffer by that ratio.
void TestUpSampleRatio1(Resampler sampler_type, double* freq_resp_results,
double* sinad_results) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 44100, 1, 48000, sampler_type);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 44100,
+ 1, 48000, sampler_type);
- MeasureFreqRespSinad(std::move(mixer),
- round(kFreqTestBufSize * 44100.0 / 48000.0),
+ MeasureFreqRespSinad(mixer.get(), round(kFreqTestBufSize * 44100.0 / 48000.0),
freq_resp_results, sinad_results);
}
@@ -453,21 +451,20 @@
// by specifying a source buffer at half the length of the destination buffer.
void TestUpSampleRatio2(Resampler sampler_type, double* freq_resp_results,
double* sinad_results) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 24000, 1, 24000 * 2, sampler_type);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 24000,
+ 1, 24000 * 2, sampler_type);
- MeasureFreqRespSinad(std::move(mixer), round(kFreqTestBufSize / 2.0),
+ MeasureFreqRespSinad(mixer.get(), round(kFreqTestBufSize / 2.0),
freq_resp_results, sinad_results);
}
// For the given resampler, target micro-sampling -- with a 47999:48000 ratio.
void TestMicroSampleRatio(Resampler sampler_type, double* freq_resp_results,
double* sinad_results) {
- MixerPtr mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1,
- 47999, 1, 48000, sampler_type);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 47999,
+ 1, 48000, sampler_type);
- MeasureFreqRespSinad(std::move(mixer),
- round(kFreqTestBufSize * 47999.0 / 48000.0),
+ MeasureFreqRespSinad(mixer.get(), round(kFreqTestBufSize * 47999.0 / 48000.0),
freq_resp_results, sinad_results);
}
@@ -815,9 +812,8 @@
PopulateNxNSourceBuffer(source.get(), num_source_frames, num_chans);
// Mix the N-channel source[] into the N-channel accum[].
- MixerPtr mixer =
- SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, num_chans,
- source_rate, num_chans, dest_rate, sampler_type);
+ auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, num_chans,
+ source_rate, num_chans, dest_rate, sampler_type);
uint32_t frac_src_frames =
num_chans * (num_source_frames + 1) * Mixer::FRAC_ONE;
diff --git a/garnet/bin/media/audio_core/mixer/test/mixer_tests_shared.cc b/garnet/bin/media/audio_core/mixer/test/mixer_tests_shared.cc
index 25ec73cb..bdbf78f0 100644
--- a/garnet/bin/media/audio_core/mixer/test/mixer_tests_shared.cc
+++ b/garnet/bin/media/audio_core/mixer/test/mixer_tests_shared.cc
@@ -18,10 +18,12 @@
// our accumulation format (not the destination format), so we need not specify
// a dest_format. Actual frame rate values are unimportant, but inter-rate RATIO
// is VERY important: required SRC is the primary factor in Mix selection.
-MixerPtr SelectMixer(fuchsia::media::AudioSampleFormat src_format,
- uint32_t src_channels, uint32_t src_frame_rate,
- uint32_t dest_channels, uint32_t dest_frame_rate,
- Resampler resampler) {
+std::unique_ptr<Mixer> SelectMixer(fuchsia::media::AudioSampleFormat src_format,
+ uint32_t src_channels,
+ uint32_t src_frame_rate,
+ uint32_t dest_channels,
+ uint32_t dest_frame_rate,
+ Resampler resampler) {
fuchsia::media::AudioStreamType src_details;
src_details.sample_format = src_format;
src_details.channels = src_channels;
@@ -32,9 +34,7 @@
dest_details.channels = dest_channels;
dest_details.frames_per_second = dest_frame_rate;
- MixerPtr mixer = Mixer::Select(src_details, dest_details, resampler);
-
- return mixer;
+ return Mixer::Select(src_details, dest_details, resampler);
}
// Just as Mixers convert audio into our accumulation format, OutputProducer
@@ -69,8 +69,8 @@
// Use the supplied mixer to scale from src into accum buffers. Assumes a
// specific buffer size, with no SRC, starting at the beginning of each buffer.
// By default, does not gain-scale or accumulate (both can be overridden).
-void DoMix(MixerPtr mixer, const void* src_buf, float* accum_buf,
- bool accumulate, int32_t num_frames, float gain_db) {
+void DoMix(Mixer* mixer, const void* src_buf, float* accum_buf, bool accumulate,
+ int32_t num_frames, float gain_db) {
uint32_t dest_offset = 0;
int32_t frac_src_offset = 0;
diff --git a/garnet/bin/media/audio_core/mixer/test/mixer_tests_shared.h b/garnet/bin/media/audio_core/mixer/test/mixer_tests_shared.h
index 0689e6c..4954576 100644
--- a/garnet/bin/media/audio_core/mixer/test/mixer_tests_shared.h
+++ b/garnet/bin/media/audio_core/mixer/test/mixer_tests_shared.h
@@ -18,10 +18,10 @@
//
// Find a suitable mixer for the provided format, channels and frame rates.
-MixerPtr SelectMixer(fuchsia::media::AudioSampleFormat src_format,
- uint32_t src_channels, uint32_t src_frame_rate,
- uint32_t dest_channels, uint32_t dest_frame_rate,
- Mixer::Resampler resampler = Mixer::Resampler::Default);
+std::unique_ptr<Mixer> SelectMixer(
+ fuchsia::media::AudioSampleFormat src_format, uint32_t src_channels,
+ uint32_t src_frame_rate, uint32_t dest_channels, uint32_t dest_frame_rate,
+ Mixer::Resampler resampler = Mixer::Resampler::Default);
// OutputProducers convert frames from accumulation format to dest format.
OutputProducerPtr SelectOutputProducer(
@@ -72,8 +72,8 @@
// Use supplied mixer to mix (w/out rate conversion) from source to accumulator.
// TODO(mpuryear): refactor this so that tests just call mixer->Mix directly.
-void DoMix(MixerPtr mixer, const void* src_buf, float* accum_buf,
- bool accumulate, int32_t num_frames, float gain_db = 0.0f);
+void DoMix(Mixer* mixer, const void* src_buf, float* accum_buf, bool accumulate,
+ int32_t num_frames, float gain_db = 0.0f);
} // namespace media::audio::test
diff --git a/garnet/bin/media/audio_core/standard_output_base.cc b/garnet/bin/media/audio_core/standard_output_base.cc
index 147a42c..a32523a 100644
--- a/garnet/bin/media/audio_core/standard_output_base.cc
+++ b/garnet/bin/media/audio_core/standard_output_base.cc
@@ -157,7 +157,7 @@
mix_bookkeeping->mixer = Mixer::Select(packet_link.format_info().format(),
*(output_producer_->format()));
} else {
- mix_bookkeeping->mixer = MixerPtr(new audio::mixer::NoOp());
+ mix_bookkeeping->mixer = std::make_unique<audio::mixer::NoOp>();
}
if (mix_bookkeeping->mixer == nullptr) {