- if (!avfilter_merge_formats(link->in_formats, link->out_formats) ||
- !avfilter_merge_formats(link->in_chlayouts, link->out_chlayouts) ||
- !avfilter_merge_formats(link->in_packing, link->out_packing))
+ /* Merge all three list before checking: that way, in all
+ * three categories, aconvert will use a common format
+ * whenever possible. */
+ formats = avfilter_merge_formats(link->in_formats, link->out_formats);
+ chlayouts = avfilter_merge_formats(link->in_chlayouts, link->out_chlayouts);
+ packing = avfilter_merge_formats(link->in_packing, link->out_packing);
+ if (!formats || !chlayouts || !packing)