@@ -2702,6 +2702,7 @@ static int stream_component_open(VideoState *is, int stream_index)
case AVMEDIA_TYPE_AUDIO:
{
AVFilterContext *sink;
+ AVFrame *params = NULL;
is->audio_filter_src.freq = avctx->sample_rate;
ret = av_channel_layout_copy(&is->audio_filter_src.ch_layout, &avctx->ch_layout);
@@ -2711,10 +2712,23 @@ static int stream_component_open(VideoState *is, int stream_index)
if ((ret = configure_audio_filters(is, afilters, 0)) < 0)
goto fail;
sink = is->out_audio_filter;
- sample_rate = av_buffersink_get_sample_rate(sink);
- ret = av_buffersink_get_ch_layout(sink, &ch_layout);
- if (ret < 0)
+
+ params = av_frame_alloc();
+ if (!params) {
+ ret = AVERROR(ENOMEM);
goto fail;
+ }
+
+ ret = av_buffersink_get_frame_flags(sink, params, AV_BUFFERSINK_FLAG_PARAMS);
+ if (ret < 0) {
+ av_frame_free(¶ms);
+ goto fail;
+ }
+
+ sample_rate = params->sample_rate;
+ FFSWAP(AVChannelLayout, ch_layout, params->ch_layout);
+
+ av_frame_free(¶ms);
}
/* prepare audio output */