mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 01:22:33 -06:00
2675 lines
127 KiB
Java
2675 lines
127 KiB
Java
|
package com.google.android.exoplayer2;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.graphics.Rect;
|
||
|
import android.graphics.SurfaceTexture;
|
||
|
import android.media.AudioDeviceInfo;
|
||
|
import android.media.AudioTrack;
|
||
|
import android.media.MediaFormat;
|
||
|
import android.media.metrics.LogSessionId;
|
||
|
import android.os.Handler;
|
||
|
import android.os.Looper;
|
||
|
import android.util.Pair;
|
||
|
import android.view.Surface;
|
||
|
import android.view.SurfaceHolder;
|
||
|
import android.view.SurfaceView;
|
||
|
import android.view.TextureView;
|
||
|
import com.google.android.exoplayer2.AudioBecomingNoisyManager;
|
||
|
import com.google.android.exoplayer2.AudioFocusManager;
|
||
|
import com.google.android.exoplayer2.ExoPlayer;
|
||
|
import com.google.android.exoplayer2.ExoPlayerImpl;
|
||
|
import com.google.android.exoplayer2.ExoPlayerImplInternal;
|
||
|
import com.google.android.exoplayer2.MediaSourceList;
|
||
|
import com.google.android.exoplayer2.Player;
|
||
|
import com.google.android.exoplayer2.PlayerMessage;
|
||
|
import com.google.android.exoplayer2.StreamVolumeManager;
|
||
|
import com.google.android.exoplayer2.Timeline;
|
||
|
import com.google.android.exoplayer2.analytics.AnalyticsCollector;
|
||
|
import com.google.android.exoplayer2.analytics.AnalyticsListener;
|
||
|
import com.google.android.exoplayer2.analytics.DefaultAnalyticsCollector;
|
||
|
import com.google.android.exoplayer2.analytics.MediaMetricsListener;
|
||
|
import com.google.android.exoplayer2.analytics.PlayerId;
|
||
|
import com.google.android.exoplayer2.audio.AudioAttributes;
|
||
|
import com.google.android.exoplayer2.audio.AudioRendererEventListener;
|
||
|
import com.google.android.exoplayer2.audio.AuxEffectInfo;
|
||
|
import com.google.android.exoplayer2.decoder.DecoderCounters;
|
||
|
import com.google.android.exoplayer2.decoder.DecoderReuseEvaluation;
|
||
|
import com.google.android.exoplayer2.metadata.Metadata;
|
||
|
import com.google.android.exoplayer2.metadata.MetadataOutput;
|
||
|
import com.google.android.exoplayer2.source.MediaSource;
|
||
|
import com.google.android.exoplayer2.source.ShuffleOrder;
|
||
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||
|
import com.google.android.exoplayer2.text.Cue;
|
||
|
import com.google.android.exoplayer2.text.CueGroup;
|
||
|
import com.google.android.exoplayer2.text.TextOutput;
|
||
|
import com.google.android.exoplayer2.trackselection.ExoTrackSelection;
|
||
|
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
||
|
import com.google.android.exoplayer2.trackselection.TrackSelectionParameters;
|
||
|
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
||
|
import com.google.android.exoplayer2.trackselection.TrackSelectorResult;
|
||
|
import com.google.android.exoplayer2.upstream.BandwidthMeter;
|
||
|
import com.google.android.exoplayer2.util.Assertions;
|
||
|
import com.google.android.exoplayer2.util.Clock;
|
||
|
import com.google.android.exoplayer2.util.ConditionVariable;
|
||
|
import com.google.android.exoplayer2.util.FlagSet;
|
||
|
import com.google.android.exoplayer2.util.HandlerWrapper;
|
||
|
import com.google.android.exoplayer2.util.ListenerSet;
|
||
|
import com.google.android.exoplayer2.util.Log;
|
||
|
import com.google.android.exoplayer2.util.PriorityTaskManager;
|
||
|
import com.google.android.exoplayer2.util.Size;
|
||
|
import com.google.android.exoplayer2.util.Util;
|
||
|
import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer;
|
||
|
import com.google.android.exoplayer2.video.VideoFrameMetadataListener;
|
||
|
import com.google.android.exoplayer2.video.VideoRendererEventListener;
|
||
|
import com.google.android.exoplayer2.video.VideoSize;
|
||
|
import com.google.android.exoplayer2.video.spherical.CameraMotionListener;
|
||
|
import com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView;
|
||
|
import com.google.common.collect.ImmutableList;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Collections;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||
|
import java.util.concurrent.TimeoutException;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class ExoPlayerImpl extends BasePlayer implements ExoPlayer, ExoPlayer.AudioComponent, ExoPlayer.VideoComponent, ExoPlayer.TextComponent, ExoPlayer.DeviceComponent {
|
||
|
private static final String TAG = "ExoPlayerImpl";
|
||
|
private final AnalyticsCollector analyticsCollector;
|
||
|
private final Context applicationContext;
|
||
|
private final Looper applicationLooper;
|
||
|
private AudioAttributes audioAttributes;
|
||
|
private final AudioBecomingNoisyManager audioBecomingNoisyManager;
|
||
|
private DecoderCounters audioDecoderCounters;
|
||
|
private final AudioFocusManager audioFocusManager;
|
||
|
private Format audioFormat;
|
||
|
private final CopyOnWriteArraySet<ExoPlayer.AudioOffloadListener> audioOffloadListeners;
|
||
|
private int audioSessionId;
|
||
|
private Player.Commands availableCommands;
|
||
|
private final BandwidthMeter bandwidthMeter;
|
||
|
private CameraMotionListener cameraMotionListener;
|
||
|
private final Clock clock;
|
||
|
private final ComponentListener componentListener;
|
||
|
private final ConditionVariable constructorFinished;
|
||
|
private CueGroup currentCueGroup;
|
||
|
private final long detachSurfaceTimeoutMs;
|
||
|
private DeviceInfo deviceInfo;
|
||
|
final TrackSelectorResult emptyTrackSelectorResult;
|
||
|
private boolean foregroundMode;
|
||
|
private final FrameMetadataListener frameMetadataListener;
|
||
|
private boolean hasNotifiedFullWrongThreadWarning;
|
||
|
private final ExoPlayerImplInternal internalPlayer;
|
||
|
private boolean isPriorityTaskManagerRegistered;
|
||
|
private AudioTrack keepSessionIdAudioTrack;
|
||
|
private final ListenerSet<Player.Listener> listeners;
|
||
|
private int maskingPeriodIndex;
|
||
|
private int maskingWindowIndex;
|
||
|
private long maskingWindowPositionMs;
|
||
|
private MediaMetadata mediaMetadata;
|
||
|
private final MediaSource.Factory mediaSourceFactory;
|
||
|
private final List<MediaSourceHolderSnapshot> mediaSourceHolderSnapshots;
|
||
|
private Surface ownedSurface;
|
||
|
private boolean pauseAtEndOfMediaItems;
|
||
|
private boolean pendingDiscontinuity;
|
||
|
private int pendingDiscontinuityReason;
|
||
|
private int pendingOperationAcks;
|
||
|
private int pendingPlayWhenReadyChangeReason;
|
||
|
private final Timeline.Period period;
|
||
|
final Player.Commands permanentAvailableCommands;
|
||
|
private PlaybackInfo playbackInfo;
|
||
|
private final HandlerWrapper playbackInfoUpdateHandler;
|
||
|
private final ExoPlayerImplInternal.PlaybackInfoUpdateListener playbackInfoUpdateListener;
|
||
|
private boolean playerReleased;
|
||
|
private MediaMetadata playlistMetadata;
|
||
|
private PriorityTaskManager priorityTaskManager;
|
||
|
private final Renderer[] renderers;
|
||
|
private int repeatMode;
|
||
|
private final long seekBackIncrementMs;
|
||
|
private final long seekForwardIncrementMs;
|
||
|
private SeekParameters seekParameters;
|
||
|
private boolean shuffleModeEnabled;
|
||
|
private ShuffleOrder shuffleOrder;
|
||
|
private boolean skipSilenceEnabled;
|
||
|
private SphericalGLSurfaceView sphericalGLSurfaceView;
|
||
|
private MediaMetadata staticAndDynamicMediaMetadata;
|
||
|
private final StreamVolumeManager streamVolumeManager;
|
||
|
private SurfaceHolder surfaceHolder;
|
||
|
private boolean surfaceHolderSurfaceIsVideoOutput;
|
||
|
private Size surfaceSize;
|
||
|
private TextureView textureView;
|
||
|
private boolean throwsWhenUsingWrongThread;
|
||
|
private final TrackSelector trackSelector;
|
||
|
private final boolean useLazyPreparation;
|
||
|
private int videoChangeFrameRateStrategy;
|
||
|
private DecoderCounters videoDecoderCounters;
|
||
|
private Format videoFormat;
|
||
|
private VideoFrameMetadataListener videoFrameMetadataListener;
|
||
|
private Object videoOutput;
|
||
|
private int videoScalingMode;
|
||
|
private VideoSize videoSize;
|
||
|
private float volume;
|
||
|
private final WakeLockManager wakeLockManager;
|
||
|
private final WifiLockManager wifiLockManager;
|
||
|
private final Player wrappingPlayer;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public static int getPlayWhenReadyChangeReason(boolean z, int i) {
|
||
|
return (!z || i == 1) ? 1 : 2;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public Looper getApplicationLooper() {
|
||
|
return this.applicationLooper;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public Clock getClock() {
|
||
|
return this.clock;
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
ExoPlayerLibraryInfo.registerModule("goog.exo.exoplayer");
|
||
|
}
|
||
|
|
||
|
public ExoPlayerImpl(ExoPlayer.Builder builder, Player player) {
|
||
|
PlayerId registerMediaMetricsListener;
|
||
|
ConditionVariable conditionVariable = new ConditionVariable();
|
||
|
this.constructorFinished = conditionVariable;
|
||
|
try {
|
||
|
Log.i(TAG, "Init " + Integer.toHexString(System.identityHashCode(this)) + " [ExoPlayerLib/2.18.7] [" + Util.DEVICE_DEBUG_INFO + "]");
|
||
|
Context applicationContext = builder.context.getApplicationContext();
|
||
|
this.applicationContext = applicationContext;
|
||
|
AnalyticsCollector apply = builder.analyticsCollectorFunction.apply(builder.clock);
|
||
|
this.analyticsCollector = apply;
|
||
|
this.priorityTaskManager = builder.priorityTaskManager;
|
||
|
this.audioAttributes = builder.audioAttributes;
|
||
|
this.videoScalingMode = builder.videoScalingMode;
|
||
|
this.videoChangeFrameRateStrategy = builder.videoChangeFrameRateStrategy;
|
||
|
this.skipSilenceEnabled = builder.skipSilenceEnabled;
|
||
|
this.detachSurfaceTimeoutMs = builder.detachSurfaceTimeoutMs;
|
||
|
ComponentListener componentListener = new ComponentListener();
|
||
|
this.componentListener = componentListener;
|
||
|
FrameMetadataListener frameMetadataListener = new FrameMetadataListener();
|
||
|
this.frameMetadataListener = frameMetadataListener;
|
||
|
Handler handler = new Handler(builder.looper);
|
||
|
Renderer[] createRenderers = builder.renderersFactorySupplier.get().createRenderers(handler, componentListener, componentListener, componentListener, componentListener);
|
||
|
this.renderers = createRenderers;
|
||
|
Assertions.checkState(createRenderers.length > 0);
|
||
|
TrackSelector trackSelector = builder.trackSelectorSupplier.get();
|
||
|
this.trackSelector = trackSelector;
|
||
|
this.mediaSourceFactory = builder.mediaSourceFactorySupplier.get();
|
||
|
BandwidthMeter bandwidthMeter = builder.bandwidthMeterSupplier.get();
|
||
|
this.bandwidthMeter = bandwidthMeter;
|
||
|
this.useLazyPreparation = builder.useLazyPreparation;
|
||
|
this.seekParameters = builder.seekParameters;
|
||
|
this.seekBackIncrementMs = builder.seekBackIncrementMs;
|
||
|
this.seekForwardIncrementMs = builder.seekForwardIncrementMs;
|
||
|
this.pauseAtEndOfMediaItems = builder.pauseAtEndOfMediaItems;
|
||
|
Looper looper = builder.looper;
|
||
|
this.applicationLooper = looper;
|
||
|
Clock clock = builder.clock;
|
||
|
this.clock = clock;
|
||
|
Player player2 = player == null ? this : player;
|
||
|
this.wrappingPlayer = player2;
|
||
|
this.listeners = new ListenerSet<>(looper, clock, new ListenerSet.IterationFinishedEvent() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda11
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.IterationFinishedEvent
|
||
|
public final void invoke(Object obj, FlagSet flagSet) {
|
||
|
ExoPlayerImpl.this.m5370lambda$new$0$comgoogleandroidexoplayer2ExoPlayerImpl((Player.Listener) obj, flagSet);
|
||
|
}
|
||
|
});
|
||
|
this.audioOffloadListeners = new CopyOnWriteArraySet<>();
|
||
|
this.mediaSourceHolderSnapshots = new ArrayList();
|
||
|
this.shuffleOrder = new ShuffleOrder.DefaultShuffleOrder(0);
|
||
|
TrackSelectorResult trackSelectorResult = new TrackSelectorResult(new RendererConfiguration[createRenderers.length], new ExoTrackSelection[createRenderers.length], Tracks.EMPTY, null);
|
||
|
this.emptyTrackSelectorResult = trackSelectorResult;
|
||
|
this.period = new Timeline.Period();
|
||
|
Player.Commands build = new Player.Commands.Builder().addAll(1, 2, 3, 13, 14, 15, 16, 17, 18, 19, 31, 20, 30, 21, 22, 23, 24, 25, 26, 27, 28).addIf(29, trackSelector.isSetParametersSupported()).build();
|
||
|
this.permanentAvailableCommands = build;
|
||
|
this.availableCommands = new Player.Commands.Builder().addAll(build).add(4).add(10).build();
|
||
|
this.playbackInfoUpdateHandler = clock.createHandler(looper, null);
|
||
|
ExoPlayerImplInternal.PlaybackInfoUpdateListener playbackInfoUpdateListener = new ExoPlayerImplInternal.PlaybackInfoUpdateListener() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda21
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayerImplInternal.PlaybackInfoUpdateListener
|
||
|
public final void onPlaybackInfoUpdate(ExoPlayerImplInternal.PlaybackInfoUpdate playbackInfoUpdate) {
|
||
|
ExoPlayerImpl.this.m5372lambda$new$2$comgoogleandroidexoplayer2ExoPlayerImpl(playbackInfoUpdate);
|
||
|
}
|
||
|
};
|
||
|
this.playbackInfoUpdateListener = playbackInfoUpdateListener;
|
||
|
this.playbackInfo = PlaybackInfo.createDummy(trackSelectorResult);
|
||
|
apply.setPlayer(player2, looper);
|
||
|
if (Util.SDK_INT < 31) {
|
||
|
registerMediaMetricsListener = new PlayerId();
|
||
|
} else {
|
||
|
registerMediaMetricsListener = Api31.registerMediaMetricsListener(applicationContext, this, builder.usePlatformDiagnostics);
|
||
|
}
|
||
|
ExoPlayerImplInternal exoPlayerImplInternal = new ExoPlayerImplInternal(createRenderers, trackSelector, trackSelectorResult, builder.loadControlSupplier.get(), bandwidthMeter, this.repeatMode, this.shuffleModeEnabled, apply, this.seekParameters, builder.livePlaybackSpeedControl, builder.releaseTimeoutMs, this.pauseAtEndOfMediaItems, looper, clock, playbackInfoUpdateListener, registerMediaMetricsListener, builder.playbackLooper);
|
||
|
this.internalPlayer = exoPlayerImplInternal;
|
||
|
this.volume = 1.0f;
|
||
|
this.repeatMode = 0;
|
||
|
this.mediaMetadata = MediaMetadata.EMPTY;
|
||
|
this.playlistMetadata = MediaMetadata.EMPTY;
|
||
|
this.staticAndDynamicMediaMetadata = MediaMetadata.EMPTY;
|
||
|
this.maskingWindowIndex = -1;
|
||
|
if (Util.SDK_INT < 21) {
|
||
|
this.audioSessionId = initializeKeepSessionIdAudioTrack(0);
|
||
|
} else {
|
||
|
this.audioSessionId = Util.generateAudioSessionIdV21(applicationContext);
|
||
|
}
|
||
|
this.currentCueGroup = CueGroup.EMPTY_TIME_ZERO;
|
||
|
this.throwsWhenUsingWrongThread = true;
|
||
|
addListener(apply);
|
||
|
bandwidthMeter.addEventListener(new Handler(looper), apply);
|
||
|
addAudioOffloadListener(componentListener);
|
||
|
if (builder.foregroundModeTimeoutMs > 0) {
|
||
|
exoPlayerImplInternal.experimentalSetForegroundModeTimeoutMs(builder.foregroundModeTimeoutMs);
|
||
|
}
|
||
|
AudioBecomingNoisyManager audioBecomingNoisyManager = new AudioBecomingNoisyManager(builder.context, handler, componentListener);
|
||
|
this.audioBecomingNoisyManager = audioBecomingNoisyManager;
|
||
|
audioBecomingNoisyManager.setEnabled(builder.handleAudioBecomingNoisy);
|
||
|
AudioFocusManager audioFocusManager = new AudioFocusManager(builder.context, handler, componentListener);
|
||
|
this.audioFocusManager = audioFocusManager;
|
||
|
audioFocusManager.setAudioAttributes(builder.handleAudioFocus ? this.audioAttributes : null);
|
||
|
StreamVolumeManager streamVolumeManager = new StreamVolumeManager(builder.context, handler, componentListener);
|
||
|
this.streamVolumeManager = streamVolumeManager;
|
||
|
streamVolumeManager.setStreamType(Util.getStreamTypeForAudioUsage(this.audioAttributes.usage));
|
||
|
WakeLockManager wakeLockManager = new WakeLockManager(builder.context);
|
||
|
this.wakeLockManager = wakeLockManager;
|
||
|
wakeLockManager.setEnabled(builder.wakeMode != 0);
|
||
|
WifiLockManager wifiLockManager = new WifiLockManager(builder.context);
|
||
|
this.wifiLockManager = wifiLockManager;
|
||
|
wifiLockManager.setEnabled(builder.wakeMode == 2);
|
||
|
this.deviceInfo = createDeviceInfo(streamVolumeManager);
|
||
|
this.videoSize = VideoSize.UNKNOWN;
|
||
|
this.surfaceSize = Size.UNKNOWN;
|
||
|
trackSelector.setAudioAttributes(this.audioAttributes);
|
||
|
sendRendererMessage(1, 10, Integer.valueOf(this.audioSessionId));
|
||
|
sendRendererMessage(2, 10, Integer.valueOf(this.audioSessionId));
|
||
|
sendRendererMessage(1, 3, this.audioAttributes);
|
||
|
sendRendererMessage(2, 4, Integer.valueOf(this.videoScalingMode));
|
||
|
sendRendererMessage(2, 5, Integer.valueOf(this.videoChangeFrameRateStrategy));
|
||
|
sendRendererMessage(1, 9, Boolean.valueOf(this.skipSilenceEnabled));
|
||
|
sendRendererMessage(2, 7, frameMetadataListener);
|
||
|
sendRendererMessage(6, 8, frameMetadataListener);
|
||
|
conditionVariable.open();
|
||
|
} catch (Throwable th) {
|
||
|
this.constructorFinished.open();
|
||
|
throw th;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$new$0$com-google-android-exoplayer2-ExoPlayerImpl, reason: not valid java name */
|
||
|
public /* synthetic */ void m5370lambda$new$0$comgoogleandroidexoplayer2ExoPlayerImpl(Player.Listener listener, FlagSet flagSet) {
|
||
|
listener.onEvents(this.wrappingPlayer, new Player.Events(flagSet));
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$new$2$com-google-android-exoplayer2-ExoPlayerImpl, reason: not valid java name */
|
||
|
public /* synthetic */ void m5372lambda$new$2$comgoogleandroidexoplayer2ExoPlayerImpl(final ExoPlayerImplInternal.PlaybackInfoUpdate playbackInfoUpdate) {
|
||
|
this.playbackInfoUpdateHandler.post(new Runnable() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda24
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
ExoPlayerImpl.this.m5371lambda$new$1$comgoogleandroidexoplayer2ExoPlayerImpl(playbackInfoUpdate);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
@Deprecated
|
||
|
public ExoPlayer.AudioComponent getAudioComponent() {
|
||
|
verifyApplicationThread();
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
@Deprecated
|
||
|
public ExoPlayer.VideoComponent getVideoComponent() {
|
||
|
verifyApplicationThread();
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
@Deprecated
|
||
|
public ExoPlayer.TextComponent getTextComponent() {
|
||
|
verifyApplicationThread();
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
@Deprecated
|
||
|
public ExoPlayer.DeviceComponent getDeviceComponent() {
|
||
|
verifyApplicationThread();
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void experimentalSetOffloadSchedulingEnabled(boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
this.internalPlayer.experimentalSetOffloadSchedulingEnabled(z);
|
||
|
Iterator<ExoPlayer.AudioOffloadListener> it = this.audioOffloadListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
it.next().onExperimentalOffloadSchedulingEnabledChanged(z);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public boolean experimentalIsSleepingForOffload() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.sleepingForOffload;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public Looper getPlaybackLooper() {
|
||
|
return this.internalPlayer.getPlaybackLooper();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void addAudioOffloadListener(ExoPlayer.AudioOffloadListener audioOffloadListener) {
|
||
|
this.audioOffloadListeners.add(audioOffloadListener);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void removeAudioOffloadListener(ExoPlayer.AudioOffloadListener audioOffloadListener) {
|
||
|
verifyApplicationThread();
|
||
|
this.audioOffloadListeners.remove(audioOffloadListener);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public Player.Commands getAvailableCommands() {
|
||
|
verifyApplicationThread();
|
||
|
return this.availableCommands;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public int getPlaybackState() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.playbackState;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public int getPlaybackSuppressionReason() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.playbackSuppressionReason;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public ExoPlaybackException getPlayerError() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.playbackError;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
@Deprecated
|
||
|
public void retry() {
|
||
|
verifyApplicationThread();
|
||
|
prepare();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void prepare() {
|
||
|
verifyApplicationThread();
|
||
|
boolean playWhenReady = getPlayWhenReady();
|
||
|
int updateAudioFocus = this.audioFocusManager.updateAudioFocus(playWhenReady, 2);
|
||
|
updatePlayWhenReady(playWhenReady, updateAudioFocus, getPlayWhenReadyChangeReason(playWhenReady, updateAudioFocus));
|
||
|
if (this.playbackInfo.playbackState != 1) {
|
||
|
return;
|
||
|
}
|
||
|
PlaybackInfo copyWithPlaybackError = this.playbackInfo.copyWithPlaybackError(null);
|
||
|
PlaybackInfo copyWithPlaybackState = copyWithPlaybackError.copyWithPlaybackState(copyWithPlaybackError.timeline.isEmpty() ? 4 : 2);
|
||
|
this.pendingOperationAcks++;
|
||
|
this.internalPlayer.prepare();
|
||
|
updatePlaybackInfo(copyWithPlaybackState, 1, 1, false, false, 5, -9223372036854775807L, -1, false);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
@Deprecated
|
||
|
public void prepare(MediaSource mediaSource) {
|
||
|
verifyApplicationThread();
|
||
|
setMediaSource(mediaSource);
|
||
|
prepare();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
@Deprecated
|
||
|
public void prepare(MediaSource mediaSource, boolean z, boolean z2) {
|
||
|
verifyApplicationThread();
|
||
|
setMediaSource(mediaSource, z);
|
||
|
prepare();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void setMediaItems(List<MediaItem> list, boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
setMediaSources(createMediaSources(list), z);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void setMediaItems(List<MediaItem> list, int i, long j) {
|
||
|
verifyApplicationThread();
|
||
|
setMediaSources(createMediaSources(list), i, j);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setMediaSource(MediaSource mediaSource) {
|
||
|
verifyApplicationThread();
|
||
|
setMediaSources(Collections.singletonList(mediaSource));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setMediaSource(MediaSource mediaSource, long j) {
|
||
|
verifyApplicationThread();
|
||
|
setMediaSources(Collections.singletonList(mediaSource), 0, j);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setMediaSource(MediaSource mediaSource, boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
setMediaSources(Collections.singletonList(mediaSource), z);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setMediaSources(List<MediaSource> list) {
|
||
|
verifyApplicationThread();
|
||
|
setMediaSources(list, true);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setMediaSources(List<MediaSource> list, boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
setMediaSourcesInternal(list, -1, -9223372036854775807L, z);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setMediaSources(List<MediaSource> list, int i, long j) {
|
||
|
verifyApplicationThread();
|
||
|
setMediaSourcesInternal(list, i, j, false);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void addMediaItems(int i, List<MediaItem> list) {
|
||
|
verifyApplicationThread();
|
||
|
addMediaSources(i, createMediaSources(list));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void addMediaSource(MediaSource mediaSource) {
|
||
|
verifyApplicationThread();
|
||
|
addMediaSources(Collections.singletonList(mediaSource));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void addMediaSource(int i, MediaSource mediaSource) {
|
||
|
verifyApplicationThread();
|
||
|
addMediaSources(i, Collections.singletonList(mediaSource));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void addMediaSources(List<MediaSource> list) {
|
||
|
verifyApplicationThread();
|
||
|
addMediaSources(this.mediaSourceHolderSnapshots.size(), list);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void addMediaSources(int i, List<MediaSource> list) {
|
||
|
verifyApplicationThread();
|
||
|
Assertions.checkArgument(i >= 0);
|
||
|
int min = Math.min(i, this.mediaSourceHolderSnapshots.size());
|
||
|
Timeline currentTimeline = getCurrentTimeline();
|
||
|
this.pendingOperationAcks++;
|
||
|
List<MediaSourceList.MediaSourceHolder> addMediaSourceHolders = addMediaSourceHolders(min, list);
|
||
|
Timeline createMaskingTimeline = createMaskingTimeline();
|
||
|
PlaybackInfo maskTimelineAndPosition = maskTimelineAndPosition(this.playbackInfo, createMaskingTimeline, getPeriodPositionUsAfterTimelineChanged(currentTimeline, createMaskingTimeline));
|
||
|
this.internalPlayer.addMediaSources(min, addMediaSourceHolders, this.shuffleOrder);
|
||
|
updatePlaybackInfo(maskTimelineAndPosition, 0, 1, false, false, 5, -9223372036854775807L, -1, false);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void removeMediaItems(int i, int i2) {
|
||
|
verifyApplicationThread();
|
||
|
Assertions.checkArgument(i >= 0 && i2 >= i);
|
||
|
int size = this.mediaSourceHolderSnapshots.size();
|
||
|
int min = Math.min(i2, size);
|
||
|
if (i >= size || i == min) {
|
||
|
return;
|
||
|
}
|
||
|
PlaybackInfo removeMediaItemsInternal = removeMediaItemsInternal(i, min);
|
||
|
updatePlaybackInfo(removeMediaItemsInternal, 0, 1, false, !removeMediaItemsInternal.periodId.periodUid.equals(this.playbackInfo.periodId.periodUid), 4, getCurrentPositionUsInternal(removeMediaItemsInternal), -1, false);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void moveMediaItems(int i, int i2, int i3) {
|
||
|
verifyApplicationThread();
|
||
|
Assertions.checkArgument(i >= 0 && i <= i2 && i3 >= 0);
|
||
|
int size = this.mediaSourceHolderSnapshots.size();
|
||
|
int min = Math.min(i2, size);
|
||
|
int min2 = Math.min(i3, size - (min - i));
|
||
|
if (i >= size || i == min || i == min2) {
|
||
|
return;
|
||
|
}
|
||
|
Timeline currentTimeline = getCurrentTimeline();
|
||
|
this.pendingOperationAcks++;
|
||
|
Util.moveItems(this.mediaSourceHolderSnapshots, i, min, min2);
|
||
|
Timeline createMaskingTimeline = createMaskingTimeline();
|
||
|
PlaybackInfo maskTimelineAndPosition = maskTimelineAndPosition(this.playbackInfo, createMaskingTimeline, getPeriodPositionUsAfterTimelineChanged(currentTimeline, createMaskingTimeline));
|
||
|
this.internalPlayer.moveMediaSources(i, min, min2, this.shuffleOrder);
|
||
|
updatePlaybackInfo(maskTimelineAndPosition, 0, 1, false, false, 5, -9223372036854775807L, -1, false);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setShuffleOrder(ShuffleOrder shuffleOrder) {
|
||
|
verifyApplicationThread();
|
||
|
this.shuffleOrder = shuffleOrder;
|
||
|
Timeline createMaskingTimeline = createMaskingTimeline();
|
||
|
PlaybackInfo maskTimelineAndPosition = maskTimelineAndPosition(this.playbackInfo, createMaskingTimeline, maskWindowPositionMsOrGetPeriodPositionUs(createMaskingTimeline, getCurrentMediaItemIndex(), getCurrentPosition()));
|
||
|
this.pendingOperationAcks++;
|
||
|
this.internalPlayer.setShuffleOrder(shuffleOrder);
|
||
|
updatePlaybackInfo(maskTimelineAndPosition, 0, 1, false, false, 5, -9223372036854775807L, -1, false);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setPauseAtEndOfMediaItems(boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.pauseAtEndOfMediaItems == z) {
|
||
|
return;
|
||
|
}
|
||
|
this.pauseAtEndOfMediaItems = z;
|
||
|
this.internalPlayer.setPauseAtEndOfWindow(z);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public boolean getPauseAtEndOfMediaItems() {
|
||
|
verifyApplicationThread();
|
||
|
return this.pauseAtEndOfMediaItems;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void setPlayWhenReady(boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
int updateAudioFocus = this.audioFocusManager.updateAudioFocus(z, getPlaybackState());
|
||
|
updatePlayWhenReady(z, updateAudioFocus, getPlayWhenReadyChangeReason(z, updateAudioFocus));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public boolean getPlayWhenReady() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.playWhenReady;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void setRepeatMode(final int i) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.repeatMode != i) {
|
||
|
this.repeatMode = i;
|
||
|
this.internalPlayer.setRepeatMode(i);
|
||
|
this.listeners.queueEvent(8, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda2
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onRepeatModeChanged(i);
|
||
|
}
|
||
|
});
|
||
|
updateAvailableCommands();
|
||
|
this.listeners.flushEvents();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public int getRepeatMode() {
|
||
|
verifyApplicationThread();
|
||
|
return this.repeatMode;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void setShuffleModeEnabled(final boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.shuffleModeEnabled != z) {
|
||
|
this.shuffleModeEnabled = z;
|
||
|
this.internalPlayer.setShuffleModeEnabled(z);
|
||
|
this.listeners.queueEvent(9, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda27
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onShuffleModeEnabledChanged(z);
|
||
|
}
|
||
|
});
|
||
|
updateAvailableCommands();
|
||
|
this.listeners.flushEvents();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public boolean getShuffleModeEnabled() {
|
||
|
verifyApplicationThread();
|
||
|
return this.shuffleModeEnabled;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public boolean isLoading() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.isLoading;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.BasePlayer
|
||
|
public void seekTo(int i, long j, int i2, boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
Assertions.checkArgument(i >= 0);
|
||
|
this.analyticsCollector.notifySeekStarted();
|
||
|
Timeline timeline = this.playbackInfo.timeline;
|
||
|
if (timeline.isEmpty() || i < timeline.getWindowCount()) {
|
||
|
this.pendingOperationAcks++;
|
||
|
if (isPlayingAd()) {
|
||
|
Log.w(TAG, "seekTo ignored because an ad is playing");
|
||
|
ExoPlayerImplInternal.PlaybackInfoUpdate playbackInfoUpdate = new ExoPlayerImplInternal.PlaybackInfoUpdate(this.playbackInfo);
|
||
|
playbackInfoUpdate.incrementPendingOperationAcks(1);
|
||
|
this.playbackInfoUpdateListener.onPlaybackInfoUpdate(playbackInfoUpdate);
|
||
|
return;
|
||
|
}
|
||
|
int i3 = getPlaybackState() != 1 ? 2 : 1;
|
||
|
int currentMediaItemIndex = getCurrentMediaItemIndex();
|
||
|
PlaybackInfo maskTimelineAndPosition = maskTimelineAndPosition(this.playbackInfo.copyWithPlaybackState(i3), timeline, maskWindowPositionMsOrGetPeriodPositionUs(timeline, i, j));
|
||
|
this.internalPlayer.seekTo(timeline, i, Util.msToUs(j));
|
||
|
updatePlaybackInfo(maskTimelineAndPosition, 0, 1, true, true, 1, getCurrentPositionUsInternal(maskTimelineAndPosition), currentMediaItemIndex, z);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public long getSeekBackIncrement() {
|
||
|
verifyApplicationThread();
|
||
|
return this.seekBackIncrementMs;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public long getSeekForwardIncrement() {
|
||
|
verifyApplicationThread();
|
||
|
return this.seekForwardIncrementMs;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public long getMaxSeekToPreviousPosition() {
|
||
|
verifyApplicationThread();
|
||
|
return 3000L;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void setPlaybackParameters(PlaybackParameters playbackParameters) {
|
||
|
verifyApplicationThread();
|
||
|
if (playbackParameters == null) {
|
||
|
playbackParameters = PlaybackParameters.DEFAULT;
|
||
|
}
|
||
|
if (this.playbackInfo.playbackParameters.equals(playbackParameters)) {
|
||
|
return;
|
||
|
}
|
||
|
PlaybackInfo copyWithPlaybackParameters = this.playbackInfo.copyWithPlaybackParameters(playbackParameters);
|
||
|
this.pendingOperationAcks++;
|
||
|
this.internalPlayer.setPlaybackParameters(playbackParameters);
|
||
|
updatePlaybackInfo(copyWithPlaybackParameters, 0, 1, false, false, 5, -9223372036854775807L, -1, false);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public PlaybackParameters getPlaybackParameters() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.playbackParameters;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setSeekParameters(SeekParameters seekParameters) {
|
||
|
verifyApplicationThread();
|
||
|
if (seekParameters == null) {
|
||
|
seekParameters = SeekParameters.DEFAULT;
|
||
|
}
|
||
|
if (this.seekParameters.equals(seekParameters)) {
|
||
|
return;
|
||
|
}
|
||
|
this.seekParameters = seekParameters;
|
||
|
this.internalPlayer.setSeekParameters(seekParameters);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public SeekParameters getSeekParameters() {
|
||
|
verifyApplicationThread();
|
||
|
return this.seekParameters;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setForegroundMode(boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.foregroundMode != z) {
|
||
|
this.foregroundMode = z;
|
||
|
if (this.internalPlayer.setForegroundMode(z)) {
|
||
|
return;
|
||
|
}
|
||
|
stopInternal(false, ExoPlaybackException.createForUnexpected(new ExoTimeoutException(2), 1003));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void stop() {
|
||
|
verifyApplicationThread();
|
||
|
stop(false);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void stop(boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
this.audioFocusManager.updateAudioFocus(getPlayWhenReady(), 1);
|
||
|
stopInternal(z, null);
|
||
|
this.currentCueGroup = new CueGroup(ImmutableList.of(), this.playbackInfo.positionUs);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void release() {
|
||
|
AudioTrack audioTrack;
|
||
|
Log.i(TAG, "Release " + Integer.toHexString(System.identityHashCode(this)) + " [ExoPlayerLib/2.18.7] [" + Util.DEVICE_DEBUG_INFO + "] [" + ExoPlayerLibraryInfo.registeredModules() + "]");
|
||
|
verifyApplicationThread();
|
||
|
if (Util.SDK_INT < 21 && (audioTrack = this.keepSessionIdAudioTrack) != null) {
|
||
|
audioTrack.release();
|
||
|
this.keepSessionIdAudioTrack = null;
|
||
|
}
|
||
|
this.audioBecomingNoisyManager.setEnabled(false);
|
||
|
this.streamVolumeManager.release();
|
||
|
this.wakeLockManager.setStayAwake(false);
|
||
|
this.wifiLockManager.setStayAwake(false);
|
||
|
this.audioFocusManager.release();
|
||
|
if (!this.internalPlayer.release()) {
|
||
|
this.listeners.sendEvent(10, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda28
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onPlayerError(ExoPlaybackException.createForUnexpected(new ExoTimeoutException(1), 1003));
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
this.listeners.release();
|
||
|
this.playbackInfoUpdateHandler.removeCallbacksAndMessages(null);
|
||
|
this.bandwidthMeter.removeEventListener(this.analyticsCollector);
|
||
|
PlaybackInfo copyWithPlaybackState = this.playbackInfo.copyWithPlaybackState(1);
|
||
|
this.playbackInfo = copyWithPlaybackState;
|
||
|
PlaybackInfo copyWithLoadingMediaPeriodId = copyWithPlaybackState.copyWithLoadingMediaPeriodId(copyWithPlaybackState.periodId);
|
||
|
this.playbackInfo = copyWithLoadingMediaPeriodId;
|
||
|
copyWithLoadingMediaPeriodId.bufferedPositionUs = copyWithLoadingMediaPeriodId.positionUs;
|
||
|
this.playbackInfo.totalBufferedDurationUs = 0L;
|
||
|
this.analyticsCollector.release();
|
||
|
this.trackSelector.release();
|
||
|
removeSurfaceCallbacks();
|
||
|
Surface surface = this.ownedSurface;
|
||
|
if (surface != null) {
|
||
|
surface.release();
|
||
|
this.ownedSurface = null;
|
||
|
}
|
||
|
if (this.isPriorityTaskManagerRegistered) {
|
||
|
((PriorityTaskManager) Assertions.checkNotNull(this.priorityTaskManager)).remove(0);
|
||
|
this.isPriorityTaskManagerRegistered = false;
|
||
|
}
|
||
|
this.currentCueGroup = CueGroup.EMPTY_TIME_ZERO;
|
||
|
this.playerReleased = true;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public PlayerMessage createMessage(PlayerMessage.Target target) {
|
||
|
verifyApplicationThread();
|
||
|
return createMessageInternal(target);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public int getCurrentPeriodIndex() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.timeline.isEmpty() ? this.maskingPeriodIndex : this.playbackInfo.timeline.getIndexOfPeriod(this.playbackInfo.periodId.periodUid);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public int getCurrentMediaItemIndex() {
|
||
|
verifyApplicationThread();
|
||
|
int currentWindowIndexInternal = getCurrentWindowIndexInternal();
|
||
|
if (currentWindowIndexInternal == -1) {
|
||
|
return 0;
|
||
|
}
|
||
|
return currentWindowIndexInternal;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public long getDuration() {
|
||
|
verifyApplicationThread();
|
||
|
if (isPlayingAd()) {
|
||
|
MediaSource.MediaPeriodId mediaPeriodId = this.playbackInfo.periodId;
|
||
|
this.playbackInfo.timeline.getPeriodByUid(mediaPeriodId.periodUid, this.period);
|
||
|
return Util.usToMs(this.period.getAdDurationUs(mediaPeriodId.adGroupIndex, mediaPeriodId.adIndexInAdGroup));
|
||
|
}
|
||
|
return getContentDuration();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public long getCurrentPosition() {
|
||
|
verifyApplicationThread();
|
||
|
return Util.usToMs(getCurrentPositionUsInternal(this.playbackInfo));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public long getBufferedPosition() {
|
||
|
verifyApplicationThread();
|
||
|
if (isPlayingAd()) {
|
||
|
if (this.playbackInfo.loadingMediaPeriodId.equals(this.playbackInfo.periodId)) {
|
||
|
return Util.usToMs(this.playbackInfo.bufferedPositionUs);
|
||
|
}
|
||
|
return getDuration();
|
||
|
}
|
||
|
return getContentBufferedPosition();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public long getTotalBufferedDuration() {
|
||
|
verifyApplicationThread();
|
||
|
return Util.usToMs(this.playbackInfo.totalBufferedDurationUs);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public boolean isPlayingAd() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.periodId.isAd();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public int getCurrentAdGroupIndex() {
|
||
|
verifyApplicationThread();
|
||
|
if (isPlayingAd()) {
|
||
|
return this.playbackInfo.periodId.adGroupIndex;
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public int getCurrentAdIndexInAdGroup() {
|
||
|
verifyApplicationThread();
|
||
|
if (isPlayingAd()) {
|
||
|
return this.playbackInfo.periodId.adIndexInAdGroup;
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public long getContentPosition() {
|
||
|
verifyApplicationThread();
|
||
|
if (isPlayingAd()) {
|
||
|
this.playbackInfo.timeline.getPeriodByUid(this.playbackInfo.periodId.periodUid, this.period);
|
||
|
if (this.playbackInfo.requestedContentPositionUs == -9223372036854775807L) {
|
||
|
return this.playbackInfo.timeline.getWindow(getCurrentMediaItemIndex(), this.window).getDefaultPositionMs();
|
||
|
}
|
||
|
return this.period.getPositionInWindowMs() + Util.usToMs(this.playbackInfo.requestedContentPositionUs);
|
||
|
}
|
||
|
return getCurrentPosition();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public long getContentBufferedPosition() {
|
||
|
verifyApplicationThread();
|
||
|
if (this.playbackInfo.timeline.isEmpty()) {
|
||
|
return this.maskingWindowPositionMs;
|
||
|
}
|
||
|
if (this.playbackInfo.loadingMediaPeriodId.windowSequenceNumber != this.playbackInfo.periodId.windowSequenceNumber) {
|
||
|
return this.playbackInfo.timeline.getWindow(getCurrentMediaItemIndex(), this.window).getDurationMs();
|
||
|
}
|
||
|
long j = this.playbackInfo.bufferedPositionUs;
|
||
|
if (this.playbackInfo.loadingMediaPeriodId.isAd()) {
|
||
|
Timeline.Period periodByUid = this.playbackInfo.timeline.getPeriodByUid(this.playbackInfo.loadingMediaPeriodId.periodUid, this.period);
|
||
|
long adGroupTimeUs = periodByUid.getAdGroupTimeUs(this.playbackInfo.loadingMediaPeriodId.adGroupIndex);
|
||
|
j = adGroupTimeUs == Long.MIN_VALUE ? periodByUid.durationUs : adGroupTimeUs;
|
||
|
}
|
||
|
return Util.usToMs(periodPositionUsToWindowPositionUs(this.playbackInfo.timeline, this.playbackInfo.loadingMediaPeriodId, j));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public int getRendererCount() {
|
||
|
verifyApplicationThread();
|
||
|
return this.renderers.length;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public int getRendererType(int i) {
|
||
|
verifyApplicationThread();
|
||
|
return this.renderers[i].getTrackType();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public Renderer getRenderer(int i) {
|
||
|
verifyApplicationThread();
|
||
|
return this.renderers[i];
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public TrackSelector getTrackSelector() {
|
||
|
verifyApplicationThread();
|
||
|
return this.trackSelector;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public TrackGroupArray getCurrentTrackGroups() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.trackGroups;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public TrackSelectionArray getCurrentTrackSelections() {
|
||
|
verifyApplicationThread();
|
||
|
return new TrackSelectionArray(this.playbackInfo.trackSelectorResult.selections);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public Tracks getCurrentTracks() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.trackSelectorResult.tracks;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public TrackSelectionParameters getTrackSelectionParameters() {
|
||
|
verifyApplicationThread();
|
||
|
return this.trackSelector.getParameters();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void setTrackSelectionParameters(final TrackSelectionParameters trackSelectionParameters) {
|
||
|
verifyApplicationThread();
|
||
|
if (!this.trackSelector.isSetParametersSupported() || trackSelectionParameters.equals(this.trackSelector.getParameters())) {
|
||
|
return;
|
||
|
}
|
||
|
this.trackSelector.setParameters(trackSelectionParameters);
|
||
|
this.listeners.sendEvent(19, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda3
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onTrackSelectionParametersChanged(TrackSelectionParameters.this);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public MediaMetadata getMediaMetadata() {
|
||
|
verifyApplicationThread();
|
||
|
return this.mediaMetadata;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public MediaMetadata getPlaylistMetadata() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playlistMetadata;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void setPlaylistMetadata(MediaMetadata mediaMetadata) {
|
||
|
verifyApplicationThread();
|
||
|
Assertions.checkNotNull(mediaMetadata);
|
||
|
if (mediaMetadata.equals(this.playlistMetadata)) {
|
||
|
return;
|
||
|
}
|
||
|
this.playlistMetadata = mediaMetadata;
|
||
|
this.listeners.sendEvent(15, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda26
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
ExoPlayerImpl.this.m5373xadc0e460((Player.Listener) obj);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$setPlaylistMetadata$7$com-google-android-exoplayer2-ExoPlayerImpl, reason: not valid java name */
|
||
|
public /* synthetic */ void m5373xadc0e460(Player.Listener listener) {
|
||
|
listener.onPlaylistMetadataChanged(this.playlistMetadata);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public Timeline getCurrentTimeline() {
|
||
|
verifyApplicationThread();
|
||
|
return this.playbackInfo.timeline;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void setVideoScalingMode(int i) {
|
||
|
verifyApplicationThread();
|
||
|
this.videoScalingMode = i;
|
||
|
sendRendererMessage(2, 4, Integer.valueOf(i));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public int getVideoScalingMode() {
|
||
|
verifyApplicationThread();
|
||
|
return this.videoScalingMode;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void setVideoChangeFrameRateStrategy(int i) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.videoChangeFrameRateStrategy == i) {
|
||
|
return;
|
||
|
}
|
||
|
this.videoChangeFrameRateStrategy = i;
|
||
|
sendRendererMessage(2, 5, Integer.valueOf(i));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public int getVideoChangeFrameRateStrategy() {
|
||
|
verifyApplicationThread();
|
||
|
return this.videoChangeFrameRateStrategy;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public VideoSize getVideoSize() {
|
||
|
verifyApplicationThread();
|
||
|
return this.videoSize;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public Size getSurfaceSize() {
|
||
|
verifyApplicationThread();
|
||
|
return this.surfaceSize;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void clearVideoSurface() {
|
||
|
verifyApplicationThread();
|
||
|
removeSurfaceCallbacks();
|
||
|
setVideoOutputInternal(null);
|
||
|
maybeNotifySurfaceSizeChanged(0, 0);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void clearVideoSurface(Surface surface) {
|
||
|
verifyApplicationThread();
|
||
|
if (surface == null || surface != this.videoOutput) {
|
||
|
return;
|
||
|
}
|
||
|
clearVideoSurface();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void setVideoSurface(Surface surface) {
|
||
|
verifyApplicationThread();
|
||
|
removeSurfaceCallbacks();
|
||
|
setVideoOutputInternal(surface);
|
||
|
int i = surface == null ? 0 : -1;
|
||
|
maybeNotifySurfaceSizeChanged(i, i);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void setVideoSurfaceHolder(SurfaceHolder surfaceHolder) {
|
||
|
verifyApplicationThread();
|
||
|
if (surfaceHolder == null) {
|
||
|
clearVideoSurface();
|
||
|
return;
|
||
|
}
|
||
|
removeSurfaceCallbacks();
|
||
|
this.surfaceHolderSurfaceIsVideoOutput = true;
|
||
|
this.surfaceHolder = surfaceHolder;
|
||
|
surfaceHolder.addCallback(this.componentListener);
|
||
|
Surface surface = surfaceHolder.getSurface();
|
||
|
if (surface != null && surface.isValid()) {
|
||
|
setVideoOutputInternal(surface);
|
||
|
Rect surfaceFrame = surfaceHolder.getSurfaceFrame();
|
||
|
maybeNotifySurfaceSizeChanged(surfaceFrame.width(), surfaceFrame.height());
|
||
|
} else {
|
||
|
setVideoOutputInternal(null);
|
||
|
maybeNotifySurfaceSizeChanged(0, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void clearVideoSurfaceHolder(SurfaceHolder surfaceHolder) {
|
||
|
verifyApplicationThread();
|
||
|
if (surfaceHolder == null || surfaceHolder != this.surfaceHolder) {
|
||
|
return;
|
||
|
}
|
||
|
clearVideoSurface();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void setVideoSurfaceView(SurfaceView surfaceView) {
|
||
|
verifyApplicationThread();
|
||
|
if (surfaceView instanceof VideoDecoderOutputBufferRenderer) {
|
||
|
removeSurfaceCallbacks();
|
||
|
setVideoOutputInternal(surfaceView);
|
||
|
setNonVideoOutputSurfaceHolderInternal(surfaceView.getHolder());
|
||
|
} else {
|
||
|
if (surfaceView instanceof SphericalGLSurfaceView) {
|
||
|
removeSurfaceCallbacks();
|
||
|
this.sphericalGLSurfaceView = (SphericalGLSurfaceView) surfaceView;
|
||
|
createMessageInternal(this.frameMetadataListener).setType(10000).setPayload(this.sphericalGLSurfaceView).send();
|
||
|
this.sphericalGLSurfaceView.addVideoSurfaceListener(this.componentListener);
|
||
|
setVideoOutputInternal(this.sphericalGLSurfaceView.getVideoSurface());
|
||
|
setNonVideoOutputSurfaceHolderInternal(surfaceView.getHolder());
|
||
|
return;
|
||
|
}
|
||
|
setVideoSurfaceHolder(surfaceView == null ? null : surfaceView.getHolder());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void clearVideoSurfaceView(SurfaceView surfaceView) {
|
||
|
verifyApplicationThread();
|
||
|
clearVideoSurfaceHolder(surfaceView == null ? null : surfaceView.getHolder());
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void setVideoTextureView(TextureView textureView) {
|
||
|
verifyApplicationThread();
|
||
|
if (textureView == null) {
|
||
|
clearVideoSurface();
|
||
|
return;
|
||
|
}
|
||
|
removeSurfaceCallbacks();
|
||
|
this.textureView = textureView;
|
||
|
if (textureView.getSurfaceTextureListener() != null) {
|
||
|
Log.w(TAG, "Replacing existing SurfaceTextureListener.");
|
||
|
}
|
||
|
textureView.setSurfaceTextureListener(this.componentListener);
|
||
|
SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null;
|
||
|
if (surfaceTexture == null) {
|
||
|
setVideoOutputInternal(null);
|
||
|
maybeNotifySurfaceSizeChanged(0, 0);
|
||
|
} else {
|
||
|
setSurfaceTextureInternal(surfaceTexture);
|
||
|
maybeNotifySurfaceSizeChanged(textureView.getWidth(), textureView.getHeight());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void clearVideoTextureView(TextureView textureView) {
|
||
|
verifyApplicationThread();
|
||
|
if (textureView == null || textureView != this.textureView) {
|
||
|
return;
|
||
|
}
|
||
|
clearVideoSurface();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.AudioComponent
|
||
|
public void setAudioAttributes(final AudioAttributes audioAttributes, boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.playerReleased) {
|
||
|
return;
|
||
|
}
|
||
|
if (!Util.areEqual(this.audioAttributes, audioAttributes)) {
|
||
|
this.audioAttributes = audioAttributes;
|
||
|
sendRendererMessage(1, 3, audioAttributes);
|
||
|
this.streamVolumeManager.setStreamType(Util.getStreamTypeForAudioUsage(audioAttributes.usage));
|
||
|
this.listeners.queueEvent(20, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda23
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onAudioAttributesChanged(AudioAttributes.this);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
this.audioFocusManager.setAudioAttributes(z ? audioAttributes : null);
|
||
|
this.trackSelector.setAudioAttributes(audioAttributes);
|
||
|
boolean playWhenReady = getPlayWhenReady();
|
||
|
int updateAudioFocus = this.audioFocusManager.updateAudioFocus(playWhenReady, getPlaybackState());
|
||
|
updatePlayWhenReady(playWhenReady, updateAudioFocus, getPlayWhenReadyChangeReason(playWhenReady, updateAudioFocus));
|
||
|
this.listeners.flushEvents();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.AudioComponent
|
||
|
public AudioAttributes getAudioAttributes() {
|
||
|
verifyApplicationThread();
|
||
|
return this.audioAttributes;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.AudioComponent
|
||
|
public void setAudioSessionId(final int i) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.audioSessionId == i) {
|
||
|
return;
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
if (Util.SDK_INT < 21) {
|
||
|
i = initializeKeepSessionIdAudioTrack(0);
|
||
|
} else {
|
||
|
i = Util.generateAudioSessionIdV21(this.applicationContext);
|
||
|
}
|
||
|
} else if (Util.SDK_INT < 21) {
|
||
|
initializeKeepSessionIdAudioTrack(i);
|
||
|
}
|
||
|
this.audioSessionId = i;
|
||
|
sendRendererMessage(1, 10, Integer.valueOf(i));
|
||
|
sendRendererMessage(2, 10, Integer.valueOf(i));
|
||
|
this.listeners.sendEvent(21, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda25
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onAudioSessionIdChanged(i);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.AudioComponent
|
||
|
public int getAudioSessionId() {
|
||
|
verifyApplicationThread();
|
||
|
return this.audioSessionId;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.AudioComponent
|
||
|
public void setAuxEffectInfo(AuxEffectInfo auxEffectInfo) {
|
||
|
verifyApplicationThread();
|
||
|
sendRendererMessage(1, 6, auxEffectInfo);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.AudioComponent
|
||
|
public void clearAuxEffectInfo() {
|
||
|
verifyApplicationThread();
|
||
|
setAuxEffectInfo(new AuxEffectInfo(0, 0.0f));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setPreferredAudioDevice(AudioDeviceInfo audioDeviceInfo) {
|
||
|
verifyApplicationThread();
|
||
|
sendRendererMessage(1, 12, audioDeviceInfo);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.AudioComponent
|
||
|
public void setVolume(float f) {
|
||
|
verifyApplicationThread();
|
||
|
final float constrainValue = Util.constrainValue(f, 0.0f, 1.0f);
|
||
|
if (this.volume == constrainValue) {
|
||
|
return;
|
||
|
}
|
||
|
this.volume = constrainValue;
|
||
|
sendVolumeToRenderers();
|
||
|
this.listeners.sendEvent(22, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda1
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onVolumeChanged(constrainValue);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.AudioComponent
|
||
|
public float getVolume() {
|
||
|
verifyApplicationThread();
|
||
|
return this.volume;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.AudioComponent
|
||
|
public boolean getSkipSilenceEnabled() {
|
||
|
verifyApplicationThread();
|
||
|
return this.skipSilenceEnabled;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.AudioComponent
|
||
|
public void setSkipSilenceEnabled(final boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.skipSilenceEnabled == z) {
|
||
|
return;
|
||
|
}
|
||
|
this.skipSilenceEnabled = z;
|
||
|
sendRendererMessage(1, 9, Boolean.valueOf(z));
|
||
|
this.listeners.sendEvent(23, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda22
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onSkipSilenceEnabledChanged(z);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public AnalyticsCollector getAnalyticsCollector() {
|
||
|
verifyApplicationThread();
|
||
|
return this.analyticsCollector;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void addAnalyticsListener(AnalyticsListener analyticsListener) {
|
||
|
this.analyticsCollector.addListener((AnalyticsListener) Assertions.checkNotNull(analyticsListener));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void removeAnalyticsListener(AnalyticsListener analyticsListener) {
|
||
|
verifyApplicationThread();
|
||
|
this.analyticsCollector.removeListener((AnalyticsListener) Assertions.checkNotNull(analyticsListener));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setHandleAudioBecomingNoisy(boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.playerReleased) {
|
||
|
return;
|
||
|
}
|
||
|
this.audioBecomingNoisyManager.setEnabled(z);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setPriorityTaskManager(PriorityTaskManager priorityTaskManager) {
|
||
|
verifyApplicationThread();
|
||
|
if (Util.areEqual(this.priorityTaskManager, priorityTaskManager)) {
|
||
|
return;
|
||
|
}
|
||
|
if (this.isPriorityTaskManagerRegistered) {
|
||
|
((PriorityTaskManager) Assertions.checkNotNull(this.priorityTaskManager)).remove(0);
|
||
|
}
|
||
|
if (priorityTaskManager == null || !isLoading()) {
|
||
|
this.isPriorityTaskManagerRegistered = false;
|
||
|
} else {
|
||
|
priorityTaskManager.add(0);
|
||
|
this.isPriorityTaskManagerRegistered = true;
|
||
|
}
|
||
|
this.priorityTaskManager = priorityTaskManager;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public Format getVideoFormat() {
|
||
|
verifyApplicationThread();
|
||
|
return this.videoFormat;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public Format getAudioFormat() {
|
||
|
verifyApplicationThread();
|
||
|
return this.audioFormat;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public DecoderCounters getVideoDecoderCounters() {
|
||
|
verifyApplicationThread();
|
||
|
return this.videoDecoderCounters;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public DecoderCounters getAudioDecoderCounters() {
|
||
|
verifyApplicationThread();
|
||
|
return this.audioDecoderCounters;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void setVideoFrameMetadataListener(VideoFrameMetadataListener videoFrameMetadataListener) {
|
||
|
verifyApplicationThread();
|
||
|
this.videoFrameMetadataListener = videoFrameMetadataListener;
|
||
|
createMessageInternal(this.frameMetadataListener).setType(7).setPayload(videoFrameMetadataListener).send();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void clearVideoFrameMetadataListener(VideoFrameMetadataListener videoFrameMetadataListener) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.videoFrameMetadataListener != videoFrameMetadataListener) {
|
||
|
return;
|
||
|
}
|
||
|
createMessageInternal(this.frameMetadataListener).setType(7).setPayload(null).send();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void setCameraMotionListener(CameraMotionListener cameraMotionListener) {
|
||
|
verifyApplicationThread();
|
||
|
this.cameraMotionListener = cameraMotionListener;
|
||
|
createMessageInternal(this.frameMetadataListener).setType(8).setPayload(cameraMotionListener).send();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer, com.google.android.exoplayer2.ExoPlayer.VideoComponent
|
||
|
public void clearCameraMotionListener(CameraMotionListener cameraMotionListener) {
|
||
|
verifyApplicationThread();
|
||
|
if (this.cameraMotionListener != cameraMotionListener) {
|
||
|
return;
|
||
|
}
|
||
|
createMessageInternal(this.frameMetadataListener).setType(8).setPayload(null).send();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.TextComponent
|
||
|
public CueGroup getCurrentCues() {
|
||
|
verifyApplicationThread();
|
||
|
return this.currentCueGroup;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void addListener(Player.Listener listener) {
|
||
|
this.listeners.add((Player.Listener) Assertions.checkNotNull(listener));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player
|
||
|
public void removeListener(Player.Listener listener) {
|
||
|
verifyApplicationThread();
|
||
|
this.listeners.remove((Player.Listener) Assertions.checkNotNull(listener));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setHandleWakeLock(boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
setWakeMode(z ? 1 : 0);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public void setWakeMode(int i) {
|
||
|
verifyApplicationThread();
|
||
|
if (i == 0) {
|
||
|
this.wakeLockManager.setEnabled(false);
|
||
|
this.wifiLockManager.setEnabled(false);
|
||
|
} else if (i == 1) {
|
||
|
this.wakeLockManager.setEnabled(true);
|
||
|
this.wifiLockManager.setEnabled(false);
|
||
|
} else {
|
||
|
if (i != 2) {
|
||
|
return;
|
||
|
}
|
||
|
this.wakeLockManager.setEnabled(true);
|
||
|
this.wifiLockManager.setEnabled(true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.DeviceComponent
|
||
|
public DeviceInfo getDeviceInfo() {
|
||
|
verifyApplicationThread();
|
||
|
return this.deviceInfo;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.DeviceComponent
|
||
|
public int getDeviceVolume() {
|
||
|
verifyApplicationThread();
|
||
|
return this.streamVolumeManager.getVolume();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.DeviceComponent
|
||
|
public boolean isDeviceMuted() {
|
||
|
verifyApplicationThread();
|
||
|
return this.streamVolumeManager.isMuted();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.DeviceComponent
|
||
|
public void setDeviceVolume(int i) {
|
||
|
verifyApplicationThread();
|
||
|
this.streamVolumeManager.setVolume(i);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.DeviceComponent
|
||
|
public void increaseDeviceVolume() {
|
||
|
verifyApplicationThread();
|
||
|
this.streamVolumeManager.increaseVolume();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.DeviceComponent
|
||
|
public void decreaseDeviceVolume() {
|
||
|
verifyApplicationThread();
|
||
|
this.streamVolumeManager.decreaseVolume();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.Player, com.google.android.exoplayer2.ExoPlayer.DeviceComponent
|
||
|
public void setDeviceMuted(boolean z) {
|
||
|
verifyApplicationThread();
|
||
|
this.streamVolumeManager.setMuted(z);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer
|
||
|
public boolean isTunnelingEnabled() {
|
||
|
verifyApplicationThread();
|
||
|
for (RendererConfiguration rendererConfiguration : this.playbackInfo.trackSelectorResult.rendererConfigurations) {
|
||
|
if (rendererConfiguration != null && rendererConfiguration.tunneling) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public void setThrowsWhenUsingWrongThread(boolean z) {
|
||
|
this.throwsWhenUsingWrongThread = z;
|
||
|
this.listeners.setThrowsWhenUsingWrongThread(z);
|
||
|
AnalyticsCollector analyticsCollector = this.analyticsCollector;
|
||
|
if (analyticsCollector instanceof DefaultAnalyticsCollector) {
|
||
|
((DefaultAnalyticsCollector) analyticsCollector).setThrowsWhenUsingWrongThread(z);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void stopInternal(boolean z, ExoPlaybackException exoPlaybackException) {
|
||
|
PlaybackInfo copyWithLoadingMediaPeriodId;
|
||
|
if (z) {
|
||
|
copyWithLoadingMediaPeriodId = removeMediaItemsInternal(0, this.mediaSourceHolderSnapshots.size()).copyWithPlaybackError(null);
|
||
|
} else {
|
||
|
PlaybackInfo playbackInfo = this.playbackInfo;
|
||
|
copyWithLoadingMediaPeriodId = playbackInfo.copyWithLoadingMediaPeriodId(playbackInfo.periodId);
|
||
|
copyWithLoadingMediaPeriodId.bufferedPositionUs = copyWithLoadingMediaPeriodId.positionUs;
|
||
|
copyWithLoadingMediaPeriodId.totalBufferedDurationUs = 0L;
|
||
|
}
|
||
|
PlaybackInfo copyWithPlaybackState = copyWithLoadingMediaPeriodId.copyWithPlaybackState(1);
|
||
|
if (exoPlaybackException != null) {
|
||
|
copyWithPlaybackState = copyWithPlaybackState.copyWithPlaybackError(exoPlaybackException);
|
||
|
}
|
||
|
PlaybackInfo playbackInfo2 = copyWithPlaybackState;
|
||
|
this.pendingOperationAcks++;
|
||
|
this.internalPlayer.stop();
|
||
|
updatePlaybackInfo(playbackInfo2, 0, 1, false, playbackInfo2.timeline.isEmpty() && !this.playbackInfo.timeline.isEmpty(), 4, getCurrentPositionUsInternal(playbackInfo2), -1, false);
|
||
|
}
|
||
|
|
||
|
private int getCurrentWindowIndexInternal() {
|
||
|
return this.playbackInfo.timeline.isEmpty() ? this.maskingWindowIndex : this.playbackInfo.timeline.getPeriodByUid(this.playbackInfo.periodId.periodUid, this.period).windowIndex;
|
||
|
}
|
||
|
|
||
|
private long getCurrentPositionUsInternal(PlaybackInfo playbackInfo) {
|
||
|
if (playbackInfo.timeline.isEmpty()) {
|
||
|
return Util.msToUs(this.maskingWindowPositionMs);
|
||
|
}
|
||
|
if (playbackInfo.periodId.isAd()) {
|
||
|
return playbackInfo.positionUs;
|
||
|
}
|
||
|
return periodPositionUsToWindowPositionUs(playbackInfo.timeline, playbackInfo.periodId, playbackInfo.positionUs);
|
||
|
}
|
||
|
|
||
|
private List<MediaSource> createMediaSources(List<MediaItem> list) {
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
for (int i = 0; i < list.size(); i++) {
|
||
|
arrayList.add(this.mediaSourceFactory.createMediaSource(list.get(i)));
|
||
|
}
|
||
|
return arrayList;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
/* renamed from: handlePlaybackInfo, reason: merged with bridge method [inline-methods] */
|
||
|
public void m5371lambda$new$1$comgoogleandroidexoplayer2ExoPlayerImpl(ExoPlayerImplInternal.PlaybackInfoUpdate playbackInfoUpdate) {
|
||
|
long j;
|
||
|
boolean z;
|
||
|
this.pendingOperationAcks -= playbackInfoUpdate.operationAcks;
|
||
|
boolean z2 = true;
|
||
|
if (playbackInfoUpdate.positionDiscontinuity) {
|
||
|
this.pendingDiscontinuityReason = playbackInfoUpdate.discontinuityReason;
|
||
|
this.pendingDiscontinuity = true;
|
||
|
}
|
||
|
if (playbackInfoUpdate.hasPlayWhenReadyChangeReason) {
|
||
|
this.pendingPlayWhenReadyChangeReason = playbackInfoUpdate.playWhenReadyChangeReason;
|
||
|
}
|
||
|
if (this.pendingOperationAcks == 0) {
|
||
|
Timeline timeline = playbackInfoUpdate.playbackInfo.timeline;
|
||
|
if (!this.playbackInfo.timeline.isEmpty() && timeline.isEmpty()) {
|
||
|
this.maskingWindowIndex = -1;
|
||
|
this.maskingWindowPositionMs = 0L;
|
||
|
this.maskingPeriodIndex = 0;
|
||
|
}
|
||
|
if (!timeline.isEmpty()) {
|
||
|
List<Timeline> childTimelines = ((PlaylistTimeline) timeline).getChildTimelines();
|
||
|
Assertions.checkState(childTimelines.size() == this.mediaSourceHolderSnapshots.size());
|
||
|
for (int i = 0; i < childTimelines.size(); i++) {
|
||
|
this.mediaSourceHolderSnapshots.get(i).timeline = childTimelines.get(i);
|
||
|
}
|
||
|
}
|
||
|
long j2 = -9223372036854775807L;
|
||
|
if (this.pendingDiscontinuity) {
|
||
|
if (playbackInfoUpdate.playbackInfo.periodId.equals(this.playbackInfo.periodId) && playbackInfoUpdate.playbackInfo.discontinuityStartPositionUs == this.playbackInfo.positionUs) {
|
||
|
z2 = false;
|
||
|
}
|
||
|
if (z2) {
|
||
|
if (timeline.isEmpty() || playbackInfoUpdate.playbackInfo.periodId.isAd()) {
|
||
|
j2 = playbackInfoUpdate.playbackInfo.discontinuityStartPositionUs;
|
||
|
} else {
|
||
|
j2 = periodPositionUsToWindowPositionUs(timeline, playbackInfoUpdate.playbackInfo.periodId, playbackInfoUpdate.playbackInfo.discontinuityStartPositionUs);
|
||
|
}
|
||
|
}
|
||
|
j = j2;
|
||
|
z = z2;
|
||
|
} else {
|
||
|
j = -9223372036854775807L;
|
||
|
z = false;
|
||
|
}
|
||
|
this.pendingDiscontinuity = false;
|
||
|
updatePlaybackInfo(playbackInfoUpdate.playbackInfo, 1, this.pendingPlayWhenReadyChangeReason, false, z, this.pendingDiscontinuityReason, j, -1, false);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void updatePlaybackInfo(final PlaybackInfo playbackInfo, final int i, final int i2, boolean z, boolean z2, final int i3, long j, int i4, boolean z3) {
|
||
|
PlaybackInfo playbackInfo2 = this.playbackInfo;
|
||
|
this.playbackInfo = playbackInfo;
|
||
|
boolean z4 = !playbackInfo2.timeline.equals(playbackInfo.timeline);
|
||
|
Pair<Boolean, Integer> evaluateMediaItemTransitionReason = evaluateMediaItemTransitionReason(playbackInfo, playbackInfo2, z2, i3, z4, z3);
|
||
|
boolean booleanValue = ((Boolean) evaluateMediaItemTransitionReason.first).booleanValue();
|
||
|
final int intValue = ((Integer) evaluateMediaItemTransitionReason.second).intValue();
|
||
|
MediaMetadata mediaMetadata = this.mediaMetadata;
|
||
|
if (booleanValue) {
|
||
|
r3 = playbackInfo.timeline.isEmpty() ? null : playbackInfo.timeline.getWindow(playbackInfo.timeline.getPeriodByUid(playbackInfo.periodId.periodUid, this.period).windowIndex, this.window).mediaItem;
|
||
|
this.staticAndDynamicMediaMetadata = MediaMetadata.EMPTY;
|
||
|
}
|
||
|
if (booleanValue || !playbackInfo2.staticMetadata.equals(playbackInfo.staticMetadata)) {
|
||
|
this.staticAndDynamicMediaMetadata = this.staticAndDynamicMediaMetadata.buildUpon().populateFromMetadata(playbackInfo.staticMetadata).build();
|
||
|
mediaMetadata = buildUpdatedMediaMetadata();
|
||
|
}
|
||
|
boolean z5 = !mediaMetadata.equals(this.mediaMetadata);
|
||
|
this.mediaMetadata = mediaMetadata;
|
||
|
boolean z6 = playbackInfo2.playWhenReady != playbackInfo.playWhenReady;
|
||
|
boolean z7 = playbackInfo2.playbackState != playbackInfo.playbackState;
|
||
|
if (z7 || z6) {
|
||
|
updateWakeAndWifiLock();
|
||
|
}
|
||
|
boolean z8 = playbackInfo2.isLoading != playbackInfo.isLoading;
|
||
|
if (z8) {
|
||
|
updatePriorityTaskManagerForIsLoadingChange(playbackInfo.isLoading);
|
||
|
}
|
||
|
if (z4) {
|
||
|
this.listeners.queueEvent(0, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda5
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
Player.Listener listener = (Player.Listener) obj;
|
||
|
listener.onTimelineChanged(PlaybackInfo.this.timeline, i);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (z2) {
|
||
|
final Player.PositionInfo previousPositionInfo = getPreviousPositionInfo(i3, playbackInfo2, i4);
|
||
|
final Player.PositionInfo positionInfo = getPositionInfo(j);
|
||
|
this.listeners.queueEvent(11, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda12
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
ExoPlayerImpl.lambda$updatePlaybackInfo$13(i3, previousPositionInfo, positionInfo, (Player.Listener) obj);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (booleanValue) {
|
||
|
this.listeners.queueEvent(1, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda13
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onMediaItemTransition(MediaItem.this, intValue);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (playbackInfo2.playbackError != playbackInfo.playbackError) {
|
||
|
this.listeners.queueEvent(10, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda14
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onPlayerErrorChanged(PlaybackInfo.this.playbackError);
|
||
|
}
|
||
|
});
|
||
|
if (playbackInfo.playbackError != null) {
|
||
|
this.listeners.queueEvent(10, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda15
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onPlayerError(PlaybackInfo.this.playbackError);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
if (playbackInfo2.trackSelectorResult != playbackInfo.trackSelectorResult) {
|
||
|
this.trackSelector.onSelectionActivated(playbackInfo.trackSelectorResult.info);
|
||
|
this.listeners.queueEvent(2, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda16
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onTracksChanged(PlaybackInfo.this.trackSelectorResult.tracks);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (z5) {
|
||
|
final MediaMetadata mediaMetadata2 = this.mediaMetadata;
|
||
|
this.listeners.queueEvent(14, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda17
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onMediaMetadataChanged(MediaMetadata.this);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (z8) {
|
||
|
this.listeners.queueEvent(3, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda18
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
ExoPlayerImpl.lambda$updatePlaybackInfo$19(PlaybackInfo.this, (Player.Listener) obj);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (z7 || z6) {
|
||
|
this.listeners.queueEvent(-1, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda19
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onPlayerStateChanged(r0.playWhenReady, PlaybackInfo.this.playbackState);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (z7) {
|
||
|
this.listeners.queueEvent(4, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda20
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onPlaybackStateChanged(PlaybackInfo.this.playbackState);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (z6) {
|
||
|
this.listeners.queueEvent(5, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda6
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
Player.Listener listener = (Player.Listener) obj;
|
||
|
listener.onPlayWhenReadyChanged(PlaybackInfo.this.playWhenReady, i2);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (playbackInfo2.playbackSuppressionReason != playbackInfo.playbackSuppressionReason) {
|
||
|
this.listeners.queueEvent(6, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda7
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onPlaybackSuppressionReasonChanged(PlaybackInfo.this.playbackSuppressionReason);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (isPlaying(playbackInfo2) != isPlaying(playbackInfo)) {
|
||
|
this.listeners.queueEvent(7, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda8
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onIsPlayingChanged(ExoPlayerImpl.isPlaying(PlaybackInfo.this));
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (!playbackInfo2.playbackParameters.equals(playbackInfo.playbackParameters)) {
|
||
|
this.listeners.queueEvent(12, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda9
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onPlaybackParametersChanged(PlaybackInfo.this.playbackParameters);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (z) {
|
||
|
this.listeners.queueEvent(-1, new ExoPlayerImpl$$ExternalSyntheticLambda10());
|
||
|
}
|
||
|
updateAvailableCommands();
|
||
|
this.listeners.flushEvents();
|
||
|
if (playbackInfo2.sleepingForOffload != playbackInfo.sleepingForOffload) {
|
||
|
Iterator<ExoPlayer.AudioOffloadListener> it = this.audioOffloadListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
it.next().onExperimentalSleepingForOffloadChanged(playbackInfo.sleepingForOffload);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static /* synthetic */ void lambda$updatePlaybackInfo$13(int i, Player.PositionInfo positionInfo, Player.PositionInfo positionInfo2, Player.Listener listener) {
|
||
|
listener.onPositionDiscontinuity(i);
|
||
|
listener.onPositionDiscontinuity(positionInfo, positionInfo2, i);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static /* synthetic */ void lambda$updatePlaybackInfo$19(PlaybackInfo playbackInfo, Player.Listener listener) {
|
||
|
listener.onLoadingChanged(playbackInfo.isLoading);
|
||
|
listener.onIsLoadingChanged(playbackInfo.isLoading);
|
||
|
}
|
||
|
|
||
|
private Player.PositionInfo getPreviousPositionInfo(int i, PlaybackInfo playbackInfo, int i2) {
|
||
|
int i3;
|
||
|
Object obj;
|
||
|
MediaItem mediaItem;
|
||
|
Object obj2;
|
||
|
int i4;
|
||
|
long j;
|
||
|
long requestedContentPositionUs;
|
||
|
Timeline.Period period = new Timeline.Period();
|
||
|
if (playbackInfo.timeline.isEmpty()) {
|
||
|
i3 = i2;
|
||
|
obj = null;
|
||
|
mediaItem = null;
|
||
|
obj2 = null;
|
||
|
i4 = -1;
|
||
|
} else {
|
||
|
Object obj3 = playbackInfo.periodId.periodUid;
|
||
|
playbackInfo.timeline.getPeriodByUid(obj3, period);
|
||
|
int i5 = period.windowIndex;
|
||
|
int indexOfPeriod = playbackInfo.timeline.getIndexOfPeriod(obj3);
|
||
|
Object obj4 = playbackInfo.timeline.getWindow(i5, this.window).uid;
|
||
|
mediaItem = this.window.mediaItem;
|
||
|
obj2 = obj3;
|
||
|
i4 = indexOfPeriod;
|
||
|
obj = obj4;
|
||
|
i3 = i5;
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
if (playbackInfo.periodId.isAd()) {
|
||
|
j = period.getAdDurationUs(playbackInfo.periodId.adGroupIndex, playbackInfo.periodId.adIndexInAdGroup);
|
||
|
requestedContentPositionUs = getRequestedContentPositionUs(playbackInfo);
|
||
|
} else {
|
||
|
if (playbackInfo.periodId.nextAdGroupIndex != -1) {
|
||
|
j = getRequestedContentPositionUs(this.playbackInfo);
|
||
|
} else {
|
||
|
j = period.positionInWindowUs + period.durationUs;
|
||
|
}
|
||
|
requestedContentPositionUs = j;
|
||
|
}
|
||
|
} else if (playbackInfo.periodId.isAd()) {
|
||
|
j = playbackInfo.positionUs;
|
||
|
requestedContentPositionUs = getRequestedContentPositionUs(playbackInfo);
|
||
|
} else {
|
||
|
j = period.positionInWindowUs + playbackInfo.positionUs;
|
||
|
requestedContentPositionUs = j;
|
||
|
}
|
||
|
return new Player.PositionInfo(obj, i3, mediaItem, obj2, i4, Util.usToMs(j), Util.usToMs(requestedContentPositionUs), playbackInfo.periodId.adGroupIndex, playbackInfo.periodId.adIndexInAdGroup);
|
||
|
}
|
||
|
|
||
|
private Player.PositionInfo getPositionInfo(long j) {
|
||
|
MediaItem mediaItem;
|
||
|
Object obj;
|
||
|
int i;
|
||
|
Object obj2;
|
||
|
int currentMediaItemIndex = getCurrentMediaItemIndex();
|
||
|
if (this.playbackInfo.timeline.isEmpty()) {
|
||
|
mediaItem = null;
|
||
|
obj = null;
|
||
|
i = -1;
|
||
|
obj2 = null;
|
||
|
} else {
|
||
|
Object obj3 = this.playbackInfo.periodId.periodUid;
|
||
|
this.playbackInfo.timeline.getPeriodByUid(obj3, this.period);
|
||
|
i = this.playbackInfo.timeline.getIndexOfPeriod(obj3);
|
||
|
obj2 = this.playbackInfo.timeline.getWindow(currentMediaItemIndex, this.window).uid;
|
||
|
mediaItem = this.window.mediaItem;
|
||
|
obj = obj3;
|
||
|
}
|
||
|
long usToMs = Util.usToMs(j);
|
||
|
return new Player.PositionInfo(obj2, currentMediaItemIndex, mediaItem, obj, i, usToMs, this.playbackInfo.periodId.isAd() ? Util.usToMs(getRequestedContentPositionUs(this.playbackInfo)) : usToMs, this.playbackInfo.periodId.adGroupIndex, this.playbackInfo.periodId.adIndexInAdGroup);
|
||
|
}
|
||
|
|
||
|
private static long getRequestedContentPositionUs(PlaybackInfo playbackInfo) {
|
||
|
Timeline.Window window = new Timeline.Window();
|
||
|
Timeline.Period period = new Timeline.Period();
|
||
|
playbackInfo.timeline.getPeriodByUid(playbackInfo.periodId.periodUid, period);
|
||
|
if (playbackInfo.requestedContentPositionUs == -9223372036854775807L) {
|
||
|
return playbackInfo.timeline.getWindow(period.windowIndex, window).getDefaultPositionUs();
|
||
|
}
|
||
|
return period.getPositionInWindowUs() + playbackInfo.requestedContentPositionUs;
|
||
|
}
|
||
|
|
||
|
private Pair<Boolean, Integer> evaluateMediaItemTransitionReason(PlaybackInfo playbackInfo, PlaybackInfo playbackInfo2, boolean z, int i, boolean z2, boolean z3) {
|
||
|
Timeline timeline = playbackInfo2.timeline;
|
||
|
Timeline timeline2 = playbackInfo.timeline;
|
||
|
if (timeline2.isEmpty() && timeline.isEmpty()) {
|
||
|
return new Pair<>(false, -1);
|
||
|
}
|
||
|
int i2 = 3;
|
||
|
if (timeline2.isEmpty() != timeline.isEmpty()) {
|
||
|
return new Pair<>(true, 3);
|
||
|
}
|
||
|
if (timeline.getWindow(timeline.getPeriodByUid(playbackInfo2.periodId.periodUid, this.period).windowIndex, this.window).uid.equals(timeline2.getWindow(timeline2.getPeriodByUid(playbackInfo.periodId.periodUid, this.period).windowIndex, this.window).uid)) {
|
||
|
if (z && i == 0 && playbackInfo2.periodId.windowSequenceNumber < playbackInfo.periodId.windowSequenceNumber) {
|
||
|
return new Pair<>(true, 0);
|
||
|
}
|
||
|
if (z && i == 1 && z3) {
|
||
|
return new Pair<>(true, 2);
|
||
|
}
|
||
|
return new Pair<>(false, -1);
|
||
|
}
|
||
|
if (z && i == 0) {
|
||
|
i2 = 1;
|
||
|
} else if (z && i == 1) {
|
||
|
i2 = 2;
|
||
|
} else if (!z2) {
|
||
|
throw new IllegalStateException();
|
||
|
}
|
||
|
return new Pair<>(true, Integer.valueOf(i2));
|
||
|
}
|
||
|
|
||
|
private void updateAvailableCommands() {
|
||
|
Player.Commands commands = this.availableCommands;
|
||
|
Player.Commands availableCommands = Util.getAvailableCommands(this.wrappingPlayer, this.permanentAvailableCommands);
|
||
|
this.availableCommands = availableCommands;
|
||
|
if (availableCommands.equals(commands)) {
|
||
|
return;
|
||
|
}
|
||
|
this.listeners.queueEvent(13, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda4
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
ExoPlayerImpl.this.m5374xf07a34c4((Player.Listener) obj);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$updateAvailableCommands$26$com-google-android-exoplayer2-ExoPlayerImpl, reason: not valid java name */
|
||
|
public /* synthetic */ void m5374xf07a34c4(Player.Listener listener) {
|
||
|
listener.onAvailableCommandsChanged(this.availableCommands);
|
||
|
}
|
||
|
|
||
|
private void setMediaSourcesInternal(List<MediaSource> list, int i, long j, boolean z) {
|
||
|
int i2 = i;
|
||
|
int currentWindowIndexInternal = getCurrentWindowIndexInternal();
|
||
|
long currentPosition = getCurrentPosition();
|
||
|
this.pendingOperationAcks++;
|
||
|
if (!this.mediaSourceHolderSnapshots.isEmpty()) {
|
||
|
removeMediaSourceHolders(0, this.mediaSourceHolderSnapshots.size());
|
||
|
}
|
||
|
List<MediaSourceList.MediaSourceHolder> addMediaSourceHolders = addMediaSourceHolders(0, list);
|
||
|
Timeline createMaskingTimeline = createMaskingTimeline();
|
||
|
if (!createMaskingTimeline.isEmpty() && i2 >= createMaskingTimeline.getWindowCount()) {
|
||
|
throw new IllegalSeekPositionException(createMaskingTimeline, i2, j);
|
||
|
}
|
||
|
long j2 = j;
|
||
|
if (z) {
|
||
|
i2 = createMaskingTimeline.getFirstWindowIndex(this.shuffleModeEnabled);
|
||
|
j2 = -9223372036854775807L;
|
||
|
} else if (i2 == -1) {
|
||
|
i2 = currentWindowIndexInternal;
|
||
|
j2 = currentPosition;
|
||
|
}
|
||
|
PlaybackInfo maskTimelineAndPosition = maskTimelineAndPosition(this.playbackInfo, createMaskingTimeline, maskWindowPositionMsOrGetPeriodPositionUs(createMaskingTimeline, i2, j2));
|
||
|
int i3 = maskTimelineAndPosition.playbackState;
|
||
|
if (i2 != -1 && maskTimelineAndPosition.playbackState != 1) {
|
||
|
i3 = (createMaskingTimeline.isEmpty() || i2 >= createMaskingTimeline.getWindowCount()) ? 4 : 2;
|
||
|
}
|
||
|
PlaybackInfo copyWithPlaybackState = maskTimelineAndPosition.copyWithPlaybackState(i3);
|
||
|
this.internalPlayer.setMediaSources(addMediaSourceHolders, i2, Util.msToUs(j2), this.shuffleOrder);
|
||
|
updatePlaybackInfo(copyWithPlaybackState, 0, 1, false, (this.playbackInfo.periodId.periodUid.equals(copyWithPlaybackState.periodId.periodUid) || this.playbackInfo.timeline.isEmpty()) ? false : true, 4, getCurrentPositionUsInternal(copyWithPlaybackState), -1, false);
|
||
|
}
|
||
|
|
||
|
private List<MediaSourceList.MediaSourceHolder> addMediaSourceHolders(int i, List<MediaSource> list) {
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
for (int i2 = 0; i2 < list.size(); i2++) {
|
||
|
MediaSourceList.MediaSourceHolder mediaSourceHolder = new MediaSourceList.MediaSourceHolder(list.get(i2), this.useLazyPreparation);
|
||
|
arrayList.add(mediaSourceHolder);
|
||
|
this.mediaSourceHolderSnapshots.add(i2 + i, new MediaSourceHolderSnapshot(mediaSourceHolder.uid, mediaSourceHolder.mediaSource.getTimeline()));
|
||
|
}
|
||
|
this.shuffleOrder = this.shuffleOrder.cloneAndInsert(i, arrayList.size());
|
||
|
return arrayList;
|
||
|
}
|
||
|
|
||
|
private PlaybackInfo removeMediaItemsInternal(int i, int i2) {
|
||
|
int currentMediaItemIndex = getCurrentMediaItemIndex();
|
||
|
Timeline currentTimeline = getCurrentTimeline();
|
||
|
int size = this.mediaSourceHolderSnapshots.size();
|
||
|
this.pendingOperationAcks++;
|
||
|
removeMediaSourceHolders(i, i2);
|
||
|
Timeline createMaskingTimeline = createMaskingTimeline();
|
||
|
PlaybackInfo maskTimelineAndPosition = maskTimelineAndPosition(this.playbackInfo, createMaskingTimeline, getPeriodPositionUsAfterTimelineChanged(currentTimeline, createMaskingTimeline));
|
||
|
if (maskTimelineAndPosition.playbackState != 1 && maskTimelineAndPosition.playbackState != 4 && i < i2 && i2 == size && currentMediaItemIndex >= maskTimelineAndPosition.timeline.getWindowCount()) {
|
||
|
maskTimelineAndPosition = maskTimelineAndPosition.copyWithPlaybackState(4);
|
||
|
}
|
||
|
this.internalPlayer.removeMediaSources(i, i2, this.shuffleOrder);
|
||
|
return maskTimelineAndPosition;
|
||
|
}
|
||
|
|
||
|
private void removeMediaSourceHolders(int i, int i2) {
|
||
|
for (int i3 = i2 - 1; i3 >= i; i3--) {
|
||
|
this.mediaSourceHolderSnapshots.remove(i3);
|
||
|
}
|
||
|
this.shuffleOrder = this.shuffleOrder.cloneAndRemove(i, i2);
|
||
|
}
|
||
|
|
||
|
private Timeline createMaskingTimeline() {
|
||
|
return new PlaylistTimeline(this.mediaSourceHolderSnapshots, this.shuffleOrder);
|
||
|
}
|
||
|
|
||
|
private PlaybackInfo maskTimelineAndPosition(PlaybackInfo playbackInfo, Timeline timeline, Pair<Object, Long> pair) {
|
||
|
long j;
|
||
|
Assertions.checkArgument(timeline.isEmpty() || pair != null);
|
||
|
Timeline timeline2 = playbackInfo.timeline;
|
||
|
PlaybackInfo copyWithTimeline = playbackInfo.copyWithTimeline(timeline);
|
||
|
if (timeline.isEmpty()) {
|
||
|
MediaSource.MediaPeriodId dummyPeriodForEmptyTimeline = PlaybackInfo.getDummyPeriodForEmptyTimeline();
|
||
|
long msToUs = Util.msToUs(this.maskingWindowPositionMs);
|
||
|
PlaybackInfo copyWithLoadingMediaPeriodId = copyWithTimeline.copyWithNewPosition(dummyPeriodForEmptyTimeline, msToUs, msToUs, msToUs, 0L, TrackGroupArray.EMPTY, this.emptyTrackSelectorResult, ImmutableList.of()).copyWithLoadingMediaPeriodId(dummyPeriodForEmptyTimeline);
|
||
|
copyWithLoadingMediaPeriodId.bufferedPositionUs = copyWithLoadingMediaPeriodId.positionUs;
|
||
|
return copyWithLoadingMediaPeriodId;
|
||
|
}
|
||
|
Object obj = copyWithTimeline.periodId.periodUid;
|
||
|
boolean z = !obj.equals(((Pair) Util.castNonNull(pair)).first);
|
||
|
MediaSource.MediaPeriodId mediaPeriodId = z ? new MediaSource.MediaPeriodId(pair.first) : copyWithTimeline.periodId;
|
||
|
long longValue = ((Long) pair.second).longValue();
|
||
|
long msToUs2 = Util.msToUs(getContentPosition());
|
||
|
if (!timeline2.isEmpty()) {
|
||
|
msToUs2 -= timeline2.getPeriodByUid(obj, this.period).getPositionInWindowUs();
|
||
|
}
|
||
|
if (z || longValue < msToUs2) {
|
||
|
Assertions.checkState(!mediaPeriodId.isAd());
|
||
|
PlaybackInfo copyWithLoadingMediaPeriodId2 = copyWithTimeline.copyWithNewPosition(mediaPeriodId, longValue, longValue, longValue, 0L, z ? TrackGroupArray.EMPTY : copyWithTimeline.trackGroups, z ? this.emptyTrackSelectorResult : copyWithTimeline.trackSelectorResult, z ? ImmutableList.of() : copyWithTimeline.staticMetadata).copyWithLoadingMediaPeriodId(mediaPeriodId);
|
||
|
copyWithLoadingMediaPeriodId2.bufferedPositionUs = longValue;
|
||
|
return copyWithLoadingMediaPeriodId2;
|
||
|
}
|
||
|
if (longValue == msToUs2) {
|
||
|
int indexOfPeriod = timeline.getIndexOfPeriod(copyWithTimeline.loadingMediaPeriodId.periodUid);
|
||
|
if (indexOfPeriod != -1 && timeline.getPeriod(indexOfPeriod, this.period).windowIndex == timeline.getPeriodByUid(mediaPeriodId.periodUid, this.period).windowIndex) {
|
||
|
return copyWithTimeline;
|
||
|
}
|
||
|
timeline.getPeriodByUid(mediaPeriodId.periodUid, this.period);
|
||
|
if (mediaPeriodId.isAd()) {
|
||
|
j = this.period.getAdDurationUs(mediaPeriodId.adGroupIndex, mediaPeriodId.adIndexInAdGroup);
|
||
|
} else {
|
||
|
j = this.period.durationUs;
|
||
|
}
|
||
|
PlaybackInfo copyWithLoadingMediaPeriodId3 = copyWithTimeline.copyWithNewPosition(mediaPeriodId, copyWithTimeline.positionUs, copyWithTimeline.positionUs, copyWithTimeline.discontinuityStartPositionUs, j - copyWithTimeline.positionUs, copyWithTimeline.trackGroups, copyWithTimeline.trackSelectorResult, copyWithTimeline.staticMetadata).copyWithLoadingMediaPeriodId(mediaPeriodId);
|
||
|
copyWithLoadingMediaPeriodId3.bufferedPositionUs = j;
|
||
|
return copyWithLoadingMediaPeriodId3;
|
||
|
}
|
||
|
Assertions.checkState(!mediaPeriodId.isAd());
|
||
|
long max = Math.max(0L, copyWithTimeline.totalBufferedDurationUs - (longValue - msToUs2));
|
||
|
long j2 = copyWithTimeline.bufferedPositionUs;
|
||
|
if (copyWithTimeline.loadingMediaPeriodId.equals(copyWithTimeline.periodId)) {
|
||
|
j2 = longValue + max;
|
||
|
}
|
||
|
PlaybackInfo copyWithNewPosition = copyWithTimeline.copyWithNewPosition(mediaPeriodId, longValue, longValue, longValue, max, copyWithTimeline.trackGroups, copyWithTimeline.trackSelectorResult, copyWithTimeline.staticMetadata);
|
||
|
copyWithNewPosition.bufferedPositionUs = j2;
|
||
|
return copyWithNewPosition;
|
||
|
}
|
||
|
|
||
|
private Pair<Object, Long> getPeriodPositionUsAfterTimelineChanged(Timeline timeline, Timeline timeline2) {
|
||
|
long contentPosition = getContentPosition();
|
||
|
if (timeline.isEmpty() || timeline2.isEmpty()) {
|
||
|
boolean z = !timeline.isEmpty() && timeline2.isEmpty();
|
||
|
int currentWindowIndexInternal = z ? -1 : getCurrentWindowIndexInternal();
|
||
|
if (z) {
|
||
|
contentPosition = -9223372036854775807L;
|
||
|
}
|
||
|
return maskWindowPositionMsOrGetPeriodPositionUs(timeline2, currentWindowIndexInternal, contentPosition);
|
||
|
}
|
||
|
Pair<Object, Long> periodPositionUs = timeline.getPeriodPositionUs(this.window, this.period, getCurrentMediaItemIndex(), Util.msToUs(contentPosition));
|
||
|
Object obj = ((Pair) Util.castNonNull(periodPositionUs)).first;
|
||
|
if (timeline2.getIndexOfPeriod(obj) != -1) {
|
||
|
return periodPositionUs;
|
||
|
}
|
||
|
Object resolveSubsequentPeriod = ExoPlayerImplInternal.resolveSubsequentPeriod(this.window, this.period, this.repeatMode, this.shuffleModeEnabled, obj, timeline, timeline2);
|
||
|
if (resolveSubsequentPeriod != null) {
|
||
|
timeline2.getPeriodByUid(resolveSubsequentPeriod, this.period);
|
||
|
return maskWindowPositionMsOrGetPeriodPositionUs(timeline2, this.period.windowIndex, timeline2.getWindow(this.period.windowIndex, this.window).getDefaultPositionMs());
|
||
|
}
|
||
|
return maskWindowPositionMsOrGetPeriodPositionUs(timeline2, -1, -9223372036854775807L);
|
||
|
}
|
||
|
|
||
|
private Pair<Object, Long> maskWindowPositionMsOrGetPeriodPositionUs(Timeline timeline, int i, long j) {
|
||
|
if (timeline.isEmpty()) {
|
||
|
this.maskingWindowIndex = i;
|
||
|
if (j == -9223372036854775807L) {
|
||
|
j = 0;
|
||
|
}
|
||
|
this.maskingWindowPositionMs = j;
|
||
|
this.maskingPeriodIndex = 0;
|
||
|
return null;
|
||
|
}
|
||
|
if (i == -1 || i >= timeline.getWindowCount()) {
|
||
|
i = timeline.getFirstWindowIndex(this.shuffleModeEnabled);
|
||
|
j = timeline.getWindow(i, this.window).getDefaultPositionMs();
|
||
|
}
|
||
|
return timeline.getPeriodPositionUs(this.window, this.period, i, Util.msToUs(j));
|
||
|
}
|
||
|
|
||
|
private long periodPositionUsToWindowPositionUs(Timeline timeline, MediaSource.MediaPeriodId mediaPeriodId, long j) {
|
||
|
timeline.getPeriodByUid(mediaPeriodId.periodUid, this.period);
|
||
|
return j + this.period.getPositionInWindowUs();
|
||
|
}
|
||
|
|
||
|
private PlayerMessage createMessageInternal(PlayerMessage.Target target) {
|
||
|
int currentWindowIndexInternal = getCurrentWindowIndexInternal();
|
||
|
ExoPlayerImplInternal exoPlayerImplInternal = this.internalPlayer;
|
||
|
Timeline timeline = this.playbackInfo.timeline;
|
||
|
if (currentWindowIndexInternal == -1) {
|
||
|
currentWindowIndexInternal = 0;
|
||
|
}
|
||
|
return new PlayerMessage(exoPlayerImplInternal, target, timeline, currentWindowIndexInternal, this.clock, this.internalPlayer.getPlaybackLooper());
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public MediaMetadata buildUpdatedMediaMetadata() {
|
||
|
Timeline currentTimeline = getCurrentTimeline();
|
||
|
if (currentTimeline.isEmpty()) {
|
||
|
return this.staticAndDynamicMediaMetadata;
|
||
|
}
|
||
|
return this.staticAndDynamicMediaMetadata.buildUpon().populate(currentTimeline.getWindow(getCurrentMediaItemIndex(), this.window).mediaItem.mediaMetadata).build();
|
||
|
}
|
||
|
|
||
|
private void removeSurfaceCallbacks() {
|
||
|
if (this.sphericalGLSurfaceView != null) {
|
||
|
createMessageInternal(this.frameMetadataListener).setType(10000).setPayload(null).send();
|
||
|
this.sphericalGLSurfaceView.removeVideoSurfaceListener(this.componentListener);
|
||
|
this.sphericalGLSurfaceView = null;
|
||
|
}
|
||
|
TextureView textureView = this.textureView;
|
||
|
if (textureView != null) {
|
||
|
if (textureView.getSurfaceTextureListener() != this.componentListener) {
|
||
|
Log.w(TAG, "SurfaceTextureListener already unset or replaced.");
|
||
|
} else {
|
||
|
this.textureView.setSurfaceTextureListener(null);
|
||
|
}
|
||
|
this.textureView = null;
|
||
|
}
|
||
|
SurfaceHolder surfaceHolder = this.surfaceHolder;
|
||
|
if (surfaceHolder != null) {
|
||
|
surfaceHolder.removeCallback(this.componentListener);
|
||
|
this.surfaceHolder = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void setSurfaceTextureInternal(SurfaceTexture surfaceTexture) {
|
||
|
Surface surface = new Surface(surfaceTexture);
|
||
|
setVideoOutputInternal(surface);
|
||
|
this.ownedSurface = surface;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void setVideoOutputInternal(Object obj) {
|
||
|
boolean z;
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
Renderer[] rendererArr = this.renderers;
|
||
|
int length = rendererArr.length;
|
||
|
int i = 0;
|
||
|
while (true) {
|
||
|
z = true;
|
||
|
if (i >= length) {
|
||
|
break;
|
||
|
}
|
||
|
Renderer renderer = rendererArr[i];
|
||
|
if (renderer.getTrackType() == 2) {
|
||
|
arrayList.add(createMessageInternal(renderer).setType(1).setPayload(obj).send());
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
Object obj2 = this.videoOutput;
|
||
|
if (obj2 == null || obj2 == obj) {
|
||
|
z = false;
|
||
|
} else {
|
||
|
try {
|
||
|
Iterator it = arrayList.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
((PlayerMessage) it.next()).blockUntilDelivered(this.detachSurfaceTimeoutMs);
|
||
|
}
|
||
|
} catch (InterruptedException unused) {
|
||
|
Thread.currentThread().interrupt();
|
||
|
} catch (TimeoutException unused2) {
|
||
|
}
|
||
|
z = false;
|
||
|
Object obj3 = this.videoOutput;
|
||
|
Surface surface = this.ownedSurface;
|
||
|
if (obj3 == surface) {
|
||
|
surface.release();
|
||
|
this.ownedSurface = null;
|
||
|
}
|
||
|
}
|
||
|
this.videoOutput = obj;
|
||
|
if (z) {
|
||
|
stopInternal(false, ExoPlaybackException.createForUnexpected(new ExoTimeoutException(3), 1003));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void setNonVideoOutputSurfaceHolderInternal(SurfaceHolder surfaceHolder) {
|
||
|
this.surfaceHolderSurfaceIsVideoOutput = false;
|
||
|
this.surfaceHolder = surfaceHolder;
|
||
|
surfaceHolder.addCallback(this.componentListener);
|
||
|
Surface surface = this.surfaceHolder.getSurface();
|
||
|
if (surface != null && surface.isValid()) {
|
||
|
Rect surfaceFrame = this.surfaceHolder.getSurfaceFrame();
|
||
|
maybeNotifySurfaceSizeChanged(surfaceFrame.width(), surfaceFrame.height());
|
||
|
} else {
|
||
|
maybeNotifySurfaceSizeChanged(0, 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void maybeNotifySurfaceSizeChanged(final int i, final int i2) {
|
||
|
if (i == this.surfaceSize.getWidth() && i2 == this.surfaceSize.getHeight()) {
|
||
|
return;
|
||
|
}
|
||
|
this.surfaceSize = new Size(i, i2);
|
||
|
this.listeners.sendEvent(24, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$$ExternalSyntheticLambda0
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onSurfaceSizeChanged(i, i2);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void sendVolumeToRenderers() {
|
||
|
sendRendererMessage(1, 2, Float.valueOf(this.volume * this.audioFocusManager.getVolumeMultiplier()));
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void updatePlayWhenReady(boolean z, int i, int i2) {
|
||
|
int i3 = 0;
|
||
|
boolean z2 = z && i != -1;
|
||
|
if (z2 && i != 1) {
|
||
|
i3 = 1;
|
||
|
}
|
||
|
if (this.playbackInfo.playWhenReady == z2 && this.playbackInfo.playbackSuppressionReason == i3) {
|
||
|
return;
|
||
|
}
|
||
|
this.pendingOperationAcks++;
|
||
|
PlaybackInfo copyWithPlayWhenReady = this.playbackInfo.copyWithPlayWhenReady(z2, i3);
|
||
|
this.internalPlayer.setPlayWhenReady(z2, i3);
|
||
|
updatePlaybackInfo(copyWithPlayWhenReady, 0, i2, false, false, 5, -9223372036854775807L, -1, false);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void updateWakeAndWifiLock() {
|
||
|
int playbackState = getPlaybackState();
|
||
|
if (playbackState != 1) {
|
||
|
if (playbackState == 2 || playbackState == 3) {
|
||
|
this.wakeLockManager.setStayAwake(getPlayWhenReady() && !experimentalIsSleepingForOffload());
|
||
|
this.wifiLockManager.setStayAwake(getPlayWhenReady());
|
||
|
return;
|
||
|
} else if (playbackState != 4) {
|
||
|
throw new IllegalStateException();
|
||
|
}
|
||
|
}
|
||
|
this.wakeLockManager.setStayAwake(false);
|
||
|
this.wifiLockManager.setStayAwake(false);
|
||
|
}
|
||
|
|
||
|
private void verifyApplicationThread() {
|
||
|
this.constructorFinished.blockUninterruptible();
|
||
|
if (Thread.currentThread() != getApplicationLooper().getThread()) {
|
||
|
String formatInvariant = Util.formatInvariant("Player is accessed on the wrong thread.\nCurrent thread: '%s'\nExpected thread: '%s'\nSee https://developer.android.com/guide/topics/media/issues/player-accessed-on-wrong-thread", Thread.currentThread().getName(), getApplicationLooper().getThread().getName());
|
||
|
if (this.throwsWhenUsingWrongThread) {
|
||
|
throw new IllegalStateException(formatInvariant);
|
||
|
}
|
||
|
Log.w(TAG, formatInvariant, this.hasNotifiedFullWrongThreadWarning ? null : new IllegalStateException());
|
||
|
this.hasNotifiedFullWrongThreadWarning = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void sendRendererMessage(int i, int i2, Object obj) {
|
||
|
for (Renderer renderer : this.renderers) {
|
||
|
if (renderer.getTrackType() == i) {
|
||
|
createMessageInternal(renderer).setType(i2).setPayload(obj).send();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private int initializeKeepSessionIdAudioTrack(int i) {
|
||
|
AudioTrack audioTrack = this.keepSessionIdAudioTrack;
|
||
|
if (audioTrack != null && audioTrack.getAudioSessionId() != i) {
|
||
|
this.keepSessionIdAudioTrack.release();
|
||
|
this.keepSessionIdAudioTrack = null;
|
||
|
}
|
||
|
if (this.keepSessionIdAudioTrack == null) {
|
||
|
this.keepSessionIdAudioTrack = new AudioTrack(3, 4000, 4, 2, 2, 0, i);
|
||
|
}
|
||
|
return this.keepSessionIdAudioTrack.getAudioSessionId();
|
||
|
}
|
||
|
|
||
|
private void updatePriorityTaskManagerForIsLoadingChange(boolean z) {
|
||
|
PriorityTaskManager priorityTaskManager = this.priorityTaskManager;
|
||
|
if (priorityTaskManager != null) {
|
||
|
if (z && !this.isPriorityTaskManagerRegistered) {
|
||
|
priorityTaskManager.add(0);
|
||
|
this.isPriorityTaskManagerRegistered = true;
|
||
|
} else {
|
||
|
if (z || !this.isPriorityTaskManagerRegistered) {
|
||
|
return;
|
||
|
}
|
||
|
priorityTaskManager.remove(0);
|
||
|
this.isPriorityTaskManagerRegistered = false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public static DeviceInfo createDeviceInfo(StreamVolumeManager streamVolumeManager) {
|
||
|
return new DeviceInfo(0, streamVolumeManager.getMinVolume(), streamVolumeManager.getMaxVolume());
|
||
|
}
|
||
|
|
||
|
private static boolean isPlaying(PlaybackInfo playbackInfo) {
|
||
|
return playbackInfo.playbackState == 3 && playbackInfo.playWhenReady && playbackInfo.playbackSuppressionReason == 0;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public static final class MediaSourceHolderSnapshot implements MediaSourceInfoHolder {
|
||
|
private Timeline timeline;
|
||
|
private final Object uid;
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.MediaSourceInfoHolder
|
||
|
public Timeline getTimeline() {
|
||
|
return this.timeline;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.MediaSourceInfoHolder
|
||
|
public Object getUid() {
|
||
|
return this.uid;
|
||
|
}
|
||
|
|
||
|
public MediaSourceHolderSnapshot(Object obj, Timeline timeline) {
|
||
|
this.uid = obj;
|
||
|
this.timeline = timeline;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class ComponentListener implements VideoRendererEventListener, AudioRendererEventListener, TextOutput, MetadataOutput, SurfaceHolder.Callback, TextureView.SurfaceTextureListener, SphericalGLSurfaceView.VideoSurfaceListener, AudioFocusManager.PlayerControl, AudioBecomingNoisyManager.EventListener, StreamVolumeManager.Listener, ExoPlayer.AudioOffloadListener {
|
||
|
@Override // android.view.TextureView.SurfaceTextureListener
|
||
|
public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
|
||
|
}
|
||
|
|
||
|
private ComponentListener() {
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoRendererEventListener
|
||
|
public void onVideoEnabled(DecoderCounters decoderCounters) {
|
||
|
ExoPlayerImpl.this.videoDecoderCounters = decoderCounters;
|
||
|
ExoPlayerImpl.this.analyticsCollector.onVideoEnabled(decoderCounters);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoRendererEventListener
|
||
|
public void onVideoDecoderInitialized(String str, long j, long j2) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onVideoDecoderInitialized(str, j, j2);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoRendererEventListener
|
||
|
public void onVideoInputFormatChanged(Format format, DecoderReuseEvaluation decoderReuseEvaluation) {
|
||
|
ExoPlayerImpl.this.videoFormat = format;
|
||
|
ExoPlayerImpl.this.analyticsCollector.onVideoInputFormatChanged(format, decoderReuseEvaluation);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoRendererEventListener
|
||
|
public void onDroppedFrames(int i, long j) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onDroppedFrames(i, j);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoRendererEventListener
|
||
|
public void onVideoSizeChanged(final VideoSize videoSize) {
|
||
|
ExoPlayerImpl.this.videoSize = videoSize;
|
||
|
ExoPlayerImpl.this.listeners.sendEvent(25, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$ComponentListener$$ExternalSyntheticLambda8
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onVideoSizeChanged(VideoSize.this);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoRendererEventListener
|
||
|
public void onRenderedFirstFrame(Object obj, long j) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onRenderedFirstFrame(obj, j);
|
||
|
if (ExoPlayerImpl.this.videoOutput == obj) {
|
||
|
ExoPlayerImpl.this.listeners.sendEvent(26, new ExoPlayerImpl$ComponentListener$$ExternalSyntheticLambda7());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoRendererEventListener
|
||
|
public void onVideoDecoderReleased(String str) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onVideoDecoderReleased(str);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoRendererEventListener
|
||
|
public void onVideoDisabled(DecoderCounters decoderCounters) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onVideoDisabled(decoderCounters);
|
||
|
ExoPlayerImpl.this.videoFormat = null;
|
||
|
ExoPlayerImpl.this.videoDecoderCounters = null;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoRendererEventListener
|
||
|
public void onVideoFrameProcessingOffset(long j, int i) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onVideoFrameProcessingOffset(j, i);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoRendererEventListener
|
||
|
public void onVideoCodecError(Exception exc) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onVideoCodecError(exc);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.audio.AudioRendererEventListener
|
||
|
public void onAudioEnabled(DecoderCounters decoderCounters) {
|
||
|
ExoPlayerImpl.this.audioDecoderCounters = decoderCounters;
|
||
|
ExoPlayerImpl.this.analyticsCollector.onAudioEnabled(decoderCounters);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.audio.AudioRendererEventListener
|
||
|
public void onAudioDecoderInitialized(String str, long j, long j2) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onAudioDecoderInitialized(str, j, j2);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.audio.AudioRendererEventListener
|
||
|
public void onAudioInputFormatChanged(Format format, DecoderReuseEvaluation decoderReuseEvaluation) {
|
||
|
ExoPlayerImpl.this.audioFormat = format;
|
||
|
ExoPlayerImpl.this.analyticsCollector.onAudioInputFormatChanged(format, decoderReuseEvaluation);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.audio.AudioRendererEventListener
|
||
|
public void onAudioPositionAdvancing(long j) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onAudioPositionAdvancing(j);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.audio.AudioRendererEventListener
|
||
|
public void onAudioUnderrun(int i, long j, long j2) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onAudioUnderrun(i, j, j2);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.audio.AudioRendererEventListener
|
||
|
public void onAudioDecoderReleased(String str) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onAudioDecoderReleased(str);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.audio.AudioRendererEventListener
|
||
|
public void onAudioDisabled(DecoderCounters decoderCounters) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onAudioDisabled(decoderCounters);
|
||
|
ExoPlayerImpl.this.audioFormat = null;
|
||
|
ExoPlayerImpl.this.audioDecoderCounters = null;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.audio.AudioRendererEventListener
|
||
|
public void onSkipSilenceEnabledChanged(final boolean z) {
|
||
|
if (ExoPlayerImpl.this.skipSilenceEnabled == z) {
|
||
|
return;
|
||
|
}
|
||
|
ExoPlayerImpl.this.skipSilenceEnabled = z;
|
||
|
ExoPlayerImpl.this.listeners.sendEvent(23, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$ComponentListener$$ExternalSyntheticLambda4
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onSkipSilenceEnabledChanged(z);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.audio.AudioRendererEventListener
|
||
|
public void onAudioSinkError(Exception exc) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onAudioSinkError(exc);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.audio.AudioRendererEventListener
|
||
|
public void onAudioCodecError(Exception exc) {
|
||
|
ExoPlayerImpl.this.analyticsCollector.onAudioCodecError(exc);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.text.TextOutput
|
||
|
public void onCues(final List<Cue> list) {
|
||
|
ExoPlayerImpl.this.listeners.sendEvent(27, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$ComponentListener$$ExternalSyntheticLambda2
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onCues((List<Cue>) list);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.text.TextOutput
|
||
|
public void onCues(final CueGroup cueGroup) {
|
||
|
ExoPlayerImpl.this.currentCueGroup = cueGroup;
|
||
|
ExoPlayerImpl.this.listeners.sendEvent(27, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$ComponentListener$$ExternalSyntheticLambda6
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onCues(CueGroup.this);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.metadata.MetadataOutput
|
||
|
public void onMetadata(final Metadata metadata) {
|
||
|
ExoPlayerImpl exoPlayerImpl = ExoPlayerImpl.this;
|
||
|
exoPlayerImpl.staticAndDynamicMediaMetadata = exoPlayerImpl.staticAndDynamicMediaMetadata.buildUpon().populateFromMetadata(metadata).build();
|
||
|
MediaMetadata buildUpdatedMediaMetadata = ExoPlayerImpl.this.buildUpdatedMediaMetadata();
|
||
|
if (!buildUpdatedMediaMetadata.equals(ExoPlayerImpl.this.mediaMetadata)) {
|
||
|
ExoPlayerImpl.this.mediaMetadata = buildUpdatedMediaMetadata;
|
||
|
ExoPlayerImpl.this.listeners.queueEvent(14, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$ComponentListener$$ExternalSyntheticLambda0
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
ExoPlayerImpl.ComponentListener.this.m5375x842d3c8f((Player.Listener) obj);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
ExoPlayerImpl.this.listeners.queueEvent(28, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$ComponentListener$$ExternalSyntheticLambda1
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onMetadata(Metadata.this);
|
||
|
}
|
||
|
});
|
||
|
ExoPlayerImpl.this.listeners.flushEvents();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: lambda$onMetadata$4$com-google-android-exoplayer2-ExoPlayerImpl$ComponentListener, reason: not valid java name */
|
||
|
public /* synthetic */ void m5375x842d3c8f(Player.Listener listener) {
|
||
|
listener.onMediaMetadataChanged(ExoPlayerImpl.this.mediaMetadata);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.SurfaceHolder.Callback
|
||
|
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||
|
if (ExoPlayerImpl.this.surfaceHolderSurfaceIsVideoOutput) {
|
||
|
ExoPlayerImpl.this.setVideoOutputInternal(surfaceHolder.getSurface());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.view.SurfaceHolder.Callback
|
||
|
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
|
||
|
ExoPlayerImpl.this.maybeNotifySurfaceSizeChanged(i2, i3);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.SurfaceHolder.Callback
|
||
|
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
|
||
|
if (ExoPlayerImpl.this.surfaceHolderSurfaceIsVideoOutput) {
|
||
|
ExoPlayerImpl.this.setVideoOutputInternal(null);
|
||
|
}
|
||
|
ExoPlayerImpl.this.maybeNotifySurfaceSizeChanged(0, 0);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.TextureView.SurfaceTextureListener
|
||
|
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
|
||
|
ExoPlayerImpl.this.setSurfaceTextureInternal(surfaceTexture);
|
||
|
ExoPlayerImpl.this.maybeNotifySurfaceSizeChanged(i, i2);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.TextureView.SurfaceTextureListener
|
||
|
public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i2) {
|
||
|
ExoPlayerImpl.this.maybeNotifySurfaceSizeChanged(i, i2);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.TextureView.SurfaceTextureListener
|
||
|
public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
|
||
|
ExoPlayerImpl.this.setVideoOutputInternal(null);
|
||
|
ExoPlayerImpl.this.maybeNotifySurfaceSizeChanged(0, 0);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView.VideoSurfaceListener
|
||
|
public void onVideoSurfaceCreated(Surface surface) {
|
||
|
ExoPlayerImpl.this.setVideoOutputInternal(surface);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView.VideoSurfaceListener
|
||
|
public void onVideoSurfaceDestroyed(Surface surface) {
|
||
|
ExoPlayerImpl.this.setVideoOutputInternal(null);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.AudioFocusManager.PlayerControl
|
||
|
public void setVolumeMultiplier(float f) {
|
||
|
ExoPlayerImpl.this.sendVolumeToRenderers();
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.AudioFocusManager.PlayerControl
|
||
|
public void executePlayerCommand(int i) {
|
||
|
boolean playWhenReady = ExoPlayerImpl.this.getPlayWhenReady();
|
||
|
ExoPlayerImpl.this.updatePlayWhenReady(playWhenReady, i, ExoPlayerImpl.getPlayWhenReadyChangeReason(playWhenReady, i));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.AudioBecomingNoisyManager.EventListener
|
||
|
public void onAudioBecomingNoisy() {
|
||
|
ExoPlayerImpl.this.updatePlayWhenReady(false, -1, 3);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.StreamVolumeManager.Listener
|
||
|
public void onStreamTypeChanged(int i) {
|
||
|
final DeviceInfo createDeviceInfo = ExoPlayerImpl.createDeviceInfo(ExoPlayerImpl.this.streamVolumeManager);
|
||
|
if (createDeviceInfo.equals(ExoPlayerImpl.this.deviceInfo)) {
|
||
|
return;
|
||
|
}
|
||
|
ExoPlayerImpl.this.deviceInfo = createDeviceInfo;
|
||
|
ExoPlayerImpl.this.listeners.sendEvent(29, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$ComponentListener$$ExternalSyntheticLambda3
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onDeviceInfoChanged(DeviceInfo.this);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.StreamVolumeManager.Listener
|
||
|
public void onStreamVolumeChanged(final int i, final boolean z) {
|
||
|
ExoPlayerImpl.this.listeners.sendEvent(30, new ListenerSet.Event() { // from class: com.google.android.exoplayer2.ExoPlayerImpl$ComponentListener$$ExternalSyntheticLambda5
|
||
|
@Override // com.google.android.exoplayer2.util.ListenerSet.Event
|
||
|
public final void invoke(Object obj) {
|
||
|
((Player.Listener) obj).onDeviceVolumeChanged(i, z);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.ExoPlayer.AudioOffloadListener
|
||
|
public void onExperimentalSleepingForOffloadChanged(boolean z) {
|
||
|
ExoPlayerImpl.this.updateWakeAndWifiLock();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public static final class FrameMetadataListener implements VideoFrameMetadataListener, CameraMotionListener, PlayerMessage.Target {
|
||
|
public static final int MSG_SET_CAMERA_MOTION_LISTENER = 8;
|
||
|
public static final int MSG_SET_SPHERICAL_SURFACE_VIEW = 10000;
|
||
|
public static final int MSG_SET_VIDEO_FRAME_METADATA_LISTENER = 7;
|
||
|
private CameraMotionListener cameraMotionListener;
|
||
|
private CameraMotionListener internalCameraMotionListener;
|
||
|
private VideoFrameMetadataListener internalVideoFrameMetadataListener;
|
||
|
private VideoFrameMetadataListener videoFrameMetadataListener;
|
||
|
|
||
|
private FrameMetadataListener() {
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.PlayerMessage.Target
|
||
|
public void handleMessage(int i, Object obj) {
|
||
|
if (i == 7) {
|
||
|
this.videoFrameMetadataListener = (VideoFrameMetadataListener) obj;
|
||
|
return;
|
||
|
}
|
||
|
if (i == 8) {
|
||
|
this.cameraMotionListener = (CameraMotionListener) obj;
|
||
|
return;
|
||
|
}
|
||
|
if (i != 10000) {
|
||
|
return;
|
||
|
}
|
||
|
SphericalGLSurfaceView sphericalGLSurfaceView = (SphericalGLSurfaceView) obj;
|
||
|
if (sphericalGLSurfaceView == null) {
|
||
|
this.internalVideoFrameMetadataListener = null;
|
||
|
this.internalCameraMotionListener = null;
|
||
|
} else {
|
||
|
this.internalVideoFrameMetadataListener = sphericalGLSurfaceView.getVideoFrameMetadataListener();
|
||
|
this.internalCameraMotionListener = sphericalGLSurfaceView.getCameraMotionListener();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.VideoFrameMetadataListener
|
||
|
public void onVideoFrameAboutToBeRendered(long j, long j2, Format format, MediaFormat mediaFormat) {
|
||
|
VideoFrameMetadataListener videoFrameMetadataListener = this.internalVideoFrameMetadataListener;
|
||
|
if (videoFrameMetadataListener != null) {
|
||
|
videoFrameMetadataListener.onVideoFrameAboutToBeRendered(j, j2, format, mediaFormat);
|
||
|
}
|
||
|
VideoFrameMetadataListener videoFrameMetadataListener2 = this.videoFrameMetadataListener;
|
||
|
if (videoFrameMetadataListener2 != null) {
|
||
|
videoFrameMetadataListener2.onVideoFrameAboutToBeRendered(j, j2, format, mediaFormat);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.spherical.CameraMotionListener
|
||
|
public void onCameraMotion(long j, float[] fArr) {
|
||
|
CameraMotionListener cameraMotionListener = this.internalCameraMotionListener;
|
||
|
if (cameraMotionListener != null) {
|
||
|
cameraMotionListener.onCameraMotion(j, fArr);
|
||
|
}
|
||
|
CameraMotionListener cameraMotionListener2 = this.cameraMotionListener;
|
||
|
if (cameraMotionListener2 != null) {
|
||
|
cameraMotionListener2.onCameraMotion(j, fArr);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.exoplayer2.video.spherical.CameraMotionListener
|
||
|
public void onCameraMotionReset() {
|
||
|
CameraMotionListener cameraMotionListener = this.internalCameraMotionListener;
|
||
|
if (cameraMotionListener != null) {
|
||
|
cameraMotionListener.onCameraMotionReset();
|
||
|
}
|
||
|
CameraMotionListener cameraMotionListener2 = this.cameraMotionListener;
|
||
|
if (cameraMotionListener2 != null) {
|
||
|
cameraMotionListener2.onCameraMotionReset();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
private static final class Api31 {
|
||
|
private Api31() {
|
||
|
}
|
||
|
|
||
|
public static PlayerId registerMediaMetricsListener(Context context, ExoPlayerImpl exoPlayerImpl, boolean z) {
|
||
|
MediaMetricsListener create = MediaMetricsListener.create(context);
|
||
|
if (create == null) {
|
||
|
Log.w(ExoPlayerImpl.TAG, "MediaMetricsService unavailable.");
|
||
|
return new PlayerId(LogSessionId.LOG_SESSION_ID_NONE);
|
||
|
}
|
||
|
if (z) {
|
||
|
exoPlayerImpl.addAnalyticsListener(create);
|
||
|
}
|
||
|
return new PlayerId(create.getLogSessionId());
|
||
|
}
|
||
|
}
|
||
|
}
|