diff options
author | James Almer <jamrial@gmail.com> | 2022-03-21 08:48:19 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-21 08:50:28 -0300 |
commit | 37f44406829d477e27aa9440327b86b4355cf6c9 (patch) | |
tree | 8619f024a0c936e33dc84cbb7a04b45471350c74 /libavformat | |
parent | 505a7d39cd9990428899241a017ef523e236b9ca (diff) | |
download | ffmpeg-37f44406829d477e27aa9440327b86b4355cf6c9.tar.gz |
avformat/demux: ensure ch_layout is not lost in the stream's internal avctx
This is a workaround until avcodec_close() stops freeing ch_layout through
av_opt_fre(), or the former is removed.
Fixes a regression since 327efa66331ebdc0087c6b656059a8df2f404019.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/demux.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/demux.c b/libavformat/demux.c index c1c9422ac0..ac1f16edcd 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -2957,6 +2957,9 @@ find_stream_info_err: av_freep(&sti->info); } avcodec_close(sti->avctx); + // FIXME: avcodec_close() frees AVOption settable fields which includes ch_layout, + // so we need to restore it. + av_channel_layout_copy(&sti->avctx->ch_layout, &st->codecpar->ch_layout); av_bsf_free(&sti->extract_extradata.bsf); } if (ic->pb) { |