diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 710ad7c530..fdb93b835f 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -332,9 +332,12 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) st ->sample_aspect_ratio = par->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(sink); } else if (par->codec_type == AVMEDIA_TYPE_AUDIO) { - par->channels = av_buffersink_get_channels(sink); par->sample_rate = av_buffersink_get_sample_rate(sink); - par->channel_layout = av_buffersink_get_channel_layout(sink); + ret = av_channel_layout_from_mask(&par->ch_layout, av_buffersink_get_channel_layout(sink)); + if (ret < 0) { + par->ch_layout.nb_channels = av_buffersink_get_channels(sink); + par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; + } par->format = av_buffersink_get_format(sink); par->codec_id = av_get_pcm_codec(par->format, -1); if (par->codec_id == AV_CODEC_ID_NONE)