-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
What does “Zionism” mean? - http://shlom.in/def-zionism

It is impossible to make anything foolproof because fools are so ingenious.
    — Source Unknown

Please reply to list if it's a mailing list post - http://shlom.in/reply .
>From 98e0629d28394f8683abd98f80645ee63b295d24 Mon Sep 17 00:00:00 2001
From: Shlomi Fish <shlo...@shlomifish.org>
Date: Wed, 4 Jul 2018 22:53:08 +0300
Subject: [PATCH] Short-circuit several calls on a condition.

This is an optimization - more details in the comment in the changeset.
---
 libavformat/metadata.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/metadata.c b/libavformat/metadata.c
index b9b6de7972..4b720efd38 100644
--- a/libavformat/metadata.c
+++ b/libavformat/metadata.c
@@ -60,6 +60,10 @@ void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv,
                                                 const AVMetadataConv *s_conv)
 {
     int i;
+    /* We pass those to all ff_metadata_conv calls below and it returns
+     * immediately if they are equal, so we can short-circuit. */
+    if (d_conv == s_conv)
+        return;
     ff_metadata_conv(&ctx->metadata, d_conv, s_conv);
     for (i=0; i<ctx->nb_streams ; i++)
         ff_metadata_conv(&ctx->streams [i]->metadata, d_conv, s_conv);
-- 
2.18.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to