Module: libav
Branch: master
Commit: 4ff670d99bebd97429322719089363d83143477d

Author:    Rémi Denis-Courmont <[email protected]>
Committer: Luca Barbato <[email protected]>
Date:      Wed Oct 29 19:07:20 2014 +0200

hwaccel: Deinitialize hardware acceleration early enough

The application will destroy the underlying hardware handles when
get_format() gets called again. Also this ensures the
deinitialization takes place if the get_format callback returns an
error.

Regression from 1c80c9d7ef809180042257200c7b5f6b81d0b0e2.

Signed-off-by: Luca Barbato <[email protected]>

---

 libavcodec/utils.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 95d2193..61893da 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -948,6 +948,11 @@ int ff_get_format(AVCodecContext *avctx, const enum 
AVPixelFormat *fmt)
     memcpy(choices, fmt, (n + 1) * sizeof(*choices));
 
     for (;;) {
+        if (avctx->hwaccel && avctx->hwaccel->uninit)
+            avctx->hwaccel->uninit(avctx);
+        av_freep(&avctx->internal->hwaccel_priv_data);
+        avctx->hwaccel = NULL;
+
         ret = avctx->get_format(avctx, choices);
 
         desc = av_pix_fmt_desc_get(ret);
@@ -956,11 +961,6 @@ int ff_get_format(AVCodecContext *avctx, const enum 
AVPixelFormat *fmt)
             break;
         }
 
-        if (avctx->hwaccel && avctx->hwaccel->uninit)
-            avctx->hwaccel->uninit(avctx);
-        av_freep(&avctx->internal->hwaccel_priv_data);
-        avctx->hwaccel = NULL;
-
         if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
             break;
 

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to