Remove VideoSinkProvider

PiperOrigin-RevId: 752227606
This commit is contained in:
kimvde 2025-04-28 02:46:36 -07:00 committed by Copybara-Service
parent 170098b400
commit 8968d9fa45
4 changed files with 24 additions and 87 deletions

View File

@ -125,6 +125,10 @@
`Player.seekToNextMediaItem()` instead. `Player.seekToNextMediaItem()` instead.
* Removed deprecated `BaseAudioProcessor` in `exoplayer` module. Use * Removed deprecated `BaseAudioProcessor` in `exoplayer` module. Use
`BaseAudioProcessor` under `common` module. `BaseAudioProcessor` under `common` module.
* Remove deprecated `MediaCodecVideoRenderer` constructor
`MediaCodecVideoRenderer(Context, MediaCodecAdapter.Factor,
MediaCodecSelector, long, boolean, @Nullable Handler, @Nullable
VideoRendererEventListener, int, float, @Nullable VideoSinkProvider)`.
## 1.6 ## 1.6

View File

@ -537,35 +537,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
.setAssumedMinimumCodecOperatingRate(assumedMinimumCodecOperatingRate)); .setAssumedMinimumCodecOperatingRate(assumedMinimumCodecOperatingRate));
} }
/**
* @deprecated Use {@link Builder} instead.
*/
@Deprecated
public MediaCodecVideoRenderer(
Context context,
MediaCodecAdapter.Factory codecAdapterFactory,
MediaCodecSelector mediaCodecSelector,
long allowedJoiningTimeMs,
boolean enableDecoderFallback,
@Nullable Handler eventHandler,
@Nullable VideoRendererEventListener eventListener,
int maxDroppedFramesToNotify,
float assumedMinimumCodecOperatingRate,
@Nullable VideoSinkProvider videoSinkProvider) {
this(
new Builder(context)
.setMediaCodecSelector(mediaCodecSelector)
.setCodecAdapterFactory(codecAdapterFactory)
.setAllowedJoiningTimeMs(allowedJoiningTimeMs)
.setEnableDecoderFallback(enableDecoderFallback)
.setEventHandler(eventHandler)
.setEventListener(eventListener)
.setMaxDroppedFramesToNotify(maxDroppedFramesToNotify)
.setAssumedMinimumCodecOperatingRate(assumedMinimumCodecOperatingRate)
.setVideoSink(
videoSinkProvider == null ? null : videoSinkProvider.getSink(/* inputIndex= */ 0)));
}
/** /**
* @deprecated Use {@link Builder} instead. * @deprecated Use {@link Builder} instead.
*/ */

View File

@ -76,7 +76,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
*/ */
@UnstableApi @UnstableApi
@RestrictTo({Scope.LIBRARY_GROUP}) @RestrictTo({Scope.LIBRARY_GROUP})
public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, VideoGraph.Listener { public final class PlaybackVideoGraphWrapper implements VideoGraph.Listener {
/** Listener for {@link PlaybackVideoGraphWrapper} events. */ /** Listener for {@link PlaybackVideoGraphWrapper} events. */
public interface Listener { public interface Listener {
@ -400,19 +400,12 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
this.totalVideoInputCount = totalVideoInputCount; this.totalVideoInputCount = totalVideoInputCount;
} }
/** Starts rendering to the output surface. */ /**
public void startRendering() { * Returns the {@link VideoSink} to forward video frames for processing.
defaultVideoSink.startRendering(); *
} * @param inputIndex The index of the {@link VideoSink}.
* @return The {@link VideoSink} at the given index.
/** Stops rendering to the output surface. */ */
public void stopRendering() {
defaultVideoSink.stopRendering();
}
// VideoSinkProvider methods
@Override
public VideoSink getSink(int inputIndex) { public VideoSink getSink(int inputIndex) {
if (contains(inputVideoSinks, inputIndex)) { if (contains(inputVideoSinks, inputIndex)) {
return inputVideoSinks.get(inputIndex); return inputVideoSinks.get(inputIndex);
@ -425,7 +418,7 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
return inputVideoSink; return inputVideoSink;
} }
@Override /** Sets the output surface info. */
public void setOutputSurfaceInfo(Surface outputSurface, Size outputResolution) { public void setOutputSurfaceInfo(Surface outputSurface, Size outputResolution) {
if (currentSurfaceAndSize != null if (currentSurfaceAndSize != null
&& currentSurfaceAndSize.first.equals(outputSurface) && currentSurfaceAndSize.first.equals(outputSurface)
@ -437,7 +430,7 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
outputSurface, outputResolution.getWidth(), outputResolution.getHeight()); outputSurface, outputResolution.getWidth(), outputResolution.getHeight());
} }
@Override /** Clears the set output surface info. */
public void clearOutputSurfaceInfo() { public void clearOutputSurfaceInfo() {
maybeSetOutputSurfaceInfo( maybeSetOutputSurfaceInfo(
/* surface= */ null, /* surface= */ null,
@ -446,7 +439,17 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
currentSurfaceAndSize = null; currentSurfaceAndSize = null;
} }
@Override /** Starts rendering to the output surface. */
public void startRendering() {
defaultVideoSink.startRendering();
}
/** Stops rendering to the output surface. */
public void stopRendering() {
defaultVideoSink.stopRendering();
}
/** Releases the sink provider. */
public void release() { public void release() {
if (state == STATE_RELEASED) { if (state == STATE_RELEASED) {
return; return;

View File

@ -1,41 +0,0 @@
/*
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.media3.exoplayer.video;
import android.view.Surface;
import androidx.media3.common.util.Size;
/** A provider of {@link VideoSink VideoSinks}. */
/* package */ interface VideoSinkProvider {
/**
* Returns the {@link VideoSink} to forward video frames for processing.
*
* @param inputIndex The index of the {@link VideoSink}.
* @return The {@link VideoSink} at the given index.
*/
VideoSink getSink(int inputIndex);
/** Sets the output surface info. */
void setOutputSurfaceInfo(Surface outputSurface, Size outputResolution);
/** Clears the set output surface info. */
void clearOutputSurfaceInfo();
/** Releases the sink provider. */
void release();
}