From 5fc5105f7a45ad552e8056ca159bf73a3f20eae5 Mon Sep 17 00:00:00 2001 From: huangdarwin Date: Thu, 15 Jun 2023 12:20:52 +0100 Subject: [PATCH] Test: Log saved bitmap file path. This helps debug bitmap tests. Without this CL, I typically need to go into the file to find the test name and absolute path. With this CL, I can just adb pull the printed file path, which is much simpler. PiperOrigin-RevId: 540539042 --- .../main/java/androidx/media3/effect/DefaultShaderProgram.java | 3 +-- .../java/androidx/media3/test/utils/BitmapPixelTestUtil.java | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/effect/src/main/java/androidx/media3/effect/DefaultShaderProgram.java b/libraries/effect/src/main/java/androidx/media3/effect/DefaultShaderProgram.java index 90e889ae96..f7fa79bcd0 100644 --- a/libraries/effect/src/main/java/androidx/media3/effect/DefaultShaderProgram.java +++ b/libraries/effect/src/main/java/androidx/media3/effect/DefaultShaderProgram.java @@ -436,8 +436,7 @@ import java.util.List; throw new VideoFrameProcessingException(e); } - float[] identityMatrix = GlUtil.create4x4IdentityMatrix(); - glProgram.setFloatsUniform("uTexTransformationMatrix", identityMatrix); + glProgram.setFloatsUniform("uTexTransformationMatrix", GlUtil.create4x4IdentityMatrix()); return glProgram; } diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/BitmapPixelTestUtil.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/BitmapPixelTestUtil.java index 10961a3676..b23e6cd93a 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/BitmapPixelTestUtil.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/BitmapPixelTestUtil.java @@ -314,7 +314,7 @@ public class BitmapPixelTestUtil { * save to the {@link Context#getCacheDir() cache directory}. * *

File name will be {@code _.png}. If the file failed to write, any - * {@link IOException} will be caught and logged. + * {@link IOException} will be caught and logged. The path will be logged regardless of success. * * @param testId Name of the test that produced the {@link Bitmap}. * @param bitmapLabel Label to identify the bitmap. @@ -338,6 +338,7 @@ public class BitmapPixelTestUtil { try (FileOutputStream outputStream = new FileOutputStream(file)) { bitmap.compress(Bitmap.CompressFormat.PNG, /* quality= */ 100, outputStream); + Log.d(TAG, "Saved bitmap to file path: " + file.getAbsolutePath()); } catch (IOException e) { Log.e(TAG, "Could not write Bitmap to file path: " + file.getAbsolutePath(), e); }