mirror of
https://github.com/androidx/media.git
synced 2025-05-04 14:10:40 +08:00
add test for setForceHighestSupportedBitrate
This commit is contained in:
parent
7849a5eb52
commit
57d90f30a8
@ -1078,6 +1078,33 @@ public final class DefaultTrackSelectorTest {
|
||||
assertThat(result.selections.get(0).getSelectedFormat()).isEqualTo(lowerBitrateFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that track selector will select audio tracks with higher bitrate when {@link Parameters}
|
||||
* indicate highest bitrate preference, even when tracks are within capabilities.
|
||||
*/
|
||||
@Test
|
||||
public void testSelectTracksWithinCapabilitiesAndForceHighestBitrateSelectHigherBitrate()
|
||||
throws Exception {
|
||||
trackSelector.setParameters(new ParametersBuilder().setForceHighestSupportedBitrate(true).build());
|
||||
|
||||
Format lowerBitrateFormat =
|
||||
Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 15000,
|
||||
Format.NO_VALUE, 2, 44100, null, null, 0, null);
|
||||
Format higherBitrateFormat =
|
||||
Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 30000,
|
||||
Format.NO_VALUE, 2, 44100, null, null, 0, null);
|
||||
|
||||
TrackSelectorResult result =
|
||||
trackSelector.selectTracks(
|
||||
new RendererCapabilities[] {ALL_AUDIO_FORMAT_SUPPORTED_RENDERER_CAPABILITIES},
|
||||
singleTrackGroup(lowerBitrateFormat, higherBitrateFormat),
|
||||
periodId,
|
||||
TIMELINE);
|
||||
|
||||
assertThat(result.selections.get(0).getSelectedFormat()).isEqualTo(higherBitrateFormat);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSelectTracksWithMultipleAudioTracksReturnsAdaptiveTrackSelection()
|
||||
throws Exception {
|
||||
|
Loading…
x
Reference in New Issue
Block a user