ffmpeg | branch: master | James Almer <jamr...@gmail.com> | Mon Mar 21 08:48:19 
2022 -0300| [37f44406829d477e27aa9440327b86b4355cf6c9] | committer: James Almer

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 <jamr...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37f44406829d477e27aa9440327b86b4355cf6c9
---

 libavformat/demux.c | 3 +++
 1 file changed, 3 insertions(+)

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) {

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to