summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2020-05-03 09:32:45 -0600
committerJohn Stebbins <[email protected]>2020-05-03 09:36:09 -0600
commit808aac9395a6e4db7cf2c36779b978065a8bb5ba (patch)
tree101f810e8018565fd4a99d9ece944f59f39e2b43
parent30e523f9fc647a655085cdaa6f3848845f77ed4d (diff)
libav: fix remuxing aac from ts to mkv
Fixes https://github.com/HandBrake/HandBrake/issues/2809 (cherry picked from commit 6baf4c924e677f7c0dda40bcc5f596ab00d1ff45)
-rw-r--r--contrib/ffmpeg/A19-matroskaenc-aac-extradata.patch36
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
+