src/media/audio/audio_core/test/api/audio_renderer_pipeline_test.cc
// Verify the correct output is received after update of the specified effect config.
//
// AudioCore is launched with a default profile containing an inversion_filter effect. The
// AudioTuner service is used to update a specified effect instance's effect configuration, which
// disables the inversion_filter effect present in the default profile. A packet is played, and the
// output is verified as having the inversion_filter effect disabled (no effects applied).
Verify the correct output is received after update of the specified effect config.
AudioCore is launched with a default profile containing an inversion_filter effect. The
AudioTuner service is used to update a specified effect instance's effect configuration, which
disables the inversion_filter effect present in the default profile. A packet is played, and the
output is verified as having the inversion_filter effect disabled (no effects applied).
Verify the correct output is received after update of the specified effect config . AudioCore is launched with a default profile containing an inversion_filter effect . The AudioTuner service is used to update a specified effect instance ' s effect configuration which disables the inversion_filter effect present in the default profile . A packet is played and the output is verified as having the inversion_filter effect disabled ( no effects applied ) .
TEST_F(AudioRendererPipelineTuningTest, AudioTunerUpdateEffect) {
  auto device_id = AudioDevice::UniqueIdToString({{0xff, 0x00}});
  fuchsia::media::tuning::AudioEffectConfig updated_effect;
  updated_effect.set_instance_name(kInverterEffectName);
  updated_effect.set_configuration("disable");
  audio_tuner_->SetAudioEffectConfig(
      device_id, std::move(updated_effect),
      AddCallback("SetAudioEffectConfig", [](zx_status_t status) { EXPECT_EQ(status, ZX_OK); }));
  ExpectCallback();
  auto min_lead_time = renderer_->GetMinLeadTime();
  auto num_packets = min_lead_time / zx::msec(RendererShimImpl::kPacketMs);
  auto num_frames = num_packets * kPacketFrames;
  auto input_buffer = GenerateSequentialAudio<ASF::SIGNED_16>(format_, num_frames);
  auto packets = renderer_->AppendPackets({&input_buffer});
  renderer_->PlaySynchronized(this, output_, 0);
  renderer_->WaitForPackets(this, packets);
  auto ring_buffer = output_->SnapshotRingBuffer();
  CompareAudioBufferOptions opts;
  opts.num_frames_per_packet = kPacketFrames;
  opts.test_label = "check data";
  CompareAudioBuffers(AudioBufferSlice(&ring_buffer, 0, num_frames),
                      AudioBufferSlice(&input_buffer, 0, num_frames), opts);
  opts.test_label = "check silence";
  CompareAudioBuffers(AudioBufferSlice(&ring_buffer, num_frames, output_->frame_count()),
                      AudioBufferSlice<ASF::SIGNED_16>(), opts);
}
TEST_F ( AudioRendererPipelineTuningTest , AudioTunerUpdateEffect ) { auto device_id = AudioDevice :: UniqueIdToString ( { { 0xff , 0x00 } } ) ; fuchsia :: media :: tuning :: AudioEffectConfig updated_effect ; updated_effect . set_instance_name ( kInverterEffectName ) ; updated_effect . set_configuration ( " " ) ; audio_tuner_ -> SetAudioEffectConfig ( device_id , std :: move ( updated_effect ) , AddCallback ( " " , [ ] ( zx_status_t status ) { EXPECT_EQ ( status , ZX_OK ) ; } ) ) ; ExpectCallback ( ) ; auto min_lead_time = renderer_ -> GetMinLeadTime ( ) ; auto num_packets = min_lead_time / zx :: msec ( RendererShimImpl :: kPacketMs ) ; auto num_frames = num_packets * kPacketFrames ; auto input_buffer = GenerateSequentialAudio < ASF :: SIGNED_16 > ( format_ , num_frames ) ; auto packets = renderer_ -> AppendPackets ( { & input_buffer } ) ; renderer_ -> PlaySynchronized ( this , output_ , 0 ) ; renderer_ -> WaitForPackets ( this , packets ) ; auto ring_buffer = output_ -> SnapshotRingBuffer ( ) ; CompareAudioBufferOptions opts ; opts . num_frames_per_packet = kPacketFrames ; opts . test_label = " " ; CompareAudioBuffers ( AudioBufferSlice ( & ring_buffer , 0 , num_frames ) , AudioBufferSlice ( & input_buffer , 0 , num_frames ) , opts ) ; opts . test_label = " " ; CompareAudioBuffers ( AudioBufferSlice ( & ring_buffer , num_frames , output_ -> frame_count ( ) ) , AudioBufferSlice < ASF :: SIGNED_16 > ( ) , opts ) ; }
Verify the correct output is received after update of the specified effect config.
Verify the correct output is received after update of the specified effect config .
// Disable the inverter; frames should be unmodified. // The ring buffer should match the input buffer for the first num_packets. The remaining bytes // should be zeros.