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
|
@Override
|
||||||
public void setOutputSurfaceInfo(Surface outputSurface, Size outputResolution) {
|
public void setOutputSurfaceInfo(Surface outputSurface, Size outputResolution) {
|
||||||
throw new UnsupportedOperationException();
|
videoFrameReleaseControl.setOutputSurface(outputSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearOutputSurfaceInfo() {
|
public void clearOutputSurfaceInfo() {
|
||||||
throw new UnsupportedOperationException();
|
videoFrameReleaseControl.setOutputSurface(/* outputSurface= */ null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -406,11 +406,16 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void maybeSetOutputSurfaceInfo(@Nullable Surface surface, int width, int height) {
|
private void maybeSetOutputSurfaceInfo(@Nullable Surface surface, int width, int height) {
|
||||||
if (videoGraph != null) {
|
if (videoGraph == null) {
|
||||||
// Update the surface on the video graph and the video frame release control together.
|
return;
|
||||||
SurfaceInfo surfaceInfo = surface != null ? new SurfaceInfo(surface, width, height) : null;
|
}
|
||||||
videoGraph.setOutputSurfaceInfo(surfaceInfo);
|
// Update the surface on the video graph and the default video sink together.
|
||||||
videoFrameReleaseControl.setOutputSurface(surface);
|
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