shithub: aubio

Download patch

ref: 230101d2de1f7e3c993dc16e3ac57d3cbacdd07c
parent: 6b98ab95cd5c58734143f73501a437f8f34b059d
parent: 58fe1975c6f954af50d2f03e20077dfdb0d93277
author: Paul Brossier <piem@piem.org>
date: Mon Aug 6 13:46:22 EDT 2018

Merge branch 'fix/avr_context'

--- a/src/io/source_avcodec.c
+++ b/src/io/source_avcodec.c
@@ -275,6 +275,8 @@
   // default to mono output
   aubio_source_avcodec_reset_resampler(s, 0);
 
+  if (s->avr == NULL) goto beach;
+
   s->eof = 0;
   s->multi = 0;
 
@@ -422,6 +424,15 @@
     AUBIO_WRN("source_avcodec: did not get a frame when reading %s\n", s->path);
     goto beach;
   }
+
+#if LIBAVUTIL_VERSION_MAJOR > 52
+  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;
+  }
+#endif
 
 #ifdef HAVE_AVRESAMPLE
   in_linesize = 0;