swresample: Try to handle cases with input channel count and layout mismatching.
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 6 Oct 2011 17:17:38 +0000 (19:17 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 6 Oct 2011 18:21:40 +0000 (20:21 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libswresample/swresample.c

index 65591f3..c7b206e 100644 (file)
@@ -177,6 +177,11 @@ int swr_init(SwrContext *s){
         return -1;
     }
 
+    if(s-> in.ch_count && s->in.ch_count != av_get_channel_layout_nb_channels(s-> in_ch_layout)){
+        av_log(s, AV_LOG_WARNING, "Input channel layout has a different number of channels than there actually is, ignoring layout\n");
+        s-> in_ch_layout= 0;
+    }
+
     if(!s-> in_ch_layout)
         s-> in_ch_layout= guess_layout(s->in.ch_count);
     if(!s->out_ch_layout)