]> git.sesse.net Git - ffmpeg/blobdiff - libswresample/swresample.c
Merge commit 'd2a25c4032ce6ceabb0f51b5c1e6ca865395a793'
[ffmpeg] / libswresample / swresample.c
index b192bfdfa97dce638a29bac912878aca0dc8bf64..9c2e3f50008a3f02fc1a7f58efe1331783d5d348 100644 (file)
@@ -265,6 +265,16 @@ av_cold int swr_init(struct SwrContext *s){
         return AVERROR(EINVAL);
     }
 
+    if(av_get_channel_layout_nb_channels(s-> in_ch_layout) > SWR_CH_MAX) {
+        av_log(s, AV_LOG_WARNING, "Input channel layout 0x%"PRIx64" is invalid or unsupported.\n", s-> in_ch_layout);
+        s->in_ch_layout = 0;
+    }
+
+    if(av_get_channel_layout_nb_channels(s->out_ch_layout) > SWR_CH_MAX) {
+        av_log(s, AV_LOG_WARNING, "Output channel layout 0x%"PRIx64" is invalid or unsupported.\n", s->out_ch_layout);
+        s->out_ch_layout = 0;
+    }
+
     switch(s->engine){
 #if CONFIG_LIBSOXR
         extern struct Resampler const soxr_resampler;