mirror of
https://github.com/samsonjs/media.git
synced 2026-04-05 11:15:46 +00:00
Test: Rename getBitmap to getBitmapAtPresentationTimeUs
PiperOrigin-RevId: 567683139
This commit is contained in:
parent
8a40952e1b
commit
444cb3fb3a
3 changed files with 9 additions and 7 deletions
|
|
@ -135,7 +135,7 @@ public class FrameDropTest {
|
|||
throws IOException {
|
||||
for (int i = 0; i < presentationTimesUs.size(); i++) {
|
||||
long presentationTimeUs = presentationTimesUs.get(i);
|
||||
Bitmap actualBitmap = textureBitmapReader.getBitmap(presentationTimeUs);
|
||||
Bitmap actualBitmap = textureBitmapReader.getBitmapAtPresentationTimeUs(presentationTimeUs);
|
||||
Bitmap expectedBitmap =
|
||||
readBitmap(Util.formatInvariant("%s/pts_%d.png", ASSET_PATH, presentationTimeUs));
|
||||
maybeSaveTestBitmap(
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
|
|||
* @return The output {@link Bitmap} at a given {@code presentationTimeUs}.
|
||||
* @throws IllegalStateException If no such bitmap is produced.
|
||||
*/
|
||||
public Bitmap getBitmap(long presentationTimeUs) {
|
||||
public Bitmap getBitmapAtPresentationTimeUs(long presentationTimeUs) {
|
||||
return checkStateNotNull(outputTimestampsToBitmaps.get(presentationTimeUs));
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,8 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
|
|||
/**
|
||||
* Reads the given {@code outputTexture}.
|
||||
*
|
||||
* <p>The read result can be fetched by calling one of the {@link #getBitmap} methods.
|
||||
* <p>The read result can be fetched by calling {@link #getBitmapAtPresentationTimeUs} or {@link
|
||||
* #getBitmap}.
|
||||
*
|
||||
* <p>This implementation incorrectly marks the output Bitmap as {@link Bitmap#isPremultiplied()
|
||||
* premultiplied}, even though OpenGL typically outputs only non-premultiplied alpha. Use {@link
|
||||
|
|
@ -110,7 +111,8 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
|
|||
/**
|
||||
* Reads the given {@code outputTexture} as one with unpremultiplied alpha.
|
||||
*
|
||||
* <p>The read result can be fetched by calling one of the {@link #getBitmap} methods.
|
||||
* <p>The read result can be fetched by calling {@link #getBitmapAtPresentationTimeUs} or {@link
|
||||
* #getBitmap}.
|
||||
*/
|
||||
@RequiresApi(19) // BitmapPixelTestUtil#createArgb8888BitmapFromFocusedGlFramebuffer.
|
||||
public void readBitmapUnpremultipliedAlpha(GlTextureInfo outputTexture, long presentationTimeUs)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest {
|
|||
TextureBitmapReader textureBitmapReader = checkNotNull(this.textureBitmapReader);
|
||||
Set<Long> outputTimestamps = textureBitmapReader.getOutputTimestamps();
|
||||
assertThat(outputTimestamps).containsExactlyElementsIn(inputTimestamps).inOrder();
|
||||
Bitmap actualBitmap = textureBitmapReader.getBitmap(/* presentationTimeUs= */ 1_000_000L);
|
||||
Bitmap actualBitmap = textureBitmapReader.getBitmapAtPresentationTimeUs(1_000_000L);
|
||||
maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual", actualBitmap, /* path= */ null);
|
||||
float averagePixelAbsoluteDifference =
|
||||
BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888(
|
||||
|
|
@ -103,9 +103,9 @@ public class DefaultVideoFrameProcessorMultipleTextureOutputPixelTest {
|
|||
TextureBitmapReader textureBitmapReader = checkNotNull(this.textureBitmapReader);
|
||||
Set<Long> actualOutputTimestamps = textureBitmapReader.getOutputTimestamps();
|
||||
assertThat(actualOutputTimestamps).containsExactlyElementsIn(outputTimestamps).inOrder();
|
||||
Bitmap actualBitmap1 = textureBitmapReader.getBitmap(/* presentationTimeUs= */ 1_000_000L);
|
||||
Bitmap actualBitmap1 = textureBitmapReader.getBitmapAtPresentationTimeUs(1_000_000L);
|
||||
maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual1", actualBitmap1, /* path= */ null);
|
||||
Bitmap actualBitmap2 = textureBitmapReader.getBitmap(/* presentationTimeUs= */ 2_000_000L);
|
||||
Bitmap actualBitmap2 = textureBitmapReader.getBitmapAtPresentationTimeUs(2_000_000L);
|
||||
maybeSaveTestBitmap(testId, /* bitmapLabel= */ "actual2", actualBitmap2, /* path= */ null);
|
||||
float averagePixelAbsoluteDifference1 =
|
||||
BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888(
|
||||
|
|
|
|||
Loading…
Reference in a new issue