Browse code

lavfi/buffersrc: set channel layout if it is known.

If buffersrc was configured for frames with an unknown layout,
the incoming frames will have channel_layout = 0.
If the format negotiation has selected a known (and compatible)
channel layout for the link, the frame is assumed to have
that layout, the field must be set before injecting the frame
in the filters.

Nicolas George authored on 2013/02/17 23:45:12
Showing 1 changed files
... ...
@@ -121,6 +121,8 @@ int av_buffersrc_add_ref(AVFilterContext *s, AVFilterBufferRef *buf, int flags)
121 121
             CHECK_VIDEO_PARAM_CHANGE(s, c, buf->video->w, buf->video->h, buf->format);
122 122
             break;
123 123
         case AVMEDIA_TYPE_AUDIO:
124
+            if (!buf->audio->channel_layout)
125
+                buf->audio->channel_layout = c->channel_layout;
124 126
             CHECK_AUDIO_PARAM_CHANGE(s, c, buf->audio->sample_rate, buf->audio->channel_layout,
125 127
                                      buf->format);
126 128
             break;
... ...
@@ -370,6 +372,8 @@ static int config_props(AVFilterLink *link)
370 370
         link->sample_aspect_ratio = c->pixel_aspect;
371 371
         break;
372 372
     case AVMEDIA_TYPE_AUDIO:
373
+        if (!c->channel_layout)
374
+            c->channel_layout = link->channel_layout;
373 375
         break;
374 376
     default:
375 377
         return AVERROR(EINVAL);