DefaultVideoSink: implement set/clearOutputSurfaceInfo
This is part of the effort to handle rendering of the frames output by the VideoGraph in a DefaultVideoSink PiperOrigin-RevId: 683939818
This commit is contained in:
parent
c4ff07e229
commit
e234076fdc
@ -128,12 +128,12 @@ import java.util.concurrent.Executor;
|
||||
|
||||
@Override
|
||||
public void setOutputSurfaceInfo(Surface outputSurface, Size outputResolution) {
|
||||
throw new UnsupportedOperationException();
|
||||
videoFrameReleaseControl.setOutputSurface(outputSurface);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearOutputSurfaceInfo() {
|
||||
throw new UnsupportedOperationException();
|
||||
videoFrameReleaseControl.setOutputSurface(/* outputSurface= */ null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -406,11 +406,16 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
|
||||
}
|
||||
|
||||
private void maybeSetOutputSurfaceInfo(@Nullable Surface surface, int width, int height) {
|
||||
if (videoGraph != null) {
|
||||
// Update the surface on the video graph and the video frame release control together.
|
||||
SurfaceInfo surfaceInfo = surface != null ? new SurfaceInfo(surface, width, height) : null;
|
||||
videoGraph.setOutputSurfaceInfo(surfaceInfo);
|
||||
videoFrameReleaseControl.setOutputSurface(surface);
|
||||
if (videoGraph == null) {
|
||||
return;
|
||||
}
|
||||
// Update the surface on the video graph and the default video sink together.
|
||||
if (surface != null) {
|
||||
videoGraph.setOutputSurfaceInfo(new SurfaceInfo(surface, width, height));
|
||||
defaultVideoSink.setOutputSurfaceInfo(surface, new Size(width, height));
|
||||
} else {
|
||||
videoGraph.setOutputSurfaceInfo(/* outputSurfaceInfo= */ null);
|
||||
defaultVideoSink.clearOutputSurfaceInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user