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

Commit 0ed11d02 authored by Shuzhen Wang's avatar Shuzhen Wang Committed by android-build-merger
Browse files

Merge "ImageWriter: Do not override UNKNOWN format twice" into qt-qpr1-dev am: b78d7355

am: eae340df

Change-Id: I5fddcb6d0f55d88712b4d97c76234eea0c1a5f2c
parents a6507293 eae340df
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -192,13 +192,15 @@ public class ImageWriter implements AutoCloseable {

        mMaxImages = maxImages;

        if (format == ImageFormat.UNKNOWN) {
            format = SurfaceUtils.getSurfaceFormat(surface);
        }
        // Note that the underlying BufferQueue is working in synchronous mode
        // to avoid dropping any buffers.
        mNativeContext = nativeInit(new WeakReference<>(this), surface, maxImages, format);

        // nativeInit internally overrides UNKNOWN format. So does surface format query after
        // nativeInit and before getEstimatedNativeAllocBytes().
        if (format == ImageFormat.UNKNOWN) {
            format = SurfaceUtils.getSurfaceFormat(surface);
        }
        // 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.