src/media/audio/audio_core/mixer/test/mixer_resampling_tests.cc
// For provided sampler, validate src_pos_modulo for early rollover.
For provided sampler, validate src_pos_modulo for early rollover.
For provided sampler validate src_pos_modulo for early rollover .
void TestPositionModuloEarlyRolloverPoint(bool mute = false) {
  auto mixer = SelectMixer(fuchsia::media::AudioSampleFormat::FLOAT, 1, 44100, 1, 44100,
                           Resampler::SampleAndHold);
  float accum[3];
  uint32_t dest_offset;
  int32_t frac_src_offset;
  float source[3] = {0.0f};
  dest_offset = 0;
  frac_src_offset = Mixer::FRAC_ONE - 1;
  auto& info = mixer->bookkeeping();
  info.step_size = Mixer::FRAC_ONE;
  info.rate_modulo = 1;
  info.denominator = 2;
  info.src_pos_modulo = 0;
  if (mute) {
    info.gain.SetSourceGain(Gain::kMinGainDb);
  }
  mixer->Mix(accum, std::size(accum), &dest_offset, source, std::size(source) << kPtsFractionalBits,
             &frac_src_offset, false);
  EXPECT_EQ(2u, dest_offset);
  EXPECT_TRUE(3 * Mixer::FRAC_ONE == frac_src_offset);
  EXPECT_EQ(0u, info.src_pos_modulo);
}
void TestPositionModuloEarlyRolloverPoint ( bool mute = false ) { auto mixer = SelectMixer ( fuchsia :: media :: AudioSampleFormat :: FLOAT , 1 , 44100 , 1 , 44100 , Resampler :: SampleAndHold ) ; float accum [ 3 ] ; uint32_t dest_offset ; int32_t frac_src_offset ; float source [ 3 ] = { 0.0f } ; dest_offset = 0 ; frac_src_offset = Mixer :: FRAC_ONE - 1 ; auto & info = mixer -> bookkeeping ( ) ; info . step_size = Mixer :: FRAC_ONE ; info . rate_modulo = 1 ; info . denominator = 2 ; info . src_pos_modulo = 0 ; if ( mute ) { info . gain . SetSourceGain ( Gain :: kMinGainDb ) ; } mixer -> Mix ( accum , std :: size ( accum ) , & dest_offset , source , std :: size ( source ) << kPtsFractionalBits , & frac_src_offset , false ) ; EXPECT_EQ ( 2u , dest_offset ) ; EXPECT_TRUE ( 3 * Mixer :: FRAC_ONE == frac_src_offset ) ; EXPECT_EQ ( 0u , info . src_pos_modulo ) ; }
For provided sampler, validate src_pos_modulo for early rollover.
For provided sampler validate src_pos_modulo for early rollover .
// Non-zero src_pos_modulo, early-rollover case.