Commit 789a211d by krocard Committed by Ian Baker

Remove VideoDecoderOutputBufferRenderer from Player interface

The VideoDecoderOutputBufferRenderer will be set
automatically when setVideoSurfaceView is called on a
VideoDecoderGLSurfaceView.

#player-to-common

PiperOrigin-RevId: 351742601
parent 6084a552
...@@ -97,6 +97,8 @@ ...@@ -97,6 +97,8 @@
`MediaItem.playbackProperties.subtitles` `MediaItem.playbackProperties.subtitles`
([#8430](https://github.com/google/ExoPlayer/issues/8430)). ([#8430](https://github.com/google/ExoPlayer/issues/8430)).
* Remove `ExoPlaybackException.OutOfMemoryError`. * Remove `ExoPlaybackException.OutOfMemoryError`.
* Remove `setVideoDecoderOutputBufferRenderer` from Player API.
Clients should use `setOutputSurface` directly instead.
* Extractors: * Extractors:
* Populate codecs string for H.264/AVC in MP4, Matroska and FLV streams to * Populate codecs string for H.264/AVC in MP4, Matroska and FLV streams to
allow decoder capability checks based on codec profile/level allow decoder capability checks based on codec profile/level
......
...@@ -37,7 +37,6 @@ import com.google.android.exoplayer2.trackselection.TrackSelectionArray; ...@@ -37,7 +37,6 @@ import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import com.google.android.exoplayer2.trackselection.TrackSelectorInterface; import com.google.android.exoplayer2.trackselection.TrackSelectorInterface;
import com.google.android.exoplayer2.util.MutableFlags; import com.google.android.exoplayer2.util.MutableFlags;
import com.google.android.exoplayer2.util.Util; 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.VideoFrameMetadataListener;
import com.google.android.exoplayer2.video.VideoListener; import com.google.android.exoplayer2.video.VideoListener;
import com.google.android.exoplayer2.video.spherical.CameraMotionListener; import com.google.android.exoplayer2.video.spherical.CameraMotionListener;
...@@ -310,30 +309,6 @@ public interface Player { ...@@ -310,30 +309,6 @@ public interface Player {
* @param textureView The texture view to clear. * @param textureView The texture view to clear.
*/ */
void clearVideoTextureView(@Nullable TextureView textureView); void clearVideoTextureView(@Nullable TextureView textureView);
/**
* Sets the video decoder output buffer renderer. This is intended for use only with extension
* renderers that accept {@link Renderer#MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER}. For most
* use cases, an output surface or view should be passed via {@link #setVideoSurface(Surface)}
* or {@link #setVideoSurfaceView(SurfaceView)} instead.
*
* @param videoDecoderOutputBufferRenderer The video decoder output buffer renderer, or {@code
* null} to clear the output buffer renderer.
*/
void setVideoDecoderOutputBufferRenderer(
@Nullable VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer);
/** Clears the video decoder output buffer renderer. */
void clearVideoDecoderOutputBufferRenderer();
/**
* Clears the video decoder output buffer renderer if it matches the one passed. Else does
* nothing.
*
* @param videoDecoderOutputBufferRenderer The video decoder output buffer renderer to clear.
*/
void clearVideoDecoderOutputBufferRenderer(
@Nullable VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer);
} }
/** The text component of a {@link Player}. */ /** The text component of a {@link Player}. */
......
...@@ -60,6 +60,7 @@ import com.google.android.exoplayer2.util.Clock; ...@@ -60,6 +60,7 @@ import com.google.android.exoplayer2.util.Clock;
import com.google.android.exoplayer2.util.Log; import com.google.android.exoplayer2.util.Log;
import com.google.android.exoplayer2.util.PriorityTaskManager; import com.google.android.exoplayer2.util.PriorityTaskManager;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.video.VideoDecoderGLSurfaceView;
import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer; import com.google.android.exoplayer2.video.VideoDecoderOutputBufferRenderer;
import com.google.android.exoplayer2.video.VideoFrameMetadataListener; import com.google.android.exoplayer2.video.VideoFrameMetadataListener;
import com.google.android.exoplayer2.video.VideoRendererEventListener; import com.google.android.exoplayer2.video.VideoRendererEventListener;
...@@ -590,7 +591,6 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -590,7 +591,6 @@ public class SimpleExoPlayer extends BasePlayer
@Nullable private Format videoFormat; @Nullable private Format videoFormat;
@Nullable private Format audioFormat; @Nullable private Format audioFormat;
@Nullable private AudioTrack keepSessionIdAudioTrack; @Nullable private AudioTrack keepSessionIdAudioTrack;
@Nullable private VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer;
@Nullable private Surface surface; @Nullable private Surface surface;
private boolean ownsSurface; private boolean ownsSurface;
@C.VideoScalingMode private int videoScalingMode; @C.VideoScalingMode private int videoScalingMode;
...@@ -804,7 +804,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -804,7 +804,7 @@ public class SimpleExoPlayer extends BasePlayer
verifyApplicationThread(); verifyApplicationThread();
removeSurfaceCallbacks(); removeSurfaceCallbacks();
if (surface != null) { if (surface != null) {
clearVideoDecoderOutputBufferRenderer(); setVideoDecoderOutputBufferRenderer(/* videoDecoderOutputBufferRenderer= */ null);
} }
setVideoSurfaceInternal(surface, /* ownsSurface= */ false); setVideoSurfaceInternal(surface, /* ownsSurface= */ false);
int newSurfaceSize = surface == null ? 0 : C.LENGTH_UNSET; int newSurfaceSize = surface == null ? 0 : C.LENGTH_UNSET;
...@@ -816,7 +816,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -816,7 +816,7 @@ public class SimpleExoPlayer extends BasePlayer
verifyApplicationThread(); verifyApplicationThread();
removeSurfaceCallbacks(); removeSurfaceCallbacks();
if (surfaceHolder != null) { if (surfaceHolder != null) {
clearVideoDecoderOutputBufferRenderer(); setVideoDecoderOutputBufferRenderer(/* videoDecoderOutputBufferRenderer= */ null);
} }
this.surfaceHolder = surfaceHolder; this.surfaceHolder = surfaceHolder;
if (surfaceHolder == null) { if (surfaceHolder == null) {
...@@ -846,12 +846,29 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -846,12 +846,29 @@ public class SimpleExoPlayer extends BasePlayer
@Override @Override
public void setVideoSurfaceView(@Nullable SurfaceView surfaceView) { public void setVideoSurfaceView(@Nullable SurfaceView surfaceView) {
setVideoSurfaceHolder(surfaceView == null ? null : surfaceView.getHolder()); verifyApplicationThread();
if (surfaceView instanceof VideoDecoderGLSurfaceView) {
VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer =
((VideoDecoderGLSurfaceView) surfaceView).getVideoDecoderOutputBufferRenderer();
clearVideoSurface();
surfaceHolder = surfaceView.getHolder();
setVideoDecoderOutputBufferRenderer(videoDecoderOutputBufferRenderer);
} else {
setVideoSurfaceHolder(surfaceView == null ? null : surfaceView.getHolder());
}
} }
@Override @Override
public void clearVideoSurfaceView(@Nullable SurfaceView surfaceView) { public void clearVideoSurfaceView(@Nullable SurfaceView surfaceView) {
clearVideoSurfaceHolder(surfaceView == null ? null : surfaceView.getHolder()); verifyApplicationThread();
if (surfaceView instanceof VideoDecoderGLSurfaceView) {
if (surfaceView.getHolder() == surfaceHolder) {
setVideoDecoderOutputBufferRenderer(null);
surfaceHolder = null;
}
} else {
clearVideoSurfaceHolder(surfaceView == null ? null : surfaceView.getHolder());
}
} }
@Override @Override
...@@ -859,7 +876,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -859,7 +876,7 @@ public class SimpleExoPlayer extends BasePlayer
verifyApplicationThread(); verifyApplicationThread();
removeSurfaceCallbacks(); removeSurfaceCallbacks();
if (textureView != null) { if (textureView != null) {
clearVideoDecoderOutputBufferRenderer(); setVideoDecoderOutputBufferRenderer(/* videoDecoderOutputBufferRenderer= */ null);
} }
this.textureView = textureView; this.textureView = textureView;
if (textureView == null) { if (textureView == null) {
...@@ -891,32 +908,6 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -891,32 +908,6 @@ public class SimpleExoPlayer extends BasePlayer
} }
@Override @Override
public void setVideoDecoderOutputBufferRenderer(
@Nullable VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer) {
verifyApplicationThread();
if (videoDecoderOutputBufferRenderer != null) {
clearVideoSurface();
}
setVideoDecoderOutputBufferRendererInternal(videoDecoderOutputBufferRenderer);
}
@Override
public void clearVideoDecoderOutputBufferRenderer() {
verifyApplicationThread();
setVideoDecoderOutputBufferRendererInternal(/* videoDecoderOutputBufferRenderer= */ null);
}
@Override
public void clearVideoDecoderOutputBufferRenderer(
@Nullable VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer) {
verifyApplicationThread();
if (videoDecoderOutputBufferRenderer != null
&& videoDecoderOutputBufferRenderer == this.videoDecoderOutputBufferRenderer) {
clearVideoDecoderOutputBufferRenderer();
}
}
@Override
public void addAudioListener(AudioListener listener) { public void addAudioListener(AudioListener listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
Assertions.checkNotNull(listener); Assertions.checkNotNull(listener);
...@@ -1945,13 +1936,12 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -1945,13 +1936,12 @@ public class SimpleExoPlayer extends BasePlayer
this.ownsSurface = ownsSurface; this.ownsSurface = ownsSurface;
} }
private void setVideoDecoderOutputBufferRendererInternal( private void setVideoDecoderOutputBufferRenderer(
@Nullable VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer) { @Nullable VideoDecoderOutputBufferRenderer videoDecoderOutputBufferRenderer) {
sendRendererMessage( sendRendererMessage(
C.TRACK_TYPE_VIDEO, C.TRACK_TYPE_VIDEO,
Renderer.MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER, Renderer.MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER,
videoDecoderOutputBufferRenderer); videoDecoderOutputBufferRenderer);
this.videoDecoderOutputBufferRenderer = videoDecoderOutputBufferRenderer;
} }
private void maybeNotifySurfaceSizeChanged(int width, int height) { private void maybeNotifySurfaceSizeChanged(int width, int height) {
......
...@@ -572,8 +572,6 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -572,8 +572,6 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
oldVideoComponent.clearVideoTextureView((TextureView) surfaceView); oldVideoComponent.clearVideoTextureView((TextureView) surfaceView);
} else if (surfaceView instanceof SphericalGLSurfaceView) { } else if (surfaceView instanceof SphericalGLSurfaceView) {
((SphericalGLSurfaceView) surfaceView).setVideoComponent(null); ((SphericalGLSurfaceView) surfaceView).setVideoComponent(null);
} else if (surfaceView instanceof VideoDecoderGLSurfaceView) {
oldVideoComponent.setVideoDecoderOutputBufferRenderer(null);
} else if (surfaceView instanceof SurfaceView) { } else if (surfaceView instanceof SurfaceView) {
oldVideoComponent.clearVideoSurfaceView((SurfaceView) surfaceView); oldVideoComponent.clearVideoSurfaceView((SurfaceView) surfaceView);
} }
...@@ -600,9 +598,6 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -600,9 +598,6 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
newVideoComponent.setVideoTextureView((TextureView) surfaceView); newVideoComponent.setVideoTextureView((TextureView) surfaceView);
} else if (surfaceView instanceof SphericalGLSurfaceView) { } else if (surfaceView instanceof SphericalGLSurfaceView) {
((SphericalGLSurfaceView) surfaceView).setVideoComponent(newVideoComponent); ((SphericalGLSurfaceView) surfaceView).setVideoComponent(newVideoComponent);
} else if (surfaceView instanceof VideoDecoderGLSurfaceView) {
newVideoComponent.setVideoDecoderOutputBufferRenderer(
((VideoDecoderGLSurfaceView) surfaceView).getVideoDecoderOutputBufferRenderer());
} else if (surfaceView instanceof SurfaceView) { } else if (surfaceView instanceof SurfaceView) {
newVideoComponent.setVideoSurfaceView((SurfaceView) surfaceView); newVideoComponent.setVideoSurfaceView((SurfaceView) surfaceView);
} }
......
...@@ -581,8 +581,6 @@ public class StyledPlayerView extends FrameLayout implements AdsLoader.AdViewPro ...@@ -581,8 +581,6 @@ public class StyledPlayerView extends FrameLayout implements AdsLoader.AdViewPro
oldVideoComponent.clearVideoTextureView((TextureView) surfaceView); oldVideoComponent.clearVideoTextureView((TextureView) surfaceView);
} else if (surfaceView instanceof SphericalGLSurfaceView) { } else if (surfaceView instanceof SphericalGLSurfaceView) {
((SphericalGLSurfaceView) surfaceView).setVideoComponent(null); ((SphericalGLSurfaceView) surfaceView).setVideoComponent(null);
} else if (surfaceView instanceof VideoDecoderGLSurfaceView) {
oldVideoComponent.setVideoDecoderOutputBufferRenderer(null);
} else if (surfaceView instanceof SurfaceView) { } else if (surfaceView instanceof SurfaceView) {
oldVideoComponent.clearVideoSurfaceView((SurfaceView) surfaceView); oldVideoComponent.clearVideoSurfaceView((SurfaceView) surfaceView);
} }
...@@ -609,9 +607,6 @@ public class StyledPlayerView extends FrameLayout implements AdsLoader.AdViewPro ...@@ -609,9 +607,6 @@ public class StyledPlayerView extends FrameLayout implements AdsLoader.AdViewPro
newVideoComponent.setVideoTextureView((TextureView) surfaceView); newVideoComponent.setVideoTextureView((TextureView) surfaceView);
} else if (surfaceView instanceof SphericalGLSurfaceView) { } else if (surfaceView instanceof SphericalGLSurfaceView) {
((SphericalGLSurfaceView) surfaceView).setVideoComponent(newVideoComponent); ((SphericalGLSurfaceView) surfaceView).setVideoComponent(newVideoComponent);
} else if (surfaceView instanceof VideoDecoderGLSurfaceView) {
newVideoComponent.setVideoDecoderOutputBufferRenderer(
((VideoDecoderGLSurfaceView) surfaceView).getVideoDecoderOutputBufferRenderer());
} else if (surfaceView instanceof SurfaceView) { } else if (surfaceView instanceof SurfaceView) {
newVideoComponent.setVideoSurfaceView((SurfaceView) surfaceView); newVideoComponent.setVideoSurfaceView((SurfaceView) surfaceView);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment