diff options
author | John Stebbins <[email protected]> | 2020-05-03 09:32:45 -0600 |
---|---|---|
committer | John Stebbins <[email protected]> | 2020-05-03 09:36:42 -0600 |
commit | beebc121f0f1f4e91415a4c58e7e6a79693c753e (patch) | |
tree | 9787f3326f9f50b681e9ed2dfa13d31f6346aaa3 /contrib | |
parent | 24037073a28812ce9b9850193054a3ef997d046d (diff) |
libav: fix remuxing aac from ts to mkv
Fixes https://github.com/HandBrake/HandBrake/issues/2809
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ffmpeg/A19-matroskaenc-aac-extradata.patch | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A19-matroskaenc-aac-extradata.patch b/contrib/ffmpeg/A19-matroskaenc-aac-extradata.patch new file mode 100644 index 000000000..73a406292 --- /dev/null +++ b/contrib/ffmpeg/A19-matroskaenc-aac-extradata.patch @@ -0,0 +1,36 @@ +From a3fa88bdfd6c9615ea9b9f64caf722fa2292d29a Mon Sep 17 00:00:00 2001 +From: John Stebbins <[email protected]> +Date: Sat, 2 May 2020 07:26:29 -0600 +Subject: [PATCH] avformat/matroskaenc: return error if aac extradata changes + +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. + +(cherry picked from commit 805890cddee93ebafcf6db8784315aa3fd6faf81) +--- + libavformat/matroskaenc.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c +index cef504fa05..ea7f81ab94 100644 +--- a/libavformat/matroskaenc.c ++++ b/libavformat/matroskaenc.c +@@ -2283,6 +2283,14 @@ static int mkv_check_new_extra_data(AVFormatContext *s, AVPacket *pkt) + if (side_data_size && (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mkv->is_live) { + int filler, output_sample_rate = 0; + int64_t curpos; ++ 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(EINVAL); ++ } else // Already written ++ break; ++ + ret = get_aac_sample_rates(s, side_data, side_data_size, &track->sample_rate, + &output_sample_rate); + if (ret < 0) +-- +2.25.4 + |