[FFmpeg-cvslog] avdevice/android_camera: Set image linesize aligment to 1

wangbin git at videolan.org
Fri Jul 18 05:40:04 EEST 2025


ffmpeg | branch: master | wangbin <wbsecg1 at gmail.com> | Mon Jun 23 11:48:38 2025 +0800| [7b13d17b6d88190c49e887134bba6a43d716d50a] | committer: Zhao Zhili

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 <zhilizhao at tencent.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b13d17b6d88190c49e887134bba6a43d716d50a
---

 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);
 



More information about the ffmpeg-cvslog mailing list