summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorekisu <dts.ramon@gmail.com>2020-08-07 03:27:17 -0300
committerwm4 <1387750+wm4@users.noreply.github.com>2020-08-07 19:42:42 +0200
commitcdd8ba7224a75582c5bcec4906d305f2341400ad (patch)
tree95b8d62df7c70a7634514c97665d28e8e7d480b8
parent4c72202eb1d0e772c81e8137e1772aafec486db4 (diff)
downloadmpv-cdd8ba7224a75582c5bcec4906d305f2341400ad.tar.bz2
mpv-cdd8ba7224a75582c5bcec4906d305f2341400ad.tar.xz
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).
-rw-r--r--audio/out/ao_lavc.c2
1 files changed, 2 insertions, 0 deletions
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);