[FFmpeg-cvslog] hwcontext: Do not call device_init again when deriving an existing device

Mark Thompson git at videolan.org
Wed May 16 00:21:41 EEST 2018


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Mon May 14 22:58:56 2018 +0100| [136260eb88e80ed4f4712a341805ec1d0d69bbca] | committer: Mark Thompson

hwcontext: Do not call device_init again when deriving an existing device

The change in 309d660775e2b47af6723a0477c4d753bc0c54f4 to call device_init
when doing derivation missed this case - we should only call it if we
actually made a new device.

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

 libavutil/hwcontext.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 70c556ecac..745016ed7e 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -646,6 +646,9 @@ int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ref_ptr,
                     ret = AVERROR(ENOMEM);
                     goto fail;
                 }
+                ret = av_hwdevice_ctx_init(dst_ref);
+                if (ret < 0)
+                    goto fail;
                 goto done;
             }
             if (ret != AVERROR(ENOSYS))
@@ -658,10 +661,6 @@ int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ref_ptr,
     goto fail;
 
 done:
-    ret = av_hwdevice_ctx_init(dst_ref);
-    if (ret < 0)
-        goto fail;
-
     *dst_ref_ptr = dst_ref;
     return 0;
 



More information about the ffmpeg-cvslog mailing list