Reduce test flakes by adding effects to multi-sequence playback test.
This test is flaky at p4head, because CompositionPlayer has no logic to ensure a specific input is used to configure the audio graph. Depending on which sequence registers input first, it changes the output format of the media. By setting effects on the 2nd sequence, both inputs are the same format and this flakiness is avoided in the test. PiperOrigin-RevId: 653582441
This commit is contained in:
parent
e28270b4cb
commit
570be3680c
@ -19,6 +19,8 @@ import static androidx.media3.transformer.TestUtil.ASSET_URI_PREFIX;
|
||||
import static androidx.media3.transformer.TestUtil.FILE_AUDIO_RAW;
|
||||
import static androidx.media3.transformer.TestUtil.FILE_AUDIO_RAW_STEREO_48000KHZ;
|
||||
import static androidx.media3.transformer.TestUtil.createAudioEffects;
|
||||
import static androidx.media3.transformer.TestUtil.createChannelCountChangingAudioProcessor;
|
||||
import static androidx.media3.transformer.TestUtil.createSampleRateChangingAudioProcessor;
|
||||
import static androidx.media3.transformer.TestUtil.createVolumeScalingAudioProcessor;
|
||||
|
||||
import android.content.Context;
|
||||
@ -215,6 +217,10 @@ public final class CompositionPlayerAudioPlaybackTest {
|
||||
new EditedMediaItem.Builder(
|
||||
MediaItem.fromUri(ASSET_URI_PREFIX + FILE_AUDIO_RAW_STEREO_48000KHZ))
|
||||
.setDurationUs(348_000L)
|
||||
.setEffects(
|
||||
createAudioEffects(
|
||||
createSampleRateChangingAudioProcessor(44100),
|
||||
createChannelCountChangingAudioProcessor(1)))
|
||||
.build();
|
||||
Composition composition =
|
||||
new Composition.Builder(
|
||||
|
@ -79,6 +79,12 @@ public final class TestUtil {
|
||||
ImmutableList.copyOf(audioProcessors), /* videoEffects= */ ImmutableList.of());
|
||||
}
|
||||
|
||||
public static SonicAudioProcessor createSampleRateChangingAudioProcessor(int sampleRate) {
|
||||
SonicAudioProcessor sonicAudioProcessor = new SonicAudioProcessor();
|
||||
sonicAudioProcessor.setOutputSampleRateHz(sampleRate);
|
||||
return sonicAudioProcessor;
|
||||
}
|
||||
|
||||
public static SonicAudioProcessor createPitchChangingAudioProcessor(float pitch) {
|
||||
SonicAudioProcessor sonicAudioProcessor = new SonicAudioProcessor();
|
||||
sonicAudioProcessor.setPitch(pitch);
|
||||
|
Loading…
x
Reference in New Issue
Block a user