[FFmpeg-devel] [PATCH 08/10] lavf/matroskaenc: don't rewrite extradata if we already have some

James Almer jamrial at gmail.com
Fri Mar 16 00:36:58 EET 2018


On 3/14/2018 3:24 AM, Rodger Combs wrote:
> matroska doesn't support mid-stream extradata changes

How so? We update flac extradata as sent by the encoder in the last
packet as side data.

> , and rewriting
> the same extradata already written in write_header would cause errors
> since we previously didn't write a filler void.

When would this happen? What sets both extradata in codecpar then sends
new one as packet side data for AAC audio?

> ---
>  libavformat/matroskaenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 5950b4de44..e4db5a9a1c 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -2266,7 +2266,8 @@ static int mkv_check_new_extra_data(AVFormatContext *s, AVPacket *pkt)
>  
>      switch (par->codec_id) {
>      case AV_CODEC_ID_AAC:
> -        if (side_data_size && (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) {
> +        if (side_data_size && !par->extradata_size &&
> +            (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) {
>              int filler, output_sample_rate = 0;
>              int64_t curpos;
>              ret = get_aac_sample_rates(s, side_data, side_data_size, &track->sample_rate,
> 



More information about the ffmpeg-devel mailing list