Remove direct usages of release control when video sink is used
Usages removed in this CL are: - onProcessedStreamChange, which was already called from the VideoSink (via VideoFrameRenderControl) - setOutputSurface, which was also already called from the VideoSink - setFrameRate, which this CL now sets in the VideoSink PiperOrigin-RevId: 640530903
This commit is contained in:
parent
9716985272
commit
f54380f9d8
@ -575,6 +575,7 @@ public final class CompositingVideoSinkProvider implements VideoSinkProvider, Vi
|
|||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException("Unsupported input type " + inputType);
|
throw new UnsupportedOperationException("Unsupported input type " + inputType);
|
||||||
}
|
}
|
||||||
|
videoFrameReleaseControl.setFrameRate(format.frameRate);
|
||||||
// MediaCodec applies rotation after API 21.
|
// MediaCodec applies rotation after API 21.
|
||||||
if (inputType == INPUT_TYPE_SURFACE
|
if (inputType == INPUT_TYPE_SURFACE
|
||||||
&& Util.SDK_INT < 21
|
&& Util.SDK_INT < 21
|
||||||
|
@ -825,7 +825,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
// We only need to update the codec if the display surface has changed.
|
// We only need to update the codec if the display surface has changed.
|
||||||
if (this.displaySurface != displaySurface) {
|
if (this.displaySurface != displaySurface) {
|
||||||
this.displaySurface = displaySurface;
|
this.displaySurface = displaySurface;
|
||||||
|
if (!shouldUseVideoSink) {
|
||||||
videoFrameReleaseControl.setOutputSurface(displaySurface);
|
videoFrameReleaseControl.setOutputSurface(displaySurface);
|
||||||
|
}
|
||||||
haveReportedFirstFrameRenderedForCurrentSurface = false;
|
haveReportedFirstFrameRenderedForCurrentSurface = false;
|
||||||
|
|
||||||
@State int state = getState();
|
@State int state = getState();
|
||||||
@ -1230,7 +1232,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
}
|
}
|
||||||
decodedVideoSize =
|
decodedVideoSize =
|
||||||
new VideoSize(width, height, unappliedRotationDegrees, pixelWidthHeightRatio);
|
new VideoSize(width, height, unappliedRotationDegrees, pixelWidthHeightRatio);
|
||||||
videoFrameReleaseControl.setFrameRate(format.frameRate);
|
|
||||||
|
|
||||||
if (shouldUseVideoSink) {
|
if (shouldUseVideoSink) {
|
||||||
onReadyToRegisterVideoSinkInputStream();
|
onReadyToRegisterVideoSinkInputStream();
|
||||||
@ -1243,6 +1244,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
.setRotationDegrees(unappliedRotationDegrees)
|
.setRotationDegrees(unappliedRotationDegrees)
|
||||||
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
.setPixelWidthHeightRatio(pixelWidthHeightRatio)
|
||||||
.build());
|
.build());
|
||||||
|
} else {
|
||||||
|
videoFrameReleaseControl.setFrameRate(format.frameRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1454,9 +1457,12 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
|||||||
@Override
|
@Override
|
||||||
protected void onProcessedStreamChange() {
|
protected void onProcessedStreamChange() {
|
||||||
super.onProcessedStreamChange();
|
super.onProcessedStreamChange();
|
||||||
videoFrameReleaseControl.onProcessedStreamChange();
|
if (shouldUseVideoSink) {
|
||||||
maybeSetupTunnelingForFirstFrame();
|
|
||||||
videoSink.setStreamOffsetUs(getOutputStreamOffsetUs());
|
videoSink.setStreamOffsetUs(getOutputStreamOffsetUs());
|
||||||
|
} else {
|
||||||
|
videoFrameReleaseControl.onProcessedStreamChange();
|
||||||
|
}
|
||||||
|
maybeSetupTunnelingForFirstFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -432,8 +432,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
.setWidth(outputImage.getWidth())
|
.setWidth(outputImage.getWidth())
|
||||||
.setHeight(outputImage.getHeight())
|
.setHeight(outputImage.getHeight())
|
||||||
.setColorInfo(ColorInfo.SRGB_BT709_FULL)
|
.setColorInfo(ColorInfo.SRGB_BT709_FULL)
|
||||||
|
.setFrameRate(/* frameRate= */ DEFAULT_FRAME_RATE)
|
||||||
.build());
|
.build());
|
||||||
videoFrameReleaseControl.setFrameRate(/* frameRate= */ DEFAULT_FRAME_RATE);
|
|
||||||
inputStreamPendingRegistration = false;
|
inputStreamPendingRegistration = false;
|
||||||
}
|
}
|
||||||
return videoSink.queueBitmap(outputImage, checkStateNotNull(timestampIterator));
|
return videoSink.queueBitmap(outputImage, checkStateNotNull(timestampIterator));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user