diff mbox series

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

Message ID 20210415040223.4917-1-jamrial@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avformat/mpegts: set correct extradata size for Opus streams | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate fail Make fate failed
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

James Almer April 15, 2021, 4:02 a.m. UTC
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@gmail.com>
---
 libavformat/mpegts.c | 1 +
 1 file changed, 1 insertion(+)

Comments

James Almer April 16, 2021, 1:47 p.m. UTC | #1
On 4/15/2021 1:02 AM, James Almer wrote:
> 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@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");
>                   }

Will amend the patches with FATE changes and apply the set.
diff mbox series

Patch

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");
                 }