mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Create a private util method to create blank frame bitmap
This method will be reused when inserting gaps in `GapSignalingAssetLoader` in upcoming CL. PiperOrigin-RevId: 732896566
This commit is contained in:
parent
1361d569cd
commit
86df7572d2
@ -65,10 +65,12 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
.setChannelCount(2)
|
||||
.build();
|
||||
|
||||
private static final int BLANK_IMAGE_BITMAP_WIDTH = 1;
|
||||
private static final int BLANK_IMAGE_BITMAP_HEIGHT = 1;
|
||||
private static final Format BLANK_IMAGE_BITMAP_FORMAT =
|
||||
new Format.Builder()
|
||||
.setWidth(1)
|
||||
.setHeight(1)
|
||||
.setWidth(BLANK_IMAGE_BITMAP_WIDTH)
|
||||
.setHeight(BLANK_IMAGE_BITMAP_HEIGHT)
|
||||
.setSampleMimeType(MimeTypes.IMAGE_RAW)
|
||||
.setColorInfo(ColorInfo.SRGB_BT709_FULL)
|
||||
.build();
|
||||
@ -347,10 +349,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
// Fill video gap with blank frames.
|
||||
onMediaItemChanged(C.TRACK_TYPE_VIDEO, /* outputFormat= */ BLANK_IMAGE_BITMAP_FORMAT);
|
||||
nonEndedTrackCount.incrementAndGet();
|
||||
Bitmap bitmap =
|
||||
Bitmap.createBitmap(
|
||||
new int[] {Color.BLACK}, /* width= */ 1, /* height= */ 1, Bitmap.Config.ARGB_8888);
|
||||
handler.post(() -> insertBlankFrames(bitmap));
|
||||
handler.post(() -> insertBlankFrames(getBlankImageBitmap()));
|
||||
} else {
|
||||
// Generate audio silence in the AudioGraph by signalling null format.
|
||||
onMediaItemChanged(C.TRACK_TYPE_AUDIO, /* outputFormat= */ null);
|
||||
@ -359,6 +358,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
return sampleConsumer;
|
||||
}
|
||||
|
||||
private static Bitmap getBlankImageBitmap() {
|
||||
return Bitmap.createBitmap(
|
||||
new int[] {Color.BLACK},
|
||||
BLANK_IMAGE_BITMAP_WIDTH,
|
||||
BLANK_IMAGE_BITMAP_HEIGHT,
|
||||
Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
private void insertBlankFrames(Bitmap bitmap) {
|
||||
SampleConsumerWrapper videoSampleConsumer =
|
||||
checkNotNull(sampleConsumersByTrackType.get(C.TRACK_TYPE_VIDEO));
|
||||
|
Loading…
x
Reference in New Issue
Block a user