hwcontext_opencl: use ff_hwframe_map_replace()
authorRostislav Pehlivanov <atomnuker@gmail.com>
Fri, 20 Apr 2018 04:30:04 +0000 (05:30 +0100)
committerRostislav Pehlivanov <atomnuker@gmail.com>
Thu, 21 Jun 2018 15:34:10 +0000 (16:34 +0100)
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
libavutil/hwcontext_opencl.c

index 07458c2..d288ddb 100644 (file)
@@ -2172,10 +2172,7 @@ static int opencl_map_from_vaapi(AVHWFramesContext *dst_fc,
     if (err < 0)
         goto fail;
 
-    // Adjust the map descriptor so that unmap works correctly.
-    hwmap = (HWMapDescriptor*)dst->buf[0]->data;
-    av_frame_unref(hwmap->source);
-    err = av_frame_ref(hwmap->source, src);
+    err = ff_hwframe_map_replace(dst, src);
 
 fail:
     av_frame_free(&tmp);