[FFmpeg-devel] [PATCH] avformat/mpegts: set correct extradata size for Opus streams

James Almer jamrial at gmail.com
Thu Apr 15 07:02:23 EEST 2021


map_type 0 is always 19 bytes, whereas map_type 1 and 255 are 21 + channel
count bytes.

Should fix ticket #9190.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/mpegts.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 6e0d9d7496..5343a14e38 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2030,6 +2030,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
                     st->codecpar->extradata[19] = opus_stream_cnt[channel_config_code];
                     st->codecpar->extradata[20] = opus_coupled_stream_cnt[channel_config_code];
                     memcpy(&st->codecpar->extradata[21], opus_channel_map[channels - 1], channels);
+                    st->codecpar->extradata_size = 19 + (st->codecpar->extradata[18] ? 2 + channels : 0);
                 } else {
                     avpriv_request_sample(fc, "Opus in MPEG-TS - channel_config_code > 0x8");
                 }
-- 
2.31.1



More information about the ffmpeg-devel mailing list