Commit 12925ef8 authored by vikassoni's avatar vikassoni Committed by Commit Bot

Update AImageReader max images for android MediaPlayer.

Update AImageReader in android MediaPlayer path to use max_images of 2
instead of 3.

This is a follow up CL of similar changes done in MCVD path -
https://chromium-review.googlesource.com/c/chromium/src/+/1678292

This change is to reduce the memory usage footprint.

Bug: 981098
Change-Id: I9d9e629f21e38a607c41ff7df951a5ee5d482e54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1688203
Auto-Submit: vikas soni <vikassoni@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Reviewed-by: default avatarGreg Kerr <kerrnel@chromium.org>
Commit-Queue: vikas soni <vikassoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676155}
parent 66ec4977
......@@ -102,7 +102,12 @@ ImageReader::ImageReader(GLuint texture_id)
// Set the width, height and format to some default value. This parameters
// are/maybe overriden by the producer sending buffers to this imageReader's
// Surface.
int32_t width = 1, height = 1, max_images = 3;
// Note that max_images should be as small as possible to limit the memory
// usage. ImageReader needs 2 images to mimic the behavior of SurfaceTexture.
// Also note that we always acquire an image before deleting the
// previous acquired image. This causes 2 acquired images to be in flight at
// the image acquisition point until the previous image is deleted.
int32_t width = 1, height = 1, max_images = 2;
AIMAGE_FORMATS format = AIMAGE_FORMAT_YUV_420_888;
AImageReader* reader = nullptr;
// The usage flag below should be used when the buffer will be read from by
......@@ -194,7 +199,12 @@ void ImageReader::UpdateTexImage() {
// This method duplicates the fence file descriptor and the caller is
// responsible for closing the returend file descriptor.
return_code = loader_.AImageReader_acquireLatestImageAsync(
// We now use AcquireNextImageAsync() instead of AcquireLatestImageAsync()
// because AcquireLatestImageAsync() only works when
// max_images-number_of_acquired_images >= 2. This is now not true for our
// AImageReader use case with max_images=2 since we always have one previously
// acquired image when we try to acquire a new image.
return_code = loader_.AImageReader_acquireNextImageAsync(
image_reader_, &image, &acquire_fence_fd);
// Log the error return code.
......
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 to comment