avfiltergraph: kill uninitialized variable warning
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 30 Aug 2012 09:02:15 +0000 (11:02 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 30 Aug 2012 09:02:15 +0000 (11:02 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/avfiltergraph.c

index 8a5f106..7ab1124 100644 (file)
@@ -630,7 +630,7 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter)
 
     for (i = 0; i < filter->nb_outputs; i++) {
         AVFilterLink *outlink = filter->outputs[i];
-        int best_idx, best_score = INT_MIN, best_count_diff = INT_MAX;
+        int best_idx = -1, best_score = INT_MIN, best_count_diff = INT_MAX;
 
         if (outlink->type != AVMEDIA_TYPE_AUDIO ||
             outlink->in_channel_layouts->nb_channel_layouts < 2)
@@ -679,6 +679,7 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter)
                 best_count_diff = count_diff;
             }
         }
+        av_assert1(best_idx>=0);
         FFSWAP(uint64_t, outlink->in_channel_layouts->channel_layouts[0],
                outlink->in_channel_layouts->channel_layouts[best_idx]);
     }