shithub: aubio

Download patch

ref: 265fe9a2ca606f8b9ae4a110390f26c139c01ad7
parent: a81b12a3b4174953b3bc7ef4c37103f4d5636740
author: Paul Brossier <piem@piem.org>
date: Mon Aug 6 11:54:37 EDT 2018

src/io/source_avcodec.c: give up reading file if number of channel changes during stream (closes #137)

--- a/src/io/source_avcodec.c
+++ b/src/io/source_avcodec.c
@@ -425,6 +425,13 @@
     goto beach;
   }
 
+  if (avFrame->channels != (sint_t)s->input_channels) {
+    AUBIO_WRN ("source_avcodec: trying to read from %d channel(s),"
+        "but configured for %d; is '%s' corrupt?\n", avFrame->channels,
+        s->input_channels, s->path);
+    goto beach;
+  }
+
 #ifdef HAVE_AVRESAMPLE
   in_linesize = 0;
   av_samples_get_buffer_size(&in_linesize, avCodecCtx->channels,