Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fabe8378 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala Committed by android-build-merger
Browse files

Merge "ImageReader/Writer: Only register 1 buffer for native allocation" into...

Merge "ImageReader/Writer: Only register 1 buffer for native allocation" into nyc-dev am: ef1513b0 am: 36b5c1a5
am: b11f0228

* commit 'b11f0228':
  ImageReader/Writer: Only register 1 buffer for native allocation

Change-Id: Ieae0c12b5bce3d61b649663632eb0be1ba76fce1
parents 4e334c9b b11f0228
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -157,8 +157,11 @@ public class ImageReader implements AutoCloseable {
        // Estimate the native buffer allocation size and register it so it gets accounted for
        // during GC. Note that this doesn't include the buffers required by the buffer queue
        // itself and the buffers requested by the producer.
        mEstimatedNativeAllocBytes = ImageUtils.getEstimatedNativeAllocBytes(width, height, format,
                maxImages);
        // Only include memory for 1 buffer, since actually accounting for the memory used is
        // complex, and 1 buffer is enough for the VM to treat the ImageReader as being of some
        // size.
        mEstimatedNativeAllocBytes = ImageUtils.getEstimatedNativeAllocBytes(
                width, height, format, /*buffer count*/ 1);
        VMRuntime.getRuntime().registerNativeAllocation(mEstimatedNativeAllocBytes);
    }

+4 −1
Original line number Diff line number Diff line
@@ -138,11 +138,14 @@ public class ImageWriter implements AutoCloseable {
        // Estimate the native buffer allocation size and register it so it gets accounted for
        // during GC. Note that this doesn't include the buffers required by the buffer queue
        // itself and the buffers requested by the producer.
        // Only include memory for 1 buffer, since actually accounting for the memory used is
        // complex, and 1 buffer is enough for the VM to treat the ImageWriter as being of some
        // size.
        Size surfSize = SurfaceUtils.getSurfaceSize(surface);
        int format = SurfaceUtils.getSurfaceFormat(surface);
        mEstimatedNativeAllocBytes =
                ImageUtils.getEstimatedNativeAllocBytes(surfSize.getWidth(),surfSize.getHeight(),
                        format, maxImages);
                        format, /*buffer count*/ 1);
        VMRuntime.getRuntime().registerNativeAllocation(mEstimatedNativeAllocBytes);
    }