]> git.sesse.net Git - ffmpeg/commitdiff
pthread_frame: use av_buffer_replace() to simplify code
authorAnton Khirnov <anton@khirnov.net>
Fri, 5 Jun 2020 09:24:19 +0000 (11:24 +0200)
committerAnton Khirnov <anton@khirnov.net>
Mon, 28 Sep 2020 09:33:36 +0000 (11:33 +0200)
libavcodec/pthread_frame.c

index 3255aa933712f349bc55523418e0c160b080d725..f8a01ad8cdc3102706f9dc7e7d614064a2200859 100644 (file)
@@ -297,16 +297,9 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
 
         dst->hwaccel_flags = src->hwaccel_flags;
 
-        if (!!dst->internal->pool != !!src->internal->pool ||
-            (dst->internal->pool && dst->internal->pool->data != src->internal->pool->data)) {
-            av_buffer_unref(&dst->internal->pool);
-
-            if (src->internal->pool) {
-                dst->internal->pool = av_buffer_ref(src->internal->pool);
-                if (!dst->internal->pool)
-                    return AVERROR(ENOMEM);
-            }
-        }
+        err = av_buffer_replace(&dst->internal->pool, src->internal->pool);
+        if (err < 0)
+            return err;
     }
 
     if (for_user) {