Move TrackSelection back to ExoPlayer module

PiperOrigin-RevId: 433729648
This commit is contained in:
olly 2022-03-10 13:52:51 +00:00 committed by Oliver Woodman
parent 018d177012
commit 22159673bd
5 changed files with 17 additions and 16 deletions

View file

@ -79,7 +79,7 @@ import com.google.android.exoplayer2.util.Util;
PositionInfo oldPosition =
new PositionInfo(
windowUid,
/* windowIndex= */ 0,
/* mediaItemIndex= */ 0,
mediaItem,
periodUid,
/* periodIndex= */ 0,
@ -97,7 +97,7 @@ import com.google.android.exoplayer2.util.Util;
PositionInfo newPosition =
new PositionInfo(
windowUid,
/* windowIndex= */ 0,
/* mediaItemIndex= */ 0,
mediaItem,
periodUid,
/* periodIndex= */ 0,
@ -128,7 +128,7 @@ import com.google.android.exoplayer2.util.Util;
PositionInfo oldPosition =
new PositionInfo(
windowUid,
/* windowIndex= */ 0,
/* mediaItemIndex= */ 0,
mediaItem,
periodUid,
/* periodIndex= */ 0,
@ -146,7 +146,7 @@ import com.google.android.exoplayer2.util.Util;
PositionInfo newPosition =
new PositionInfo(
windowUid,
/* windowIndex= */ 0,
/* mediaItemIndex= */ 0,
mediaItem,
periodUid,
/* periodIndex= */ 0,

View file

@ -34,7 +34,6 @@ import androidx.annotation.Nullable;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.metadata.Metadata;
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.util.BundleableUtil;
import com.google.android.exoplayer2.util.FlagSet;
@ -681,11 +680,12 @@ public interface Player {
/**
* Called when the combined {@link MediaMetadata} changes.
*
* <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
* selections' formats} and {@link Listener#onMetadata(Metadata)}. If a field is populated in
* the {@link MediaItem#mediaMetadata}, it will be prioritised above the same field coming from
* static or dynamic metadata.
* <p>The provided {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata
* MediaItem metadata}, the static metadata in the media's {@link Format#metadata Format}, and
* any timed metadata that has been parsed from the media and output via {@link
* Listener#onMetadata(Metadata)}. If a field is populated in the {@link
* 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.
*
@ -2105,11 +2105,11 @@ public interface Player {
* Returns the current combined {@link MediaMetadata}, or {@link MediaMetadata#EMPTY} if not
* supported.
*
* <p>This {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata} and the
* static and dynamic metadata from the {@link TrackSelection#getFormat(int) track selections'
* formats} and {@link Listener#onMetadata(Metadata)}. If a field is populated in the {@link
* MediaItem#mediaMetadata}, it will be prioritised above the same field coming from static or
* dynamic metadata.
* <p>This {@link MediaMetadata} is a combination of the {@link MediaItem#mediaMetadata MediaItem
* metadata}, the static metadata in the media's {@link Format#metadata Format}, and any timed
* metadata that has been parsed from the media and output via {@link
* Listener#onMetadata(Metadata)}. If a field is populated in the {@link MediaItem#mediaMetadata},
* it will be prioritised above the same field coming from static or timed metadata.
*/
MediaMetadata getMediaMetadata();

View file

@ -778,7 +778,8 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
}
double[] logBitrates = new double[trackBitrates[i].length];
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];
for (int j = 0; j < logBitrates.length - 1; j++) {