Commit 0ac262c4 by huangdarwin Committed by kim-vde

Misc refactoring.

Use @VisibleForTesting and add some comments for GL code.

Refactoring change only. No functional changes intended

PiperOrigin-RevId: 412428196
parent dbec03b5
...@@ -27,6 +27,7 @@ import androidx.annotation.CheckResult; ...@@ -27,6 +27,7 @@ import androidx.annotation.CheckResult;
import androidx.annotation.GuardedBy; import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.util.Log; import com.google.android.exoplayer2.util.Log;
...@@ -105,11 +106,8 @@ public final class MediaCodecUtil { ...@@ -105,11 +106,8 @@ public final class MediaCodecUtil {
} }
} }
/** /* Clears the codec cache.*/
* Clears the codec cache. @VisibleForTesting
*
* <p>This method should only be called in tests.
*/
public static synchronized void clearDecoderInfoCache() { public static synchronized void clearDecoderInfoCache() {
decoderInfosCache.clear(); decoderInfosCache.clear();
} }
......
...@@ -176,7 +176,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -176,7 +176,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
checkGlError(); checkGlError();
// Render. // Render.
GLES20.glDrawArrays(meshData.drawMode, 0, meshData.vertexCount); GLES20.glDrawArrays(meshData.drawMode, /* first= */ 0, meshData.vertexCount);
checkGlError(); checkGlError();
GLES20.glDisableVertexAttribArray(positionHandle); GLES20.glDisableVertexAttribArray(positionHandle);
......
...@@ -143,7 +143,7 @@ import java.io.IOException; ...@@ -143,7 +143,7 @@ import java.io.IOException;
inputSurfaceTexture.getTransformMatrix(textureTransformMatrix); inputSurfaceTexture.getTransformMatrix(textureTransformMatrix);
copyProgram.setFloatsUniform("tex_transform", textureTransformMatrix); copyProgram.setFloatsUniform("tex_transform", textureTransformMatrix);
copyProgram.bindAttributesAndUniforms(); copyProgram.bindAttributesAndUniforms();
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, /* first= */ 0, /* count= */ 4);
long surfaceTextureTimestampNs = inputSurfaceTexture.getTimestamp(); long surfaceTextureTimestampNs = inputSurfaceTexture.getTimestamp();
EGLExt.eglPresentationTimeANDROID(eglDisplay, eglSurface, surfaceTextureTimestampNs); EGLExt.eglPresentationTimeANDROID(eglDisplay, eglSurface, surfaceTextureTimestampNs);
EGL14.eglSwapBuffers(eglDisplay, eglSurface); EGL14.eglSwapBuffers(eglDisplay, eglSurface);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment