use of com.google.android.exoplayer2.audio.AudioProcessor.AudioFormat in project ExoPlayer by google.
the class SonicAudioProcessorTest method reconfigureWithSameSampleRate.
@Test
public void reconfigureWithSameSampleRate() throws Exception {
// When configured for resampling from 44.1 kHz to 48 kHz, the output sample rate is correct.
sonicAudioProcessor.setOutputSampleRateHz(48000);
AudioFormat outputAudioFormat = sonicAudioProcessor.configure(AUDIO_FORMAT_44100_HZ);
assertThat(sonicAudioProcessor.isActive()).isTrue();
assertThat(outputAudioFormat.sampleRate).isEqualTo(48000);
// When reconfigured with 48 kHz input, there is no resampling.
outputAudioFormat = sonicAudioProcessor.configure(AUDIO_FORMAT_48000_HZ);
assertThat(sonicAudioProcessor.isActive()).isFalse();
assertThat(outputAudioFormat.sampleRate).isEqualTo(48000);
// When reconfigure with 44.1 kHz input, resampling is enabled again.
outputAudioFormat = sonicAudioProcessor.configure(AUDIO_FORMAT_44100_HZ);
assertThat(sonicAudioProcessor.isActive()).isTrue();
assertThat(outputAudioFormat.sampleRate).isEqualTo(48000);
}
Aggregations