mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Don't include video tracks without bitrate in adaptive selection.
This is generally not supported by our classes. A similar change for audio
was made in aa2beb080c.
PiperOrigin-RevId: 365795371
This commit is contained in:
parent
84ce648c90
commit
192c1a18f7
2 changed files with 19 additions and 2 deletions
|
|
@ -2125,8 +2125,9 @@ public class DefaultTrackSelector extends MappingTrackSelector {
|
||||||
|| (minVideoHeight <= format.height && format.height <= maxVideoHeight))
|
|| (minVideoHeight <= format.height && format.height <= maxVideoHeight))
|
||||||
&& (format.frameRate == Format.NO_VALUE
|
&& (format.frameRate == Format.NO_VALUE
|
||||||
|| (minVideoFrameRate <= format.frameRate && format.frameRate <= maxVideoFrameRate))
|
|| (minVideoFrameRate <= format.frameRate && format.frameRate <= maxVideoFrameRate))
|
||||||
&& (format.bitrate == Format.NO_VALUE
|
&& format.bitrate != Format.NO_VALUE
|
||||||
|| (minVideoBitrate <= format.bitrate && format.bitrate <= maxVideoBitrate));
|
&& minVideoBitrate <= format.bitrate
|
||||||
|
&& format.bitrate <= maxVideoBitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ public final class DefaultTrackSelectorTest {
|
||||||
.setSampleMimeType(MimeTypes.VIDEO_H264)
|
.setSampleMimeType(MimeTypes.VIDEO_H264)
|
||||||
.setWidth(1024)
|
.setWidth(1024)
|
||||||
.setHeight(768)
|
.setHeight(768)
|
||||||
|
.setAverageBitrate(450000)
|
||||||
.build();
|
.build();
|
||||||
private static final Format AUDIO_FORMAT =
|
private static final Format AUDIO_FORMAT =
|
||||||
new Format.Builder()
|
new Format.Builder()
|
||||||
|
|
@ -1496,6 +1497,21 @@ public final class DefaultTrackSelectorTest {
|
||||||
assertAdaptiveSelection(result.selections[0], trackGroups.get(0), 1, 2);
|
assertAdaptiveSelection(result.selections[0], trackGroups.get(0), 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void selectTracks_multipleVideoTracksWithoutBitrate_onlySelectsSingleTrack()
|
||||||
|
throws Exception {
|
||||||
|
TrackGroupArray trackGroups =
|
||||||
|
singleTrackGroup(
|
||||||
|
VIDEO_FORMAT.buildUpon().setId("0").setAverageBitrate(Format.NO_VALUE).build(),
|
||||||
|
VIDEO_FORMAT.buildUpon().setId("1").setAverageBitrate(Format.NO_VALUE).build());
|
||||||
|
TrackSelectorResult result =
|
||||||
|
trackSelector.selectTracks(
|
||||||
|
new RendererCapabilities[] {VIDEO_CAPABILITIES}, trackGroups, periodId, TIMELINE);
|
||||||
|
|
||||||
|
assertThat(result.length).isEqualTo(1);
|
||||||
|
assertFixedSelection(result.selections[0], trackGroups.get(0), /* expectedTrack= */ 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void selectTracks_multipleVideoAndAudioTracks() throws Exception {
|
public void selectTracks_multipleVideoAndAudioTracks() throws Exception {
|
||||||
Format videoFormat1 = VIDEO_FORMAT.buildUpon().setAverageBitrate(1000).build();
|
Format videoFormat1 = VIDEO_FORMAT.buildUpon().setAverageBitrate(1000).build();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue