From cdd8ba7224a75582c5bcec4906d305f2341400ad Mon Sep 17 00:00:00 2001 From: ekisu Date: Fri, 7 Aug 2020 03:27:17 -0300 Subject: ao/lavc: add channels and channel_layout to AVFrame FFmpeg expects those fields to be set on the AVFrame when encoding audio, not doing so will cause the avcodec_send_frame call to return EINVAL (at least in recent builds). --- audio/out/ao_lavc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'audio') diff --git a/audio/out/ao_lavc.c b/audio/out/ao_lavc.c index 33e82219b0..c524e9e02d 100644 --- a/audio/out/ao_lavc.c +++ b/audio/out/ao_lavc.c @@ -209,6 +209,8 @@ static void encode(struct ao *ao, double apts, void **data) AVFrame *frame = av_frame_alloc(); frame->format = af_to_avformat(ao->format); frame->nb_samples = ac->aframesize; + frame->channels = encoder->channels; + frame->channel_layout = encoder->channel_layout; size_t num_planes = af_fmt_is_planar(ao->format) ? ao->channels.num : 1; assert(num_planes <= AV_NUM_DATA_POINTERS); -- cgit v1.2.3