[FFmpeg-devel] [PATCH] avcodec/mmaldec: use zero-copy for AV_PIX_FMT_MMAL

Yevhen Kyriukha kirgene at gmail.com
Sun Sep 3 15:44:36 EEST 2017


Signed-off-by: Yevhen Kyriukha <kirgene at gmail.com>
---
 libavcodec/mmaldec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index 0b1195dc3e..19ca6ce7e7 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -295,6 +295,8 @@ static int ffmal_update_format(AVCodecContext *avctx)
         goto fail;
 
     if (avctx->pix_fmt == AV_PIX_FMT_MMAL) {
+        if ((status = mmal_port_parameter_set_boolean(decoder->output[0], MMAL_PARAMETER_ZERO_COPY, 1)))
+            goto fail;
         format_out->encoding = MMAL_ENCODING_OPAQUE;
     } else {
         format_out->encoding_variant = format_out->encoding = MMAL_ENCODING_I420;
@@ -332,7 +334,8 @@ static int ffmal_update_format(AVCodecContext *avctx)
         FFMAX(decoder->output[0]->buffer_size_min, decoder->output[0]->buffer_size_recommended);
     decoder->output[0]->buffer_num =
         FFMAX(decoder->output[0]->buffer_num_min, decoder->output[0]->buffer_num_recommended) + ctx->extra_buffers;
-    ctx->pool_out->pool = mmal_pool_create(decoder->output[0]->buffer_num,
+    ctx->pool_out->pool = mmal_port_pool_create(decoder->output[0],
+                                           decoder->output[0]->buffer_num,
                                            decoder->output[0]->buffer_size);
     if (!ctx->pool_out->pool) {
         ret = AVERROR(ENOMEM);
-- 
2.11.0



More information about the ffmpeg-devel mailing list