Commit 22159673 by olly Committed by Oliver Woodman

Move TrackSelection back to ExoPlayer module

PiperOrigin-RevId: 433729648
parent 018d1770
...@@ -79,7 +79,7 @@ import com.google.android.exoplayer2.util.Util; ...@@ -79,7 +79,7 @@ import com.google.android.exoplayer2.util.Util;
PositionInfo oldPosition = PositionInfo oldPosition =
new PositionInfo( new PositionInfo(
windowUid, windowUid,
/* windowIndex= */ 0, /* mediaItemIndex= */ 0,
mediaItem, mediaItem,
periodUid, periodUid,
/* periodIndex= */ 0, /* periodIndex= */ 0,
...@@ -97,7 +97,7 @@ import com.google.android.exoplayer2.util.Util; ...@@ -97,7 +97,7 @@ import com.google.android.exoplayer2.util.Util;
PositionInfo newPosition = PositionInfo newPosition =
new PositionInfo( new PositionInfo(
windowUid, windowUid,
/* windowIndex= */ 0, /* mediaItemIndex= */ 0,
mediaItem, mediaItem,
periodUid, periodUid,
/* periodIndex= */ 0, /* periodIndex= */ 0,
...@@ -128,7 +128,7 @@ import com.google.android.exoplayer2.util.Util; ...@@ -128,7 +128,7 @@ import com.google.android.exoplayer2.util.Util;
PositionInfo oldPosition = PositionInfo oldPosition =
new PositionInfo( new PositionInfo(
windowUid, windowUid,
/* windowIndex= */ 0, /* mediaItemIndex= */ 0,
mediaItem, mediaItem,
periodUid, periodUid,
/* periodIndex= */ 0, /* periodIndex= */ 0,
...@@ -146,7 +146,7 @@ import com.google.android.exoplayer2.util.Util; ...@@ -146,7 +146,7 @@ import com.google.android.exoplayer2.util.Util;
PositionInfo newPosition = PositionInfo newPosition =
new PositionInfo( new PositionInfo(
windowUid, windowUid,
/* windowIndex= */ 0, /* mediaItemIndex= */ 0,
mediaItem, mediaItem,
periodUid, periodUid,
/* periodIndex= */ 0, /* periodIndex= */ 0,
......
...@@ -34,7 +34,6 @@ import androidx.annotation.Nullable; ...@@ -34,7 +34,6 @@ import androidx.annotation.Nullable;
import com.google.android.exoplayer2.audio.AudioAttributes; import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.metadata.Metadata; import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.text.Cue; import com.google.android.exoplayer2.text.Cue;
import com.google.android.exoplayer2.trackselection.TrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelectionParameters; import com.google.android.exoplayer2.trackselection.TrackSelectionParameters;
import com.google.android.exoplayer2.util.BundleableUtil; import com.google.android.exoplayer2.util.BundleableUtil;
import com.google.android.exoplayer2.util.FlagSet; import com.google.android.exoplayer2.util.FlagSet;
...@@ -681,11 +680,12 @@ public interface Player { ...@@ -681,11 +680,12 @@ public interface Player {
/** /**
* Called when the combined {@link MediaMetadata} changes. * Called when the combined {@link MediaMetadata} changes.
* *
* <p>The provided {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata} * <p>The provided {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata
* and the static and dynamic metadata from the {@link TrackSelection#getFormat(int) track * MediaItem metadata}, the static metadata in the media's {@link Format#metadata Format}, and
* selections' formats} and {@link Listener#onMetadata(Metadata)}. If a field is populated in * any timed metadata that has been parsed from the media and output via {@link
* the {@link MediaItem#mediaMetadata}, it will be prioritised above the same field coming from * Listener#onMetadata(Metadata)}. If a field is populated in the {@link
* static or dynamic metadata. * MediaItem#mediaMetadata}, it will be prioritised above the same field coming from static or
* timed metadata.
* *
* <p>This method may be called multiple times in quick succession. * <p>This method may be called multiple times in quick succession.
* *
...@@ -2105,11 +2105,11 @@ public interface Player { ...@@ -2105,11 +2105,11 @@ public interface Player {
* Returns the current combined {@link MediaMetadata}, or {@link MediaMetadata#EMPTY} if not * Returns the current combined {@link MediaMetadata}, or {@link MediaMetadata#EMPTY} if not
* supported. * supported.
* *
* <p>This {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata} and the * <p>This {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata MediaItem
* static and dynamic metadata from the {@link TrackSelection#getFormat(int) track selections' * metadata}, the static metadata in the media's {@link Format#metadata Format}, and any timed
* formats} and {@link Listener#onMetadata(Metadata)}. If a field is populated in the {@link * metadata that has been parsed from the media and output via {@link
* MediaItem#mediaMetadata}, it will be prioritised above the same field coming from static or * Listener#onMetadata(Metadata)}. If a field is populated in the {@link MediaItem#mediaMetadata},
* dynamic metadata. * it will be prioritised above the same field coming from static or timed metadata.
*/ */
MediaMetadata getMediaMetadata(); MediaMetadata getMediaMetadata();
......
...@@ -778,7 +778,8 @@ public class AdaptiveTrackSelection extends BaseTrackSelection { ...@@ -778,7 +778,8 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
} }
double[] logBitrates = new double[trackBitrates[i].length]; double[] logBitrates = new double[trackBitrates[i].length];
for (int j = 0; j < trackBitrates[i].length; j++) { for (int j = 0; j < trackBitrates[i].length; j++) {
logBitrates[j] = trackBitrates[i][j] == Format.NO_VALUE ? 0 : Math.log(trackBitrates[i][j]); logBitrates[j] =
trackBitrates[i][j] == Format.NO_VALUE ? 0 : Math.log((double) trackBitrates[i][j]);
} }
double totalBitrateDiff = logBitrates[logBitrates.length - 1] - logBitrates[0]; double totalBitrateDiff = logBitrates[logBitrates.length - 1] - logBitrates[0];
for (int j = 0; j < logBitrates.length - 1; j++) { for (int j = 0; j < logBitrates.length - 1; j++) {
......
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