John Stebbins (12020-05-02):
> extradata changing would result in an invalid stream.
> also, as the code was written, rewriting extradata was corrupting the
> track header resulting in an invalid file.

Invalid and undecodable.

> ---
>  libavformat/matroskaenc.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 784973a951..d6932bdb5b 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -2183,6 +2183,14 @@ static int mkv_check_new_extra_data(AVFormatContext 
> *s, const AVPacket *pkt)
>      case AV_CODEC_ID_AAC:
>          if (side_data_size && (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && 
> !mkv->is_live) {
>              int filler, output_sample_rate = 0;
> +            if (par->extradata && par->extradata_size)
> +                if (par->extradata_size != side_data_size ||
> +                    memcmp(par->extradata, side_data, side_data_size)) {
> +                    av_log(s, AV_LOG_ERROR, "Error, AAC extradata changed 
> mid-stream.\n");
> +                    return AVERROR_INPUT_CHANGED;
> +                } else // Already written
> +                    break;
> +

Style nit: do not omit braces on else when the if has them; do not omit
braces on the outer if when the inner if has them. Just my taste and
what I observed in the rest of the code.

>              ret = get_aac_sample_rates(s, side_data, side_data_size, 
> &track->sample_rate,
>                                         &output_sample_rate);
>              if (ret < 0)

Thanks, I think it does the right thing.

Regards,

-- 
  Nicolas George

Attachment: signature.asc
Description: PGP signature

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

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

Reply via email to