mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add surface setters on VideoSink
PiperOrigin-RevId: 631025710
This commit is contained in:
parent
506944dcfd
commit
a03f30bea9
3 changed files with 19 additions and 3 deletions
|
|
@ -687,6 +687,16 @@ public final class CompositingVideoSinkProvider
|
||||||
inputStreamOffsetUs = streamOffsetUs;
|
inputStreamOffsetUs = streamOffsetUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOutputSurfaceInfo(Surface outputSurface, Size outputResolution) {
|
||||||
|
CompositingVideoSinkProvider.this.setOutputSurfaceInfo(outputSurface, outputResolution);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearOutputSurfaceInfo() {
|
||||||
|
CompositingVideoSinkProvider.this.clearOutputSurfaceInfo();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long registerInputFrame(long framePresentationTimeUs, boolean isLastFrame) {
|
public long registerInputFrame(long framePresentationTimeUs, boolean isLastFrame) {
|
||||||
checkState(isInitialized());
|
checkState(isInitialized());
|
||||||
|
|
|
||||||
|
|
@ -776,8 +776,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||||
case MSG_SET_VIDEO_OUTPUT_RESOLUTION:
|
case MSG_SET_VIDEO_OUTPUT_RESOLUTION:
|
||||||
Size outputResolution = (Size) checkNotNull(message);
|
Size outputResolution = (Size) checkNotNull(message);
|
||||||
if (outputResolution.getWidth() != 0 && outputResolution.getHeight() != 0) {
|
if (outputResolution.getWidth() != 0 && outputResolution.getHeight() != 0) {
|
||||||
videoSinkProvider.setOutputSurfaceInfo(
|
videoSink.setOutputSurfaceInfo(checkStateNotNull(displaySurface), outputResolution);
|
||||||
checkStateNotNull(displaySurface), outputResolution);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSG_SET_PRIORITY:
|
case MSG_SET_PRIORITY:
|
||||||
|
|
@ -838,7 +837,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||||
} else {
|
} else {
|
||||||
// The display surface has been removed.
|
// The display surface has been removed.
|
||||||
reportedVideoSize = null;
|
reportedVideoSize = null;
|
||||||
videoSinkProvider.clearOutputSurfaceInfo();
|
videoSink.clearOutputSurfaceInfo();
|
||||||
}
|
}
|
||||||
maybeSetupTunnelingForFirstFrame();
|
maybeSetupTunnelingForFirstFrame();
|
||||||
} else if (displaySurface != null && displaySurface != placeholderSurface) {
|
} else if (displaySurface != null && displaySurface != placeholderSurface) {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import androidx.media3.common.Effect;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
import androidx.media3.common.VideoSize;
|
import androidx.media3.common.VideoSize;
|
||||||
import androidx.media3.common.util.Clock;
|
import androidx.media3.common.util.Clock;
|
||||||
|
import androidx.media3.common.util.Size;
|
||||||
import androidx.media3.common.util.TimestampIterator;
|
import androidx.media3.common.util.TimestampIterator;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import java.lang.annotation.Documented;
|
import java.lang.annotation.Documented;
|
||||||
|
|
@ -175,6 +176,12 @@ public interface VideoSink {
|
||||||
*/
|
*/
|
||||||
void setStreamOffsetUs(long streamOffsetUs);
|
void setStreamOffsetUs(long streamOffsetUs);
|
||||||
|
|
||||||
|
/** Sets the output surface info. */
|
||||||
|
void setOutputSurfaceInfo(Surface outputSurface, Size outputResolution);
|
||||||
|
|
||||||
|
/** Clears the set output surface info. */
|
||||||
|
void clearOutputSurfaceInfo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Informs the video sink that a new input stream will be queued.
|
* Informs the video sink that a new input stream will be queued.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue