Loading core/java/android/hardware/camera2/params/StreamConfigurationMap.java +12 −3 Original line number Diff line number Diff line Loading @@ -1917,9 +1917,18 @@ public final class StreamConfigurationMap { (3 << HAL_DATASPACE_TRANSFER_SHIFT) | (1 << HAL_DATASPACE_RANGE_SHIFT); private static final int HAL_DATASPACE_DEPTH = 0x1000; private static final int HAL_DATASPACE_DYNAMIC_DEPTH = 0x1002; private static final int HAL_DATASPACE_HEIF = 0x1003; /** * @hide */ public static final int HAL_DATASPACE_DEPTH = 0x1000; /** * @hide */ public static final int HAL_DATASPACE_DYNAMIC_DEPTH = 0x1002; /** * @hide */ public static final int HAL_DATASPACE_HEIF = 0x1003; private static final long DURATION_20FPS_NS = 50000000L; /** * @see #getDurations(int, int) Loading media/java/android/media/ImageWriter.java +20 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.graphics.ImageFormat; import android.graphics.ImageFormat.Format; import android.graphics.PixelFormat; import android.graphics.Rect; import android.hardware.camera2.params.StreamConfigurationMap; import android.hardware.camera2.utils.SurfaceUtils; import android.hardware.HardwareBuffer; import android.os.Handler; Loading Loading @@ -202,6 +203,25 @@ public class ImageWriter implements AutoCloseable { if (format == ImageFormat.UNKNOWN) { format = SurfaceUtils.getSurfaceFormat(surface); } // Several public formats use the same native HAL_PIXEL_FORMAT_BLOB. The native // allocation estimation sequence depends on the public formats values. To avoid // possible errors, convert where necessary. if (format == StreamConfigurationMap.HAL_PIXEL_FORMAT_BLOB) { int surfaceDataspace = SurfaceUtils.getSurfaceDataspace(surface); switch (surfaceDataspace) { case StreamConfigurationMap.HAL_DATASPACE_DEPTH: format = ImageFormat.DEPTH_POINT_CLOUD; break; case StreamConfigurationMap.HAL_DATASPACE_DYNAMIC_DEPTH: format = ImageFormat.DEPTH_JPEG; break; case StreamConfigurationMap.HAL_DATASPACE_HEIF: format = ImageFormat.HEIC; break; default: format = ImageFormat.JPEG; } } // 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. Loading Loading
core/java/android/hardware/camera2/params/StreamConfigurationMap.java +12 −3 Original line number Diff line number Diff line Loading @@ -1917,9 +1917,18 @@ public final class StreamConfigurationMap { (3 << HAL_DATASPACE_TRANSFER_SHIFT) | (1 << HAL_DATASPACE_RANGE_SHIFT); private static final int HAL_DATASPACE_DEPTH = 0x1000; private static final int HAL_DATASPACE_DYNAMIC_DEPTH = 0x1002; private static final int HAL_DATASPACE_HEIF = 0x1003; /** * @hide */ public static final int HAL_DATASPACE_DEPTH = 0x1000; /** * @hide */ public static final int HAL_DATASPACE_DYNAMIC_DEPTH = 0x1002; /** * @hide */ public static final int HAL_DATASPACE_HEIF = 0x1003; private static final long DURATION_20FPS_NS = 50000000L; /** * @see #getDurations(int, int) Loading
media/java/android/media/ImageWriter.java +20 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.graphics.ImageFormat; import android.graphics.ImageFormat.Format; import android.graphics.PixelFormat; import android.graphics.Rect; import android.hardware.camera2.params.StreamConfigurationMap; import android.hardware.camera2.utils.SurfaceUtils; import android.hardware.HardwareBuffer; import android.os.Handler; Loading Loading @@ -202,6 +203,25 @@ public class ImageWriter implements AutoCloseable { if (format == ImageFormat.UNKNOWN) { format = SurfaceUtils.getSurfaceFormat(surface); } // Several public formats use the same native HAL_PIXEL_FORMAT_BLOB. The native // allocation estimation sequence depends on the public formats values. To avoid // possible errors, convert where necessary. if (format == StreamConfigurationMap.HAL_PIXEL_FORMAT_BLOB) { int surfaceDataspace = SurfaceUtils.getSurfaceDataspace(surface); switch (surfaceDataspace) { case StreamConfigurationMap.HAL_DATASPACE_DEPTH: format = ImageFormat.DEPTH_POINT_CLOUD; break; case StreamConfigurationMap.HAL_DATASPACE_DYNAMIC_DEPTH: format = ImageFormat.DEPTH_JPEG; break; case StreamConfigurationMap.HAL_DATASPACE_HEIF: format = ImageFormat.HEIC; break; default: format = ImageFormat.JPEG; } } // 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. Loading