Browse code

lavfi/buffersrc: check channel count changes.

Nicolas George authored on 2013/03/17 01:45:22
Showing 1 changed files
... ...
@@ -68,9 +68,9 @@ typedef struct {
68 68
         av_log(s, AV_LOG_INFO, "Changing frame properties on the fly is not supported by all filters.\n");\
69 69
     }
70 70
 
71
-#define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, ch_layout, format)\
71
+#define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, ch_layout, ch_count, format)\
72 72
     if (c->sample_fmt != format || c->sample_rate != srate ||\
73
-        c->channel_layout != ch_layout) {\
73
+        c->channel_layout != ch_layout || c->channels != ch_count) {\
74 74
         av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\
75 75
         return AVERROR(EINVAL);\
76 76
     }
... ...
@@ -138,7 +138,7 @@ static int attribute_align_arg av_buffersrc_add_frame_internal(AVFilterContext *
138 138
         if (!frame->channel_layout)
139 139
             frame->channel_layout = s->channel_layout;
140 140
         CHECK_AUDIO_PARAM_CHANGE(ctx, s, frame->sample_rate, frame->channel_layout,
141
-                                 frame->format);
141
+                                 av_frame_get_channels(frame), frame->format);
142 142
         break;
143 143
     default:
144 144
         return AVERROR(EINVAL);