summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/utils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 95d2193abc..61893da429 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;