mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Use SurfaceTexture.getTimestamp
PiperOrigin-RevId: 399139842
This commit is contained in:
parent
1e6a3aa6fb
commit
a82690a533
@ -71,7 +71,6 @@ import java.nio.ByteBuffer;
|
|||||||
@Nullable private GlUtil.Uniform decoderTextureTransformUniform;
|
@Nullable private GlUtil.Uniform decoderTextureTransformUniform;
|
||||||
|
|
||||||
@Nullable private MediaCodecAdapterWrapper encoder;
|
@Nullable private MediaCodecAdapterWrapper encoder;
|
||||||
private long nextEncoderTimeUs;
|
|
||||||
/** Whether encoder's actual output format is obtained. */
|
/** Whether encoder's actual output format is obtained. */
|
||||||
private boolean hasEncoderActualOutputFormat;
|
private boolean hasEncoderActualOutputFormat;
|
||||||
|
|
||||||
@ -304,7 +303,6 @@ import java.nio.ByteBuffer;
|
|||||||
if (!isDecoderSurfacePopulated) {
|
if (!isDecoderSurfacePopulated) {
|
||||||
if (!waitingForPopulatedDecoderSurface) {
|
if (!waitingForPopulatedDecoderSurface) {
|
||||||
if (decoder.getOutputBuffer() != null) {
|
if (decoder.getOutputBuffer() != null) {
|
||||||
nextEncoderTimeUs = checkNotNull(decoder.getOutputBufferInfo()).presentationTimeUs;
|
|
||||||
decoder.releaseOutputBuffer(/* render= */ true);
|
decoder.releaseOutputBuffer(/* render= */ true);
|
||||||
waitingForPopulatedDecoderSurface = true;
|
waitingForPopulatedDecoderSurface = true;
|
||||||
}
|
}
|
||||||
@ -326,7 +324,8 @@ import java.nio.ByteBuffer;
|
|||||||
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
|
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
|
||||||
EGLDisplay eglDisplay = checkNotNull(this.eglDisplay);
|
EGLDisplay eglDisplay = checkNotNull(this.eglDisplay);
|
||||||
EGLSurface eglSurface = checkNotNull(this.eglSurface);
|
EGLSurface eglSurface = checkNotNull(this.eglSurface);
|
||||||
EGLExt.eglPresentationTimeANDROID(eglDisplay, eglSurface, nextEncoderTimeUs * 1000L);
|
long decoderSurfaceTextureTimestampNs = decoderSurfaceTexture.getTimestamp();
|
||||||
|
EGLExt.eglPresentationTimeANDROID(eglDisplay, eglSurface, decoderSurfaceTextureTimestampNs);
|
||||||
EGL14.eglSwapBuffers(eglDisplay, eglSurface);
|
EGL14.eglSwapBuffers(eglDisplay, eglSurface);
|
||||||
isDecoderSurfacePopulated = false;
|
isDecoderSurfacePopulated = false;
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user