[FFmpeg-cvslog] lavfi/buffersrc: fix directly setting channel layout

Rostislav Pehlivanov git at videolan.org
Tue Feb 21 18:27:00 EET 2017


ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Tue Feb 21 06:51:46 2017 +0000| [42959044ac7dc40d5593cca2386d26257a615e5b] | committer: Rostislav Pehlivanov

lavfi/buffersrc: fix directly setting channel layout

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=42959044ac7dc40d5593cca2386d26257a615e5b
---

 libavfilter/buffersrc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 77fd174..3f80d5f 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -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) {



More information about the ffmpeg-cvslog mailing list