Simplify VideoSinkProvider surface handling in MCVR
PiperOrigin-RevId: 629975032
This commit is contained in:
parent
bdb8d8e329
commit
ec9b38b817
@ -155,7 +155,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
private boolean codecNeedsSetOutputSurfaceWorkaround;
|
private boolean codecNeedsSetOutputSurfaceWorkaround;
|
||||||
private boolean codecHandlesHdr10PlusOutOfBandMetadata;
|
private boolean codecHandlesHdr10PlusOutOfBandMetadata;
|
||||||
@Nullable private Surface displaySurface;
|
@Nullable private Surface displaySurface;
|
||||||
@Nullable private Size outputResolution;
|
|
||||||
@Nullable private PlaceholderSurface placeholderSurface;
|
@Nullable private PlaceholderSurface placeholderSurface;
|
||||||
private boolean haveReportedFirstFrameRenderedForCurrentSurface;
|
private boolean haveReportedFirstFrameRenderedForCurrentSurface;
|
||||||
private @C.VideoScalingMode int scalingMode;
|
private @C.VideoScalingMode int scalingMode;
|
||||||
@ -774,13 +773,10 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
setVideoEffects(videoEffects);
|
setVideoEffects(videoEffects);
|
||||||
break;
|
break;
|
||||||
case MSG_SET_VIDEO_OUTPUT_RESOLUTION:
|
case MSG_SET_VIDEO_OUTPUT_RESOLUTION:
|
||||||
outputResolution = (Size) checkNotNull(message);
|
Size outputResolution = (Size) checkNotNull(message);
|
||||||
// TODO: b/292111083 Set the surface on the videoSinkProvider before it's initialized
|
if (outputResolution.getWidth() != 0 && outputResolution.getHeight() != 0) {
|
||||||
// otherwise the first frames are missed until a new video output resolution arrives.
|
videoSinkProvider.setOutputSurfaceInfo(
|
||||||
if (checkNotNull(outputResolution).getWidth() != 0
|
checkStateNotNull(displaySurface), outputResolution);
|
||||||
&& checkNotNull(outputResolution).getHeight() != 0
|
|
||||||
&& displaySurface != null) {
|
|
||||||
videoSinkProvider.setOutputSurfaceInfo(displaySurface, checkNotNull(outputResolution));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSG_SET_PRIORITY:
|
case MSG_SET_PRIORITY:
|
||||||
@ -1103,11 +1099,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
// again, so there's no need to do two hops.
|
// again, so there's no need to do two hops.
|
||||||
directExecutor());
|
directExecutor());
|
||||||
videoSink.setStreamOffsetUs(getOutputStreamOffsetUs());
|
videoSink.setStreamOffsetUs(getOutputStreamOffsetUs());
|
||||||
if (enableEffectsForOwnSinkProvider) {
|
|
||||||
if (displaySurface != null && outputResolution != null) {
|
|
||||||
videoSinkProvider.setOutputSurfaceInfo(displaySurface, outputResolution);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
hasInitializedPlayback = true;
|
hasInitializedPlayback = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user