From 7b13d17b6d88190c49e887134bba6a43d716d50a Mon Sep 17 00:00:00 2001 From: wangbin Date: Mon, 23 Jun 2025 11:48:38 +0800 Subject: [PATCH] avdevice/android_camera: Set image linesize aligment to 1 Can't read alignment from packet, codecpar or decoded frame linesizes, so don't set it. My test device redmi k60 produces images in 4624x3472, not 32 aligned Signed-off-by: Zhao Zhili --- libavdevice/android_camera.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavdevice/android_camera.c b/libavdevice/android_camera.c index 5de44e6d86..8433286296 100644 --- a/libavdevice/android_camera.c +++ b/libavdevice/android_camera.c @@ -421,7 +421,7 @@ static void image_available(void *context, AImageReader *reader) } } - pkt_buffer_size = av_image_get_buffer_size(ctx->image_format, ctx->width, ctx->height, 32); + pkt_buffer_size = av_image_get_buffer_size(ctx->image_format, ctx->width, ctx->height, 1); AImage_getTimestamp(image, &image_timestamp); AImage_getPlaneRowStride(image, 0, &image_linestrides[0]); @@ -460,7 +460,7 @@ static void image_available(void *context, AImageReader *reader) av_image_copy_to_buffer(pkt.data, pkt_buffer_size, (const uint8_t * const *) image_plane_data, image_linestrides, ctx->image_format, - ctx->width, ctx->height, 32); + ctx->width, ctx->height, 1); ret = av_thread_message_queue_send(ctx->input_queue, &pkt, AV_THREAD_MESSAGE_NONBLOCK);