summaryrefslogtreecommitdiff
path: root/chromium/third_party/ffmpeg
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/ffmpeg')
-rw-r--r--chromium/third_party/ffmpeg/chromium/patches/README155
-rw-r--r--chromium/third_party/ffmpeg/libavformat/mov.c7
-rw-r--r--chromium/third_party/ffmpeg/libavformat/oggparsetheora.c4
-rw-r--r--chromium/third_party/ffmpeg/libavformat/utils.c6
-rw-r--r--chromium/third_party/ffmpeg/libavutil/attributes.h6
-rw-r--r--chromium/third_party/ffmpeg/libavutil/common.h46
-rw-r--r--chromium/third_party/ffmpeg/libavutil/mathematics.c2
7 files changed, 215 insertions, 11 deletions
diff --git a/chromium/third_party/ffmpeg/chromium/patches/README b/chromium/third_party/ffmpeg/chromium/patches/README
index a7ee59d5036..30b736403f6 100644
--- a/chromium/third_party/ffmpeg/chromium/patches/README
+++ b/chromium/third_party/ffmpeg/chromium/patches/README
@@ -1,5 +1,5 @@
---------------------------------------------------------------------
--- Chromium Patches. Autogenerated by find_patches.pyc, do not edit --
+-- Chromium Patches. Autogenerated by find_patches.py, do not edit --
---------------------------------------------------------------------
@@ -837,12 +837,159 @@ Affects:
libavutil/log.h
------------------------------------------------------------------
-commit 89875d230f63fa5eb5dc17dfaebfcbe3dc95c0c4
+commit 587a3f48499df05d3c65f1529fd08b0783217b39
Author: Dale Curtis <dalecurtis@chromium.org>
-Date: Tue Apr 28 15:36:52 2020 -0700
+Date: Tue Apr 28 16:40:05 2020 -0700
- Fix mismerge in MIPS code.
+ Updated ffmpeg for M84.
+
+ - README.chromium file
+ - Chromium patches file
+ - GN Configuration
+ - Fix mismerge in MIPS code.
+
+ Bug: 1061648
+
+ Change-Id: I7f91b326e87d1ab17dcf93356e8c0888b30ab967
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/2171422
+ Reviewed-by: John Rummell <jrummell@chromium.org>
Affects:
libavcodec/mips/aacdec_mips.c
+------------------------------------------------------------------
+commit cdb287b92716421adaee679e9261de8a8dbeb5c4
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Thu Apr 30 15:16:31 2020 -0700
+
+ Add saturated add/sub operations for int64_t.
+
+ Many places are using their own custom code for handling overflow
+ around timestamps or other int64_t values. There are enough of these
+ now that having some common saturated math functions seems sound.
+
+ Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
+
+Affects:
+ libavutil/common.h
+
+------------------------------------------------------------------
+commit d0cc093d860a1df9a176cb17487a7593e34759a3
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Fri May 1 10:20:43 2020 -0700
+
+ Use gcc/clang builtins for av_sat_(add|sub)_64_c if available.
+
+ Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
+ Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+Affects:
+ libavutil/attributes.h
+ libavutil/common.h
+
+------------------------------------------------------------------
+commit aee9f6ca755dcd26da25b415c640d117c895feb5
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Fri May 1 10:20:43 2020 -0700
+
+ Use gcc/clang builtins for av_sat_(add|sub)_64_c if available.
+
+ Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
+
+Affects:
+ libavutil/common.h
+
+------------------------------------------------------------------
+commit 7482aaef44fa4c6c43efd16b2ed8eb474b1283b0
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Thu May 14 14:29:15 2020 -0700
+
+ Use av_sat_add64() when updating start_time by skip_samples.
+
+ Avoids overflow from fuzzed skip_samples values.
+
+ Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
+
+Affects:
+ libavformat/utils.c
+
+------------------------------------------------------------------
+commit 6ae2834612ddc47e4ce40c87a9cc7e76e402bbdc
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Thu May 14 14:33:55 2020 -0700
+
+ [oggparsetheora] Use av_sat_sub64() when updating pts by duration.
+
+ Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
+
+Affects:
+ libavformat/oggparsetheora.c
+
+------------------------------------------------------------------
+commit e4b963f890ae37e2a06276a3067daab75013c8f9
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Thu May 14 14:38:07 2020 -0700
+
+ [mov] Check if DTS is AV_NOPTS_VALUE in mov_find_next_sample().
+
+ Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
+
+Affects:
+ libavformat/mov.c
+
+------------------------------------------------------------------
+commit fbe9f4552d7153286cfa50d3f03b5e474f6a9a66
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Thu May 14 14:47:49 2020 -0700
+
+ [utils, mathematics] Fix overflow in compute_pkt_fields().
+
+ Fixes one issue in the function itself and one in the depdendent
+ function av_add_stable() which wasn't checking for NaN.
+
+ Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
+
+Affects:
+ libavformat/utils.c
+ libavutil/mathematics.c
+
+------------------------------------------------------------------
+commit 3cd1ecb83c4b100bef99d9cd23d0066f0ad3cc5c
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Thu May 14 14:57:08 2020 -0700
+
+ [mov] Don't allow negative sample sizes.
+
+ Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
+
+Affects:
+ libavformat/mov.c
+
+------------------------------------------------------------------
+commit e4e121c110b06d6d52fc75a2964e8c14657763ec
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Fri May 15 12:37:02 2020 -0700
+
+ [oggtheora] Don't update start time when lastpts is AV_NOPTS_VALUE.
+
+ Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
+
+Affects:
+ libavformat/oggparsetheora.c
+
+------------------------------------------------------------------
+commit 696586aaed6ba1ae588118953deb834d0182649c
+Author: Dale Curtis <dalecurtis@chromium.org>
+Date: Mon May 18 15:35:35 2020 -0700
+
+ Free temp buffer upon negative sample_size error.
+
+ 2d8d554f15a7a27cfeca81467cc9341a86f784e2 added a new error condition
+ to mov_read_stsz() but forgot to free a temporary buffer when it
+ occurs.
+
+ Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
+
+Affects:
+ libavformat/mov.c
+
diff --git a/chromium/third_party/ffmpeg/libavformat/mov.c b/chromium/third_party/ffmpeg/libavformat/mov.c
index 769e2453386..2fc5bd65286 100644
--- a/chromium/third_party/ffmpeg/libavformat/mov.c
+++ b/chromium/third_party/ffmpeg/libavformat/mov.c
@@ -2902,6 +2902,11 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
for (i = 0; i < entries && !pb->eof_reached; i++) {
sc->sample_sizes[i] = get_bits_long(&gb, field_size);
+ if (sc->sample_sizes[i] < 0) {
+ av_free(buf);
+ av_log(c->fc, AV_LOG_ERROR, "Invalid sample size %d\n", sc->sample_sizes[i]);
+ return AVERROR_INVALIDDATA;
+ }
sc->data_size += sc->sample_sizes[i];
}
@@ -7793,7 +7798,7 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st)
av_log(s, AV_LOG_TRACE, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts);
if (!sample || (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && current_sample->pos < sample->pos) ||
((s->pb->seekable & AVIO_SEEKABLE_NORMAL) &&
- ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb &&
+ ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && dts != AV_NOPTS_VALUE &&
((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) ||
(FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) {
sample = current_sample;
diff --git a/chromium/third_party/ffmpeg/libavformat/oggparsetheora.c b/chromium/third_party/ffmpeg/libavformat/oggparsetheora.c
index 87a676fe482..d1064e4328d 100644
--- a/chromium/third_party/ffmpeg/libavformat/oggparsetheora.c
+++ b/chromium/third_party/ffmpeg/libavformat/oggparsetheora.c
@@ -191,9 +191,9 @@ static int theora_packet(AVFormatContext *s, int idx)
pts = theora_gptopts(s, idx, os->granule, NULL);
if (pts != AV_NOPTS_VALUE)
- pts -= duration;
+ pts = av_sat_sub64(pts, duration);
os->lastpts = os->lastdts = pts;
- if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
+ if(s->streams[idx]->start_time == AV_NOPTS_VALUE && os->lastpts != AV_NOPTS_VALUE) {
s->streams[idx]->start_time = os->lastpts;
if (s->streams[idx]->duration > 0)
s->streams[idx]->duration -= s->streams[idx]->start_time;
diff --git a/chromium/third_party/ffmpeg/libavformat/utils.c b/chromium/third_party/ffmpeg/libavformat/utils.c
index 62c70fb9d6b..f3bea05cf49 100644
--- a/chromium/third_party/ffmpeg/libavformat/utils.c
+++ b/chromium/third_party/ffmpeg/libavformat/utils.c
@@ -1156,7 +1156,7 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index,
if (st->start_time == AV_NOPTS_VALUE && pktl_it->pkt.pts != AV_NOPTS_VALUE) {
st->start_time = pktl_it->pkt.pts;
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate)
- st->start_time += av_rescale_q(st->skip_samples, (AVRational){1, st->codecpar->sample_rate}, st->time_base);
+ st->start_time = av_sat_add64(st->start_time, av_rescale_q(st->skip_samples, (AVRational){1, st->codecpar->sample_rate}, st->time_base));
}
}
@@ -1169,7 +1169,7 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index,
st->start_time = pts;
}
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate)
- st->start_time += av_rescale_q(st->skip_samples, (AVRational){1, st->codecpar->sample_rate}, st->time_base);
+ st->start_time = av_sat_add64(st->start_time, av_rescale_q(st->skip_samples, (AVRational){1, st->codecpar->sample_rate}, st->time_base));
}
}
@@ -1359,7 +1359,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
if (st->last_IP_duration == 0 && (uint64_t)pkt->duration <= INT32_MAX)
st->last_IP_duration = pkt->duration;
if (pkt->dts != AV_NOPTS_VALUE)
- st->cur_dts = pkt->dts + st->last_IP_duration;
+ st->cur_dts = av_sat_add64(pkt->dts, st->last_IP_duration);
if (pkt->dts != AV_NOPTS_VALUE &&
pkt->pts == AV_NOPTS_VALUE &&
st->last_IP_duration > 0 &&
diff --git a/chromium/third_party/ffmpeg/libavutil/attributes.h b/chromium/third_party/ffmpeg/libavutil/attributes.h
index ced108aa2c7..ab2a1fdd0e1 100644
--- a/chromium/third_party/ffmpeg/libavutil/attributes.h
+++ b/chromium/third_party/ffmpeg/libavutil/attributes.h
@@ -34,6 +34,12 @@
# define AV_GCC_VERSION_AT_MOST(x,y) 0
#endif
+#ifdef __has_builtin
+# define AV_HAS_BUILTIN(x) __has_builtin(x)
+#else
+# define AV_HAS_BUILTIN(x) false
+#endif
+
#ifndef av_always_inline
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_always_inline __attribute__((always_inline)) inline
diff --git a/chromium/third_party/ffmpeg/libavutil/common.h b/chromium/third_party/ffmpeg/libavutil/common.h
index 142ff9abe7e..2777cea9f9b 100644
--- a/chromium/third_party/ffmpeg/libavutil/common.h
+++ b/chromium/third_party/ffmpeg/libavutil/common.h
@@ -292,6 +292,46 @@ static av_always_inline int av_sat_dsub32_c(int a, int b)
}
/**
+ * Add two signed 64-bit values with saturation.
+ *
+ * @param a one value
+ * @param b another value
+ * @return sum with signed saturation
+ */
+static av_always_inline int64_t av_sat_add64_c(int64_t a, int64_t b) {
+#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_add_overflow)
+ int64_t tmp;
+ return !__builtin_add_overflow(a, b, &tmp) ? tmp : (tmp < 0 ? INT64_MAX : INT64_MIN);
+#else
+ if (b >= 0 && a >= INT64_MAX - b)
+ return INT64_MAX;
+ if (b <= 0 && a <= INT64_MIN - b)
+ return INT64_MIN;
+ return a + b;
+#endif
+}
+
+/**
+ * Subtract two signed 64-bit values with saturation.
+ *
+ * @param a one value
+ * @param b another value
+ * @return difference with signed saturation
+ */
+static av_always_inline int64_t av_sat_sub64_c(int64_t a, int64_t b) {
+#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_sub_overflow)
+ int64_t tmp;
+ return !__builtin_sub_overflow(a, b, &tmp) ? tmp : (tmp < 0 ? INT64_MAX : INT64_MIN);
+#else
+ if (b <= 0 && a >= INT64_MAX + b)
+ return INT64_MAX;
+ if (b >= 0 && a <= INT64_MIN + b)
+ return INT64_MIN;
+ return a - b;
+#endif
+}
+
+/**
* Clip a float value into the amin-amax range.
* @param a value to clip
* @param amin minimum value of the clip range
@@ -545,6 +585,12 @@ static av_always_inline av_const int av_parity_c(uint32_t v)
#ifndef av_sat_dsub32
# define av_sat_dsub32 av_sat_dsub32_c
#endif
+#ifndef av_sat_add64
+# define av_sat_add64 av_sat_add64_c
+#endif
+#ifndef av_sat_sub64
+# define av_sat_sub64 av_sat_sub64_c
+#endif
#ifndef av_clipf
# define av_clipf av_clipf_c
#endif
diff --git a/chromium/third_party/ffmpeg/libavutil/mathematics.c b/chromium/third_party/ffmpeg/libavutil/mathematics.c
index 0485db7222f..16c6e4db030 100644
--- a/chromium/third_party/ffmpeg/libavutil/mathematics.c
+++ b/chromium/third_party/ffmpeg/libavutil/mathematics.c
@@ -207,7 +207,7 @@ int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t i
int64_t old = av_rescale_q(ts, ts_tb, inc_tb);
int64_t old_ts = av_rescale_q(old, inc_tb, ts_tb);
- if (old == INT64_MAX)
+ if (old == INT64_MAX || old == AV_NOPTS_VALUE || old_ts == AV_NOPTS_VALUE)
return ts;
return av_rescale_q(old + 1, inc_tb, ts_tb) + (ts - old_ts);