mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 13:17:13 +00:00
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).
This commit is contained in:
parent
4c72202eb1
commit
cdd8ba7224
@ -209,6 +209,8 @@ static void encode(struct ao *ao, double apts, void **data)
|
|||||||
AVFrame *frame = av_frame_alloc();
|
AVFrame *frame = av_frame_alloc();
|
||||||
frame->format = af_to_avformat(ao->format);
|
frame->format = af_to_avformat(ao->format);
|
||||||
frame->nb_samples = ac->aframesize;
|
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;
|
size_t num_planes = af_fmt_is_planar(ao->format) ? ao->channels.num : 1;
|
||||||
assert(num_planes <= AV_NUM_DATA_POINTERS);
|
assert(num_planes <= AV_NUM_DATA_POINTERS);
|
||||||
|
Loading…
Reference in New Issue
Block a user