]> git.sesse.net Git - ffmpeg/commitdiff
lavfi/buffersrc: fix directly setting channel layout
authorRostislav Pehlivanov <atomnuker@gmail.com>
Tue, 21 Feb 2017 06:51:46 +0000 (06:51 +0000)
committerRostislav Pehlivanov <atomnuker@gmail.com>
Tue, 21 Feb 2017 16:25:47 +0000 (16:25 +0000)
When setting the channel layout directly using AVBufferSrcParameters
the channel layout was correctly set however the init function still
expected the old string format to set the number of channels (when it
hadn't already been specified).

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
libavfilter/buffersrc.c

index 77fd17421900accccffce1e7bfcdbb0052d0a51a..3f80d5f413c544ecea2832a59b23827fba345794 100644 (file)
@@ -341,14 +341,16 @@ static av_cold int init_audio(AVFilterContext *ctx)
         return AVERROR(EINVAL);
     }
 
-    if (s->channel_layout_str) {
+    if (s->channel_layout_str || s->channel_layout) {
         int n;
 
-        s->channel_layout = av_get_channel_layout(s->channel_layout_str);
         if (!s->channel_layout) {
-            av_log(ctx, AV_LOG_ERROR, "Invalid channel layout %s.\n",
-                   s->channel_layout_str);
-            return AVERROR(EINVAL);
+            s->channel_layout = av_get_channel_layout(s->channel_layout_str);
+            if (!s->channel_layout) {
+                av_log(ctx, AV_LOG_ERROR, "Invalid channel layout %s.\n",
+                       s->channel_layout_str);
+                return AVERROR(EINVAL);
+            }
         }
         n = av_get_channel_layout_nb_channels(s->channel_layout);
         if (s->channels) {