src/media/audio/audio_core/mixer/test/mixer_tests_shared.cc
//
// Subtest utility functions -- used by test functions; can ASSERT on their own.
//
// Find a suitable mixer for the provided format, channels and frame rates.
// In testing, we choose ratio-of-frame-rates and src_channels carefully, to
// trigger the selection of a specific mixer. Note: Mixers convert audio into
// 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.
Subtest utility functions -- used by test functions; can ASSERT on their own.
Find a suitable mixer for the provided format, channels and frame rates.
In testing, we choose ratio-of-frame-rates and src_channels carefully, to
trigger the selection of a specific mixer. Note: Mixers convert audio into
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.
Subtest utility functions -- used by test functions ; can ASSERT on their own . Find a suitable mixer for the provided format channels and frame rates . In testing we choose ratio - of - frame - rates and src_channels carefully to trigger the selection of a specific mixer . Note : Mixers convert audio into 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 .
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) {
  if (resampler == Resampler::Default) {
    EXPECT_TRUE(false);
    FX_LOGS(ERROR) << "Test should specify the Resampler exactly";
    return nullptr;
  }
  fuchsia::media::AudioStreamType src_details;
  src_details.sample_format = src_format;
  src_details.channels = src_channels;
  src_details.frames_per_second = src_frame_rate;
  fuchsia::media::AudioStreamType dest_details;
  dest_details.sample_format = fuchsia::media::AudioSampleFormat::FLOAT;
  dest_details.channels = dest_channels;
  dest_details.frames_per_second = dest_frame_rate;
  return Mixer::Select(src_details, dest_details, 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 ) { if ( resampler == Resampler :: Default ) { EXPECT_TRUE ( false ) ; FX_LOGS ( ERROR ) << " " ; return nullptr ; } fuchsia :: media :: AudioStreamType src_details ; src_details . sample_format = src_format ; src_details . channels = src_channels ; src_details . frames_per_second = src_frame_rate ; fuchsia :: media :: AudioStreamType dest_details ; dest_details . sample_format = fuchsia :: media :: AudioSampleFormat :: FLOAT ; dest_details . channels = dest_channels ; dest_details . frames_per_second = dest_frame_rate ; return Mixer :: Select ( src_details , dest_details , resampler ) ; }
Subtest utility functions -- used by test functions; can ASSERT on their own.
Subtest utility functions -- used by test functions ; can ASSERT on their own .