use of com.google.android.exoplayer2.RendererCapabilities.Capabilities in project ExoPlayer by google.
the class DefaultTrackSelectorTest method selectTracksExceedingCapabilitiesPreferLowerSampleRateBeforeBitrate.
/**
* Tests that track selector will prefer audio tracks with lower sample rate over tracks with
* lower bitrate when other factors are the same, and tracks are within renderer's capabilities.
*/
@Test
public void selectTracksExceedingCapabilitiesPreferLowerSampleRateBeforeBitrate() throws Exception {
Format.Builder formatBuilder = AUDIO_FORMAT.buildUpon();
Format higherSampleRateLowerBitrateFormat = formatBuilder.setAverageBitrate(15000).setSampleRate(44100).build();
Format lowerSampleRateHigherBitrateFormat = formatBuilder.setAverageBitrate(30000).setSampleRate(22050).build();
TrackGroupArray trackGroups = wrapFormats(higherSampleRateLowerBitrateFormat, lowerSampleRateHigherBitrateFormat);
TrackSelectorResult result = trackSelector.selectTracks(new RendererCapabilities[] { ALL_AUDIO_FORMAT_EXCEEDED_RENDERER_CAPABILITIES }, trackGroups, periodId, TIMELINE);
assertFixedSelection(result.selections[0], trackGroups, lowerSampleRateHigherBitrateFormat);
}
use of com.google.android.exoplayer2.RendererCapabilities.Capabilities in project ExoPlayer by google.
the class DefaultTrackSelectorTest method selectTracksWithNoTrackWithinCapabilitiesAndSetByParamsReturnNoSelection.
/**
* Tests that track selector will return a null track selection for a renderer when all tracks
* exceed that renderer's capabilities when {@link Parameters} does not allow
* exceeding-capabilities tracks.
*/
@Test
public void selectTracksWithNoTrackWithinCapabilitiesAndSetByParamsReturnNoSelection() throws Exception {
TrackGroupArray trackGroups = singleTrackGroup(AUDIO_FORMAT);
trackSelector.setParameters(defaultParameters.buildUpon().setExceedRendererCapabilitiesIfNecessary(false));
TrackSelectorResult result = trackSelector.selectTracks(new RendererCapabilities[] { ALL_AUDIO_FORMAT_EXCEEDED_RENDERER_CAPABILITIES }, trackGroups, periodId, TIMELINE);
assertNoSelection(result.selections[0]);
}
use of com.google.android.exoplayer2.RendererCapabilities.Capabilities in project ExoPlayer by google.
the class DefaultTrackSelectorTest method selectAudioTracks_withinCapabilities_andSameLanguage_selectsHigherBitrate.
/**
* Tests that track selector will select audio tracks with higher bit rate when other factors are
* the same, and tracks are within renderer's capabilities, and have the same language.
*/
@Test
public void selectAudioTracks_withinCapabilities_andSameLanguage_selectsHigherBitrate() throws Exception {
Format.Builder formatBuilder = AUDIO_FORMAT.buildUpon().setLanguage("en");
Format lowerBitrateFormat = formatBuilder.setAverageBitrate(15000).build();
Format higherBitrateFormat = formatBuilder.setAverageBitrate(30000).build();
TrackGroupArray trackGroups = wrapFormats(lowerBitrateFormat, higherBitrateFormat);
TrackSelectorResult result = trackSelector.selectTracks(new RendererCapabilities[] { ALL_AUDIO_FORMAT_SUPPORTED_RENDERER_CAPABILITIES }, trackGroups, periodId, TIMELINE);
assertFixedSelection(result.selections[0], trackGroups, higherBitrateFormat);
}
use of com.google.android.exoplayer2.RendererCapabilities.Capabilities in project ExoPlayer by google.
the class DefaultTrackSelectorTest method selectTracksWithinCapabilitiesSelectHigherSampleRate.
/**
* Tests that track selector will select audio tracks with higher sample rate when other factors
* are the same, and tracks are within renderer's capabilities.
*/
@Test
public void selectTracksWithinCapabilitiesSelectHigherSampleRate() throws Exception {
Format.Builder formatBuilder = AUDIO_FORMAT.buildUpon();
Format higherSampleRateFormat = formatBuilder.setSampleRate(44100).build();
Format lowerSampleRateFormat = formatBuilder.setSampleRate(22050).build();
TrackGroupArray trackGroups = wrapFormats(higherSampleRateFormat, lowerSampleRateFormat);
TrackSelectorResult result = trackSelector.selectTracks(new RendererCapabilities[] { ALL_AUDIO_FORMAT_SUPPORTED_RENDERER_CAPABILITIES }, trackGroups, periodId, TIMELINE);
assertFixedSelection(result.selections[0], trackGroups, higherSampleRateFormat);
}
use of com.google.android.exoplayer2.RendererCapabilities.Capabilities in project ExoPlayer by google.
the class DefaultTrackSelectorTest method selectTracksPreferHigherNumChannelBeforeSampleRate.
/**
* Tests that track selector will prefer audio tracks with higher channel count over tracks with
* higher sample rate when other factors are the same, and tracks are within renderer's
* capabilities.
*/
@Test
public void selectTracksPreferHigherNumChannelBeforeSampleRate() throws Exception {
Format.Builder formatBuilder = AUDIO_FORMAT.buildUpon();
Format higherChannelLowerSampleRateFormat = formatBuilder.setChannelCount(6).setSampleRate(22050).build();
Format lowerChannelHigherSampleRateFormat = formatBuilder.setChannelCount(2).setSampleRate(44100).build();
TrackGroupArray trackGroups = wrapFormats(higherChannelLowerSampleRateFormat, lowerChannelHigherSampleRateFormat);
TrackSelectorResult result = trackSelector.selectTracks(new RendererCapabilities[] { ALL_AUDIO_FORMAT_SUPPORTED_RENDERER_CAPABILITIES }, trackGroups, periodId, TIMELINE);
assertFixedSelection(result.selections[0], trackGroups, higherChannelLowerSampleRateFormat);
}
Aggregations