aboutsummaryrefslogtreecommitdiff
path: root/core/recipes-multimedia/ffmpeg/ffmpeg/0007-avcodec-v4l2-set-sizeimage-param-for-non-raw-buffers.patch
diff options
context:
space:
mode:
Diffstat (limited to 'core/recipes-multimedia/ffmpeg/ffmpeg/0007-avcodec-v4l2-set-sizeimage-param-for-non-raw-buffers.patch')
-rw-r--r--core/recipes-multimedia/ffmpeg/ffmpeg/0007-avcodec-v4l2-set-sizeimage-param-for-non-raw-buffers.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/core/recipes-multimedia/ffmpeg/ffmpeg/0007-avcodec-v4l2-set-sizeimage-param-for-non-raw-buffers.patch b/core/recipes-multimedia/ffmpeg/ffmpeg/0007-avcodec-v4l2-set-sizeimage-param-for-non-raw-buffers.patch
new file mode 100644
index 0000000..9c29c36
--- /dev/null
+++ b/core/recipes-multimedia/ffmpeg/ffmpeg/0007-avcodec-v4l2-set-sizeimage-param-for-non-raw-buffers.patch
@@ -0,0 +1,60 @@
+From af4580f7e05b1ad26ad9d89cb39bc3f9851a72a3 Mon Sep 17 00:00:00 2001
+From: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
+Date: Wed, 4 Oct 2017 10:50:31 +0200
+Subject: [PATCH 7/7] avcodec/v4l2: set sizeimage param for non-raw buffers
+ [fixes #6716]
+
+Some V4L2 drivers fail to allocate buffers when sizeimage is not set
+to a max value. This is indeed the case for sp5-mfc [1]
+
+Most drivers should be able to calculate this value from the frame
+dimensions and format - or at least have their own default.
+
+However since this work around should not impact those drivers doing
+the "right thing" this commit just provides such a default.
+
+[1] linux.git/drivers/media/platform/s5p-mfc
+---
+ libavcodec/v4l2_context.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
+index 7365d6c76b..34cd46283a 100644
+--- a/libavcodec/v4l2_context.c
++++ b/libavcodec/v4l2_context.c
+@@ -92,6 +92,8 @@ static inline int v4l2_type_supported(V4L2Context *ctx)
+
+ static inline void v4l2_save_to_context(V4L2Context* ctx, struct v4l2_format_update *fmt)
+ {
++ const int MAX_SIZEIMAGE = 2 * 1024 * 1024;
++
+ ctx->format.type = ctx->type;
+
+ if (fmt->update_avfmt)
+@@ -101,13 +103,21 @@ static inline void v4l2_save_to_context(V4L2Context* ctx, struct v4l2_format_upd
+ /* update the sizes to handle the reconfiguration of the capture stream at runtime */
+ ctx->format.fmt.pix_mp.height = ctx->height;
+ ctx->format.fmt.pix_mp.width = ctx->width;
+- if (fmt->update_v4l2)
++ if (fmt->update_v4l2) {
+ ctx->format.fmt.pix_mp.pixelformat = fmt->v4l2_fmt;
++
++ /* s5p-mfc requires the user to specify MAX buffer size */
++ ctx->format.fmt.pix_mp.plane_fmt[0].sizeimage = MAX_SIZEIMAGE;
++ }
+ } else {
+ ctx->format.fmt.pix.height = ctx->height;
+ ctx->format.fmt.pix.width = ctx->width;
+- if (fmt->update_v4l2)
++ if (fmt->update_v4l2) {
+ ctx->format.fmt.pix.pixelformat = fmt->v4l2_fmt;
++
++ /* s5p-mfc requires the user to specify MAX buffer size */
++ ctx->format.fmt.pix.sizeimage = MAX_SIZEIMAGE;
++ }
+ }
+ }
+
+--
+2.14.2
+