[FFmpeg-cvslog] lavc: set avctx->hwaccel before init

wm4 git at videolan.org
Wed Nov 1 23:50:08 EET 2017


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Tue Jun  6 18:51:08 2017 +0200| [bd747b9226414007f0207fa201976af7217e3b77] | committer: Diego Biurrun

lavc: set avctx->hwaccel before init

So a hwaccel can access avctx->hwaccel in init for whatever reason. This
is for the new d3d hwaccel API. We could create separate entrypoints for
each of the 3 hwaccel types (dxva2, d3d11va, new d3d11va), but this
seems nicer.

Signed-off-by: Diego Biurrun <diego at biurrun.de>

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

 libavcodec/decode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index bb58dfc561..ae2c715677 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -746,16 +746,16 @@ static int setup_hwaccel(AVCodecContext *avctx,
             return AVERROR(ENOMEM);
     }
 
+    avctx->hwaccel = hwa;
     if (hwa->init) {
         ret = hwa->init(avctx);
         if (ret < 0) {
             av_freep(&avctx->internal->hwaccel_priv_data);
+            avctx->hwaccel = NULL;
             return ret;
         }
     }
 
-    avctx->hwaccel = hwa;
-
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list