Commit df862782 by Oliver Woodman

Merge pull request #7451 from szaboa:dev-v2-4511

PiperOrigin-RevId: 315995776
parents 5612ac50 a1ebffd2
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
* Core library: * Core library:
* Implement getTag for SilenceMediaSource. * Implement getTag for SilenceMediaSource.
* Add `Player.getTrackSelector` to access track selector from UI module.
* Added `TextComponent.getCurrentCues` because the current cues are no * Added `TextComponent.getCurrentCues` because the current cues are no
longer forwarded to a new `TextOutput` in `SimpleExoPlayer` longer forwarded to a new `TextOutput` in `SimpleExoPlayer`
automatically. automatically.
...@@ -76,7 +75,6 @@ ...@@ -76,7 +75,6 @@
`DecoderVideoRenderer` and `DecoderAudioRenderer` respectively, and `DecoderVideoRenderer` and `DecoderAudioRenderer` respectively, and
generalized to work with `Decoder` rather than `SimpleDecoder`. generalized to work with `Decoder` rather than `SimpleDecoder`.
* Add media item based playlist API to Player. * Add media item based playlist API to Player.
* Remove deprecated members in `DefaultTrackSelector`.
* Add `Player.DeviceComponent` and implement it for `SimpleExoPlayer` so * Add `Player.DeviceComponent` and implement it for `SimpleExoPlayer` so
that the device volume can be controlled by player. that the device volume can be controlled by player.
* Parse track titles from Matroska files * Parse track titles from Matroska files
...@@ -92,6 +90,12 @@ ...@@ -92,6 +90,12 @@
ongoing load should be canceled. Only supported by HLS streams so far. ongoing load should be canceled. Only supported by HLS streams so far.
([#2848](https://github.com/google/ExoPlayer/issues/2848)). ([#2848](https://github.com/google/ExoPlayer/issues/2848)).
* Video: Pass frame rate hint to `Surface.setFrameRate` on Android R devices. * Video: Pass frame rate hint to `Surface.setFrameRate` on Android R devices.
* Track selection:
* Add `Player.getTrackSelector`.
* Remove deprecated members in `DefaultTrackSelector`.
* Add `DefaultTrackSelector` constraints for minimum video resolution,
bitrate and frame rate
([#4511](https://github.com/google/ExoPlayer/issues/4511)).
* Text: * Text:
* Parse `<ruby>` and `<rt>` tags in WebVTT subtitles (rendering is coming * Parse `<ruby>` and `<rt>` tags in WebVTT subtitles (rendering is coming
later). later).
......
...@@ -131,51 +131,16 @@ public final class DefaultTrackSelectorTest { ...@@ -131,51 +131,16 @@ public final class DefaultTrackSelectorTest {
trackSelector.init(invalidationListener, bandwidthMeter); trackSelector.init(invalidationListener, bandwidthMeter);
} }
/** Tests {@link Parameters} {@link android.os.Parcelable} implementation. */
@Test @Test
public void parametersParcelable() { public void parameters_buildUponThenBuild_isEqual() {
SparseArray<Map<TrackGroupArray, SelectionOverride>> selectionOverrides = new SparseArray<>(); Parameters parameters = buildParametersForEqualsTest();
Map<TrackGroupArray, SelectionOverride> videoOverrides = new HashMap<>(); assertThat(parameters.buildUpon().build()).isEqualTo(parameters);
videoOverrides.put(new TrackGroupArray(VIDEO_TRACK_GROUP), new SelectionOverride(0, 1)); }
selectionOverrides.put(2, videoOverrides);
SparseBooleanArray rendererDisabledFlags = new SparseBooleanArray();
rendererDisabledFlags.put(3, true);
Parameters parametersToParcel = /** Tests {@link Parameters} {@link android.os.Parcelable} implementation. */
new Parameters( @Test
// Video public void parameters_parcelAndUnParcelable() {
/* maxVideoWidth= */ 0, Parameters parametersToParcel = buildParametersForEqualsTest();
/* maxVideoHeight= */ 1,
/* maxVideoFrameRate= */ 2,
/* maxVideoBitrate= */ 3,
/* exceedVideoConstraintsIfNecessary= */ false,
/* allowVideoMixedMimeTypeAdaptiveness= */ true,
/* allowVideoNonSeamlessAdaptiveness= */ false,
/* viewportWidth= */ 4,
/* viewportHeight= */ 5,
/* viewportOrientationMayChange= */ true,
// Audio
/* preferredAudioLanguage= */ "en",
/* maxAudioChannelCount= */ 6,
/* maxAudioBitrate= */ 7,
/* exceedAudioConstraintsIfNecessary= */ false,
/* allowAudioMixedMimeTypeAdaptiveness= */ true,
/* allowAudioMixedSampleRateAdaptiveness= */ false,
/* allowAudioMixedChannelCountAdaptiveness= */ true,
// Text
/* preferredTextLanguage= */ "de",
/* preferredTextRoleFlags= */ C.ROLE_FLAG_CAPTION,
/* selectUndeterminedTextLanguage= */ true,
/* disabledTextTrackSelectionFlags= */ 8,
// General
/* forceLowestBitrate= */ false,
/* forceHighestSupportedBitrate= */ true,
/* exceedRendererCapabilitiesIfNecessary= */ false,
/* tunnelingAudioSessionId= */ C.AUDIO_SESSION_ID_UNSET,
// Overrides
selectionOverrides,
rendererDisabledFlags);
Parcel parcel = Parcel.obtain(); Parcel parcel = Parcel.obtain();
parametersToParcel.writeToParcel(parcel, 0); parametersToParcel.writeToParcel(parcel, 0);
...@@ -1511,6 +1476,61 @@ public final class DefaultTrackSelectorTest { ...@@ -1511,6 +1476,61 @@ public final class DefaultTrackSelectorTest {
} }
/** /**
* Returns {@link Parameters} suitable for simple round trip equality tests.
*
* <p>Primitive variables are set to different values (to the extent that this is possible), to
* increase the probability of such tests failing if they accidentally compare mismatched
* variables.
*/
private static Parameters buildParametersForEqualsTest() {
SparseArray<Map<TrackGroupArray, SelectionOverride>> selectionOverrides = new SparseArray<>();
Map<TrackGroupArray, SelectionOverride> videoOverrides = new HashMap<>();
videoOverrides.put(new TrackGroupArray(VIDEO_TRACK_GROUP), new SelectionOverride(0, 1));
selectionOverrides.put(2, videoOverrides);
SparseBooleanArray rendererDisabledFlags = new SparseBooleanArray();
rendererDisabledFlags.put(3, true);
return new Parameters(
// Video
/* maxVideoWidth= */ 0,
/* maxVideoHeight= */ 1,
/* maxVideoFrameRate= */ 2,
/* maxVideoBitrate= */ 3,
/* minVideoWidth= */ 4,
/* minVideoHeight= */ 5,
/* minVideoFrameRate= */ 6,
/* minVideoBitrate= */ 7,
/* exceedVideoConstraintsIfNecessary= */ false,
/* allowVideoMixedMimeTypeAdaptiveness= */ true,
/* allowVideoNonSeamlessAdaptiveness= */ false,
/* viewportWidth= */ 8,
/* viewportHeight= */ 9,
/* viewportOrientationMayChange= */ true,
// Audio
/* preferredAudioLanguage= */ "en",
/* maxAudioChannelCount= */ 10,
/* maxAudioBitrate= */ 11,
/* exceedAudioConstraintsIfNecessary= */ false,
/* allowAudioMixedMimeTypeAdaptiveness= */ true,
/* allowAudioMixedSampleRateAdaptiveness= */ false,
/* allowAudioMixedChannelCountAdaptiveness= */ true,
// Text
/* preferredTextLanguage= */ "de",
/* preferredTextRoleFlags= */ C.ROLE_FLAG_CAPTION,
/* selectUndeterminedTextLanguage= */ true,
/* disabledTextTrackSelectionFlags= */ 12,
// General
/* forceLowestBitrate= */ false,
/* forceHighestSupportedBitrate= */ true,
/* exceedRendererCapabilitiesIfNecessary= */ false,
/* tunnelingAudioSessionId= */ 13,
// Overrides
selectionOverrides,
rendererDisabledFlags);
}
/**
* A {@link RendererCapabilities} that advertises support for all formats of a given type using * A {@link RendererCapabilities} that advertises support for all formats of a given type using
* a provided support value. For any format that does not have the given track type, * a provided support value. For any format that does not have the given track type,
* {@link #supportsFormat(Format)} will return {@link #FORMAT_UNSUPPORTED_TYPE}. * {@link #supportsFormat(Format)} will return {@link #FORMAT_UNSUPPORTED_TYPE}.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment