[arch-commits] Commit in chromium/trunk (7 files)
Evangelos Foutras
foutrelis at archlinux.org
Tue May 29 21:13:08 UTC 2018
Date: Tuesday, May 29, 2018 @ 21:13:08
Author: foutrelis
Revision: 325128
upgpkg: chromium 67.0.3396.56-1
New upstream release; .62 was promoted to stable but its tarball might
take a day to appear. The .56 version from a week ago should work just
as good, only missing a couple of bugfixes and translation updates.
Added:
chromium/trunk/chromium-ffmpeg-r1.patch
chromium/trunk/chromium-widevine-r2.patch
chromium/trunk/remove-dependency-on-ffmpeg-internals-for-start-time.patch
Modified:
chromium/trunk/PKGBUILD
Deleted:
chromium/trunk/chromium-widevine.patch
chromium/trunk/fix-crash-in-is_cfi-true-builds-with-unbundled-ICU.patch
chromium/trunk/fix-frame-buttons-rendering-too-large-when-using-OSX.patch
------------------------------------------------------------+
PKGBUILD | 75 +--
chromium-ffmpeg-r1.patch | 22
chromium-widevine-r2.patch | 39 +
chromium-widevine.patch | 10
fix-crash-in-is_cfi-true-builds-with-unbundled-ICU.patch | 53 --
fix-frame-buttons-rendering-too-large-when-using-OSX.patch | 60 --
remove-dependency-on-ffmpeg-internals-for-start-time.patch | 260 +++++++++++
7 files changed, 350 insertions(+), 169 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2018-05-29 20:46:06 UTC (rev 325127)
+++ PKGBUILD 2018-05-29 21:13:08 UTC (rev 325128)
@@ -5,7 +5,7 @@
# Contributor: Daniel J Griffiths <ghost1227 at archlinux.us>
pkgname=chromium
-pkgver=66.0.3359.181
+pkgver=67.0.3396.56
pkgrel=1
_launcher_ver=6
pkgdesc="A web browser built for speed, simplicity, and security"
@@ -24,23 +24,21 @@
install=chromium.install
source=(https://commondatastorage.googleapis.com/chromium-browser-official/$pkgname-$pkgver.tar.xz
chromium-launcher-$_launcher_ver.tar.gz::https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver.tar.gz
- chromium-$pkgver.txt::https://chromium.googlesource.com/chromium/src/+/$pkgver?format=TEXT
- fix-crash-in-is_cfi-true-builds-with-unbundled-ICU.patch
- fix-frame-buttons-rendering-too-large-when-using-OSX.patch
- chromium-skia-harmony.patch
- chromium-widevine.patch)
-sha256sums=('37e6673741b365a25a837217b08f77b24b4f5fc4ad88c8581be6a5dae9a9e919'
+ remove-dependency-on-ffmpeg-internals-for-start-time.patch
+ chromium-ffmpeg-r1.patch
+ chromium-widevine-r2.patch
+ chromium-skia-harmony.patch)
+sha256sums=('bae1f4b66d9fb219d5217c2f7db661ebf17e995bccd4b2b5f119c90af4c49123'
'04917e3cd4307d8e31bfb0027a5dce6d086edb10ff8a716024fbb8bb0c7dccf1'
- '221d0f17951e88d4d315f3160919380237b88587c4b295d619229a05b79927f1'
- 'e3fb73b43bb8c69ff517e66b2cac73d6e759fd240003eb35598df9af442422fe'
- 'bd5e0e61df3f89172590801aea7c8ac75162c10c7fe83e262e96a14388d1633a'
- 'feca54ab09ac0fc9d0626770a6b899a6ac5a12173c7d0c1005bc3964ec83e7b3'
- 'd6fdcb922e5a7fbe15759d39ccc8ea4225821c44d98054ce0f23f9d1f00c9808')
+ '2cc80f5ed8a9b42495a0f3ab3c1bae026b9081972269a1b6d407331d33f7d257'
+ 'aa885330bc4180b78d915f9dfdfc3210038a0acab7b16735ea9828ab6a633bde'
+ '02c69bb3954087db599def7f5b6d65cf8f7cf2ed81dfbdaa4bb7b51863b4df15'
+ 'feca54ab09ac0fc9d0626770a6b899a6ac5a12173c7d0c1005bc3964ec83e7b3')
# Possible replacements are listed in build/linux/unbundle/replace_gn_files.py
# Keys are the names in the above script; values are the dependencies in Arch
declare -gA _system_libs=(
- #[ffmpeg]=ffmpeg # https://crbug.com/731766
+ [ffmpeg]=ffmpeg
[flac]=flac
[fontconfig]=fontconfig
[freetype]=freetype2
@@ -49,7 +47,7 @@
[libdrm]=
[libjpeg]=libjpeg
#[libpng]=libpng # https://crbug.com/752403#c10
- #[libvpx]=libvpx
+ #[libvpx]=libvpx # needs unreleased libvpx
[libwebp]=libwebp
#[libxml]=libxml2 # https://crbug.com/736026
[libxslt]=libxslt
@@ -75,38 +73,25 @@
prepare() {
cd "$srcdir/$pkgname-$pkgver"
- # https://crbug.com/710701
- local _chrome_build_hash=$(base64 -d ../chromium-$pkgver.txt |
- grep -Po '^parent \K[0-9a-f]{40}$')
- if [[ -z $_chrome_build_hash ]]; then
- error "Unable to find Chrome build hash."
- return 1
- fi
- echo "LASTCHANGE=$_chrome_build_hash-" >build/util/LASTCHANGE
-
# Allow building against system libraries in official builds
sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
tools/generate_shim_headers/generate_shim_headers.py
- # Enable support for the Widevine CDM plugin
- # libwidevinecdm.so is not included, but can be copied over from Chrome
- # (Version string doesn't seem to matter so let's go with "Pinkie Pie")
- sed "s/@WIDEVINE_VERSION@/Pinkie Pie/" ../chromium-widevine.patch |
- patch -Np1
+ # https://crbug.com/731766
+ patch -Np1 -i ../remove-dependency-on-ffmpeg-internals-for-start-time.patch
- # Work around broken screen sharing in Google Meet
- # https://crbug.com/829916#c16
- sed -i 's/"Chromium/"Chrome/' chrome/common/chrome_content_client_constants.cc
+ # https://crbug.com/skia/6663#c10
+ patch -Np4 -i ../chromium-skia-harmony.patch
- # https://crbug.com/822820
- patch -Np1 -i ../fix-crash-in-is_cfi-true-builds-with-unbundled-ICU.patch
+ # Fixes from Gentoo
+ patch -Np1 -i ../chromium-ffmpeg-r1.patch
+ patch -Np1 -i ../chromium-widevine-r2.patch
- # https://crbug.com/821881
- patch -Np1 -i ../fix-frame-buttons-rendering-too-large-when-using-OSX.patch
+ # Remove compiler flags not supported by our system clang
+ sed -i \
+ -e '/"-Wno-ignored-pragma-optimize"/d' \
+ build/config/compiler/BUILD.gn
- # https://crbug.com/skia/6663#c10
- patch -Np4 -i ../chromium-skia-harmony.patch
-
# Force script incompatible with Python 3 to use /usr/bin/python2
sed -i '1s|python$|&2|' third_party/dom_distiller_js/protoc_plugins/*.py
@@ -118,12 +103,10 @@
# added benefit of not having to list all the remaining libraries
local _lib
for _lib in ${_unwanted_bundled_libs[@]}; do
- find -type f -path "*third_party/$_lib/*" \
- \! -path "*third_party/$_lib/chromium/*" \
- \! -path "*third_party/$_lib/google/*" \
- \! -path './base/third_party/icu/*' \
- \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
- \! -path './third_party/yasm/run_yasm.py' \
+ find "third_party/$_lib" -type f \
+ \! -path "third_party/$_lib/chromium/*" \
+ \! -path "third_party/$_lib/google/*" \
+ \! -path 'third_party/yasm/run_yasm.py' \
\! -regex '.*\.\(gn\|gni\|isolate\)' \
-delete
done
@@ -190,7 +173,7 @@
out/Release/gn gen out/Release --args="${_flags[*]}" \
--script-executable=/usr/bin/python2
- ninja -C out/Release chrome chrome_sandbox chromedriver widevinecdmadapter
+ ninja -C out/Release chrome chrome_sandbox chromedriver
}
package() {
@@ -218,7 +201,7 @@
cp \
out/Release/{chrome_{100,200}_percent,resources}.pak \
- out/Release/{*.bin,chromedriver,libwidevinecdmadapter.so} \
+ out/Release/{*.bin,chromedriver} \
"$pkgdir/usr/lib/chromium/"
install -Dm644 -t "$pkgdir/usr/lib/chromium/locales" out/Release/locales/*.pak
Added: chromium-ffmpeg-r1.patch
===================================================================
--- chromium-ffmpeg-r1.patch (rev 0)
+++ chromium-ffmpeg-r1.patch 2018-05-29 21:13:08 UTC (rev 325128)
@@ -0,0 +1,22 @@
+--- a/build/linux/unbundle/ffmpeg.gn
++++ b/build/linux/unbundle/ffmpeg.gn
+@@ -14,8 +14,8 @@ pkg_config("system_ffmpeg") {
+ ]
+ }
+
+-buildflag_header("ffmpeg_buildflags") {
+- header = "ffmpeg_buildflags.h"
++buildflag_header("ffmpeg_features") {
++ header = "ffmpeg_features.h"
+ flags = [ "USE_SYSTEM_FFMPEG=true" ]
+ }
+
+@@ -30,7 +30,7 @@ shim_headers("ffmpeg_shim") {
+
+ source_set("ffmpeg") {
+ deps = [
+- ":ffmpeg_buildflags",
++ ":ffmpeg_features",
+ ":ffmpeg_shim",
+ ]
+ public_configs = [ ":system_ffmpeg" ]
Added: chromium-widevine-r2.patch
===================================================================
--- chromium-widevine-r2.patch (rev 0)
+++ chromium-widevine-r2.patch 2018-05-29 21:13:08 UTC (rev 325128)
@@ -0,0 +1,39 @@
+Minimal patch to get chromium to compile with widevine support.
+
+Exactly the same as -r1, but we now need to patch
+ninja to pretty please not terminate our build.
+
+caveat emptor: it's in no way clear that building chromium this
+way is safer, from a security perspective, than whatever Google
+Chrome does.
+
+Upstream appears to be cooking up a code-signing trust-chain
+which may protect users against malicious cdm blobs; I doubt
+we benefit from these using this kludge. Ideally, someone
+would look into this more carefully than I have ... tbh as
+soon as I got my "stories" back, I pretty much lost interest :)
+
+-gmt
+
+--
+--- a/third_party/widevine/cdm/stub/widevine_cdm_version.h
++++ b/third_party/widevine/cdm/stub/widevine_cdm_version.h
+@@ -10,6 +10,7 @@
+
+ #include "third_party/widevine/cdm/widevine_cdm_common.h"
+
++#define WIDEVINE_CDM_VERSION_STRING "unknown"
+ #define WIDEVINE_CDM_AVAILABLE
+
+ #endif // WIDEVINE_CDM_VERSION_H_
+--- a/third_party/widevine/cdm/BUILD.gn
++++ b/third_party/widevine/cdm/BUILD.gn
+@@ -11,7 +11,7 @@ import("//third_party/widevine/cdm/widev
+ # Internal Cast builds set enable_widevine=true to bring in Widevine support.
+ # TODO(xhwang): Support component updated CDM on other platforms and remove this
+ # assert.
+-assert(!enable_widevine || is_win || is_mac || is_chromecast,
++assert(!enable_widevine || is_win || is_mac || is_chromecast || is_linux,
+ "Component updated CDM only supported on Windows and Mac for now.")
+
+ widevine_arch = current_cpu
Deleted: chromium-widevine.patch
===================================================================
--- chromium-widevine.patch 2018-05-29 20:46:06 UTC (rev 325127)
+++ chromium-widevine.patch 2018-05-29 21:13:08 UTC (rev 325128)
@@ -1,10 +0,0 @@
-diff -upr chromium-48.0.2564.82.orig/third_party/widevine/cdm/stub/widevine_cdm_version.h chromium-48.0.2564.82/third_party/widevine/cdm/stub/widevine_cdm_version.h
---- chromium-48.0.2564.82.orig/third_party/widevine/cdm/stub/widevine_cdm_version.h 2016-01-14 01:05:17.000000000 +0200
-+++ chromium-48.0.2564.82/third_party/widevine/cdm/stub/widevine_cdm_version.h 2016-01-21 19:18:51.287978456 +0200
-@@ -12,4 +12,6 @@
-
- #define WIDEVINE_CDM_AVAILABLE
-
-+#define WIDEVINE_CDM_VERSION_STRING "@WIDEVINE_VERSION@"
-+
- #endif // WIDEVINE_CDM_VERSION_H_
Deleted: fix-crash-in-is_cfi-true-builds-with-unbundled-ICU.patch
===================================================================
--- fix-crash-in-is_cfi-true-builds-with-unbundled-ICU.patch 2018-05-29 20:46:06 UTC (rev 325127)
+++ fix-crash-in-is_cfi-true-builds-with-unbundled-ICU.patch 2018-05-29 21:13:08 UTC (rev 325128)
@@ -1,53 +0,0 @@
-From f15e8b573ada0fcd643ae393484214b1c7c940f8 Mon Sep 17 00:00:00 2001
-From: Evangelos Foutras <evangelos at foutrelis.com>
-Date: Sat, 24 Mar 2018 00:04:33 +0000
-Subject: [PATCH] Fix crash in is_cfi=true builds with unbundled ICU
-
-Ensure ICU symbols have public visibility and are thus excluded from CFI
-checks and whole-program optimization. The former caused a startup crash
-and the latter has the potential to break virtual calls in weird ways.
-
-BUG=822820
-
-Change-Id: Ia809eefcb9e93b3c612f2381d394db83bbc67120
-Reviewed-on: https://chromium-review.googlesource.com/978008
-Reviewed-by: Peter Collingbourne <pcc at chromium.org>
-Reviewed-by: Thomas Anderson <thomasanderson at chromium.org>
-Commit-Queue: Thomas Anderson <thomasanderson at chromium.org>
-Cr-Commit-Position: refs/heads/master@{#545638}
----
- build/linux/unbundle/icu.gn | 18 ++++++++++++++++++
- 1 file changed, 18 insertions(+)
-
-diff --git a/build/linux/unbundle/icu.gn b/build/linux/unbundle/icu.gn
-index 5bdd91555df7..4450e409dba5 100644
---- a/build/linux/unbundle/icu.gn
-+++ b/build/linux/unbundle/icu.gn
-@@ -17,6 +17,24 @@ config("icu_config") {
- "USING_SYSTEM_ICU=1",
- "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC",
- "UCHAR_TYPE=uint16_t",
-+
-+ # U_EXPORT (defined in unicode/platform.h) is used to set public visibility
-+ # on classes through the U_COMMON_API and U_I18N_API macros (among others).
-+ # When linking against the system ICU library, we want its symbols to have
-+ # public LTO visibility. This disables CFI checks for the ICU classes and
-+ # allows whole-program optimization to be applied to the rest of Chromium.
-+ #
-+ # Both U_COMMON_API and U_I18N_API macros would be defined to U_EXPORT only
-+ # when U_COMBINED_IMPLEMENTATION is defined (see unicode/utypes.h). Because
-+ # we override the default system UCHAR_TYPE (char16_t), it is not possible
-+ # to use U_COMBINED_IMPLEMENTATION at this moment, meaning the U_COMMON_API
-+ # and U_I18N_API macros are set to U_IMPORT which is an empty definition.
-+ #
-+ # Until building with UCHAR_TYPE=char16_t is supported, one way to apply
-+ # public visibility (and thus public LTO visibility) to all ICU classes is
-+ # to define U_IMPORT to have the same value as U_EXPORT. For more details,
-+ # please see: https://crbug.com/822820
-+ "U_IMPORT=U_EXPORT",
- ]
- }
-
---
-2.16.3
-
Deleted: fix-frame-buttons-rendering-too-large-when-using-OSX.patch
===================================================================
--- fix-frame-buttons-rendering-too-large-when-using-OSX.patch 2018-05-29 20:46:06 UTC (rev 325127)
+++ fix-frame-buttons-rendering-too-large-when-using-OSX.patch 2018-05-29 21:13:08 UTC (rev 325128)
@@ -1,60 +0,0 @@
-From 7ef426c221d11b53b6de507b398e35e8d7b3cc94 Mon Sep 17 00:00:00 2001
-From: Tom Anderson <thomasanderson at chromium.org>
-Date: Wed, 4 Apr 2018 01:23:26 +0000
-Subject: [PATCH] Fix frame buttons rendering too large when using
- OSX-Arc-White GTK theme
-
-The check for GTK 3.20 was incorrect as the issue it was trying to fix
-was still occurring on GTK 3.20+ systems. This CL adds the correct,
-but more complex, check.
-
-Verified on these configurations:
-{GTK 3.18, GTK 3.22} X
-{Breeze, Adwaita, OSX-Arc-White, Greybird} X
-{scale=1, scale=2} X
-{fullscreen, restored}
-
-BUG=821881
-R=thestig
-
-Change-Id: I05afa35c1452a46a1abf4c39191a13657bfd8e2c
-Reviewed-on: https://chromium-review.googlesource.com/990717
-Reviewed-by: Lei Zhang <thestig at chromium.org>
-Commit-Queue: Thomas Anderson <thomasanderson at chromium.org>
-Cr-Commit-Position: refs/heads/master@{#547921}
----
- chrome/browser/ui/libgtkui/nav_button_provider_gtk3.cc | 18 +++++++++++++++++-
- 1 file changed, 17 insertions(+), 1 deletion(-)
-
-diff --git a/chrome/browser/ui/libgtkui/nav_button_provider_gtk3.cc b/chrome/browser/ui/libgtkui/nav_button_provider_gtk3.cc
-index 31a8087bca11..6a09faec5dd2 100644
---- a/chrome/browser/ui/libgtkui/nav_button_provider_gtk3.cc
-+++ b/chrome/browser/ui/libgtkui/nav_button_provider_gtk3.cc
-@@ -213,7 +213,23 @@ class NavButtonImageSource : public gfx::ImageSkiaSource {
- // is not scaled for the (unexpected) smaller button size, and the button's
- // edges appear cut off. To fix this, manually set the background to scale
- // to the button size when it would have clipped.
-- if (GtkVersionCheck(3, 20)) {
-+ //
-+ // GTK's "contain" is unlike CSS's "contain". In CSS, the image would only
-+ // be downsized when it would have clipped. In GTK, the image is always
-+ // scaled to fit the drawing region (preserving aspect ratio). Only add
-+ // "contain" if clipping would occur.
-+ cairo_pattern_t* cr_pattern = nullptr;
-+ cairo_surface_t* cr_surface = nullptr;
-+ gtk_style_context_get(button_context, button_state,
-+ GTK_STYLE_PROPERTY_BACKGROUND_IMAGE, &cr_pattern,
-+ nullptr);
-+ if (cr_pattern &&
-+ cairo_pattern_get_surface(cr_pattern, &cr_surface) ==
-+ CAIRO_STATUS_SUCCESS &&
-+ cr_surface &&
-+ cairo_surface_get_type(cr_surface) == CAIRO_SURFACE_TYPE_IMAGE &&
-+ (cairo_image_surface_get_width(cr_surface) > button_size_.width() ||
-+ cairo_image_surface_get_height(cr_surface) > button_size_.height())) {
- ApplyCssToContext(button_context,
- ".titlebutton { background-size: contain; }");
- }
---
-2.16.2
-
Added: remove-dependency-on-ffmpeg-internals-for-start-time.patch
===================================================================
--- remove-dependency-on-ffmpeg-internals-for-start-time.patch (rev 0)
+++ remove-dependency-on-ffmpeg-internals-for-start-time.patch 2018-05-29 21:13:08 UTC (rev 325128)
@@ -0,0 +1,260 @@
+From f9535bd6d61d7e0b2cb452e6976a914d4ee62a2b Mon Sep 17 00:00:00 2001
+From: Dale Curtis <dalecurtis at chromium.org>
+Date: Thu, 17 May 2018 23:44:41 +0000
+Subject: [PATCH] Remove dependency on ffmpeg internals for start time
+ calculations.
+
+Some theora clips still have issues, but using first_dts where
+we know it's the same as the first pts resolves the lingering
+issues. It also looks like we don't need to use pts_buffer now.
+
+This does the following small fixes:
+- MEDIA_LOG(DEBUG) -> MEDIA_LOG(ERROR) for negative ts error.
+- Enables previous disabled test in more limited state.
+- Adds kNoFFmpegTimestamp so static_cast<int64_t>(AV_NOPTS_VALUE)
+is no longer necessary everywhere. A followup patch set will use
+this is more places.
+- Removes pts_buffer and packet_buffer inspection.
+
+BUG=731766
+TEST=all tests pass.
+
+Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
+Change-Id: I5aadf67a3b5ea2d2a8dd19bbddd7b107208094c5
+Reviewed-on: https://chromium-review.googlesource.com/1064538
+Commit-Queue: Dale Curtis <dalecurtis at chromium.org>
+Reviewed-by: Frank Liberato <liberato at chromium.org>
+Cr-Commit-Position: refs/heads/master@{#559737}
+---
+ media/ffmpeg/ffmpeg_common.h | 5 +-
+ media/filters/ffmpeg_demuxer.cc | 88 +++++++-----------------
+ media/filters/ffmpeg_demuxer_unittest.cc | 24 +++----
+ 3 files changed, 37 insertions(+), 80 deletions(-)
+
+diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h
+index ec33068fb84f..f641d6bcf92e 100644
+--- a/media/ffmpeg/ffmpeg_common.h
++++ b/media/ffmpeg/ffmpeg_common.h
+@@ -28,9 +28,6 @@ extern "C" {
+ MSVC_PUSH_DISABLE_WARNING(4244);
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
+-#if !BUILDFLAG(USE_SYSTEM_FFMPEG)
+-#include <libavformat/internal.h>
+-#endif // !BUILDFLAG(USE_SYSTEM_FFMPEG)
+ #include <libavformat/avio.h>
+ #include <libavutil/avutil.h>
+ #include <libavutil/imgutils.h>
+@@ -42,6 +39,8 @@ MSVC_POP_WARNING();
+
+ namespace media {
+
++constexpr int64_t kNoFFmpegTimestamp = static_cast<int64_t>(AV_NOPTS_VALUE);
++
+ class AudioDecoderConfig;
+ class EncryptionScheme;
+ class VideoDecoderConfig;
+diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
+index 49ca01c4dc0b..7402ce16ab5e 100644
+--- a/media/filters/ffmpeg_demuxer.cc
++++ b/media/filters/ffmpeg_demuxer.cc
+@@ -85,29 +85,26 @@ static base::TimeDelta FramesToTimeDelta(int frames, double sample_rate) {
+ frames * base::Time::kMicrosecondsPerSecond / sample_rate);
+ }
+
+-static base::TimeDelta ExtractStartTime(AVStream* stream,
+- base::TimeDelta start_time_estimate) {
+- DCHECK(start_time_estimate != kNoTimestamp);
+- if (stream->start_time == static_cast<int64_t>(AV_NOPTS_VALUE)) {
+- return start_time_estimate == kInfiniteDuration ? base::TimeDelta()
+- : start_time_estimate;
++static base::TimeDelta ExtractStartTime(AVStream* stream) {
++ // The default start time is zero.
++ base::TimeDelta start_time;
++
++ // First try to use the |start_time| value as is.
++ if (stream->start_time != kNoFFmpegTimestamp)
++ start_time = ConvertFromTimeBase(stream->time_base, stream->start_time);
++
++ // Next try to use the first DTS value, for codecs where we know PTS == DTS
++ // (excludes all H26x codecs). The start time must be returned in PTS.
++ if (stream->first_dts != kNoFFmpegTimestamp &&
++ stream->codecpar->codec_id != AV_CODEC_ID_HEVC &&
++ stream->codecpar->codec_id != AV_CODEC_ID_H264 &&
++ stream->codecpar->codec_id != AV_CODEC_ID_MPEG4) {
++ const base::TimeDelta first_pts =
++ ConvertFromTimeBase(stream->time_base, stream->first_dts);
++ if (first_pts < start_time)
++ start_time = first_pts;
+ }
+
+- // First try the lower of the estimate and the |start_time| value.
+- base::TimeDelta start_time =
+- std::min(ConvertFromTimeBase(stream->time_base, stream->start_time),
+- start_time_estimate);
+-
+- // Next see if the first buffered pts value is usable.
+- if (stream->pts_buffer[0] != static_cast<int64_t>(AV_NOPTS_VALUE)) {
+- const base::TimeDelta buffered_pts =
+- ConvertFromTimeBase(stream->time_base, stream->pts_buffer[0]);
+- if (buffered_pts < start_time)
+- start_time = buffered_pts;
+- }
+-
+- // NOTE: Do not use AVStream->first_dts since |start_time| should be a
+- // presentation timestamp.
+ return start_time;
+ }
+
+@@ -513,7 +510,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
+ buffer->set_duration(kNoTimestamp);
+ }
+
+- // Note: If pts is AV_NOPTS_VALUE, stream_timestamp will be kNoTimestamp.
++ // Note: If pts is kNoFFmpegTimestamp, stream_timestamp will be kNoTimestamp.
+ const base::TimeDelta stream_timestamp =
+ ConvertStreamTimestamp(stream_->time_base, packet->pts);
+
+@@ -556,8 +553,8 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
+ // code paths below; otherwise they should be treated as a parse error.
+ if ((!fixup_chained_ogg_ || last_packet_timestamp_ == kNoTimestamp) &&
+ buffer->timestamp() < base::TimeDelta()) {
+- MEDIA_LOG(DEBUG, media_log_)
+- << "FFmpegDemuxer: unfixable negative timestamp";
++ MEDIA_LOG(ERROR, media_log_)
++ << "FFmpegDemuxer: unfixable negative timestamp.";
+ demuxer_->NotifyDemuxerError(DEMUXER_ERROR_COULD_NOT_PARSE);
+ return;
+ }
+@@ -863,7 +860,7 @@ std::string FFmpegDemuxerStream::GetMetadata(const char* key) const {
+ base::TimeDelta FFmpegDemuxerStream::ConvertStreamTimestamp(
+ const AVRational& time_base,
+ int64_t timestamp) {
+- if (timestamp == static_cast<int64_t>(AV_NOPTS_VALUE))
++ if (timestamp == kNoFFmpegTimestamp)
+ return kNoTimestamp;
+
+ return ConvertFromTimeBase(time_base, timestamp);
+@@ -1256,42 +1253,6 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
+ AVFormatContext* format_context = glue_->format_context();
+ streams_.resize(format_context->nb_streams);
+
+- // Estimate the start time for each stream by looking through the packets
+- // buffered during avformat_find_stream_info(). These values will be
+- // considered later when determining the actual stream start time.
+- //
+- // These packets haven't been completely processed yet, so only look through
+- // these values if the AVFormatContext has a valid start time.
+- //
+- // If no estimate is found, the stream entry will be kInfiniteDuration.
+- std::vector<base::TimeDelta> start_time_estimates(format_context->nb_streams,
+- kInfiniteDuration);
+-#if !BUILDFLAG(USE_SYSTEM_FFMPEG)
+- const AVFormatInternal* internal = format_context->internal;
+- if (internal && internal->packet_buffer &&
+- format_context->start_time != static_cast<int64_t>(AV_NOPTS_VALUE)) {
+- struct AVPacketList* packet_buffer = internal->packet_buffer;
+- while (packet_buffer != internal->packet_buffer_end) {
+- DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index),
+- start_time_estimates.size());
+- const AVStream* stream =
+- format_context->streams[packet_buffer->pkt.stream_index];
+- if (packet_buffer->pkt.pts != static_cast<int64_t>(AV_NOPTS_VALUE)) {
+- const base::TimeDelta packet_pts =
+- ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts);
+- // We ignore kNoTimestamp here since -int64_t::min() is possible; see
+- // https://crbug.com/700501. Technically this is a valid value, but in
+- // practice shouldn't occur, so just ignore it when estimating.
+- if (packet_pts != kNoTimestamp && packet_pts != kInfiniteDuration &&
+- packet_pts < start_time_estimates[stream->index]) {
+- start_time_estimates[stream->index] = packet_pts;
+- }
+- }
+- packet_buffer = packet_buffer->next;
+- }
+- }
+-#endif // !BUILDFLAG(USE_SYSTEM_FFMPEG)
+-
+ std::unique_ptr<MediaTracks> media_tracks(new MediaTracks());
+
+ DCHECK(track_id_to_demux_stream_map_.empty());
+@@ -1440,8 +1401,7 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
+
+ max_duration = std::max(max_duration, streams_[i]->duration());
+
+- base::TimeDelta start_time =
+- ExtractStartTime(stream, start_time_estimates[i]);
++ base::TimeDelta start_time = ExtractStartTime(stream);
+
+ // Note: This value is used for seeking, so we must take the true value and
+ // not the one possibly clamped to zero below.
+@@ -1479,7 +1439,7 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
+ if (text_enabled_)
+ AddTextStreams();
+
+- if (format_context->duration != static_cast<int64_t>(AV_NOPTS_VALUE)) {
++ if (format_context->duration != kNoFFmpegTimestamp) {
+ // If there is a duration value in the container use that to find the
+ // maximum between it and the duration from A/V streams.
+ const AVRational av_time_base = {1, AV_TIME_BASE};
+diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc
+index 71dbed07b376..b09816a3ba3a 100644
+--- a/media/filters/ffmpeg_demuxer_unittest.cc
++++ b/media/filters/ffmpeg_demuxer_unittest.cc
+@@ -696,12 +696,9 @@ TEST_F(FFmpegDemuxerTest, Read_InvalidNegativeTimestamp) {
+ ReadUntilEndOfStream(GetStream(DemuxerStream::AUDIO));
+ }
+
+-// TODO(dalecurtis): Test is disabled since FFmpeg does not currently guarantee
+-// the order of demuxed packets in OGG containers. Re-enable and fix key frame
+-// expectations once we decide to either workaround it or attempt a fix
+-// upstream. See http://crbug.com/387996.
+-TEST_F(FFmpegDemuxerTest,
+- DISABLED_Read_AudioNegativeStartTimeAndOggDiscard_Bear) {
++// Android has no Theora support, so these tests doesn't work.
++#if !defined(OS_ANDROID)
++TEST_F(FFmpegDemuxerTest, Read_AudioNegativeStartTimeAndOggDiscard_Bear) {
+ // Many ogg files have negative starting timestamps, so ensure demuxing and
+ // seeking work correctly with a negative start time.
+ CreateDemuxer("bear.ogv");
+@@ -711,8 +708,12 @@ TEST_F(FFmpegDemuxerTest,
+ DemuxerStream* video = GetStream(DemuxerStream::VIDEO);
+ DemuxerStream* audio = GetStream(DemuxerStream::AUDIO);
+
+- // Run the test twice with a seek in between.
+- for (int i = 0; i < 2; ++i) {
++ // Run the test once (should be twice..., see note) with a seek in between.
++ //
++ // TODO(dalecurtis): We only run the test once since FFmpeg does not currently
++ // guarantee the order of demuxed packets in OGG containers. See
++ // http://crbug.com/387996.
++ for (int i = 0; i < 1; ++i) {
+ audio->Read(
+ NewReadCBWithCheckedDiscard(FROM_HERE, 40, 0, kInfiniteDuration, true));
+ base::RunLoop().Run();
+@@ -731,10 +732,10 @@ TEST_F(FFmpegDemuxerTest,
+ video->Read(NewReadCB(FROM_HERE, 5751, 0, true));
+ base::RunLoop().Run();
+
+- video->Read(NewReadCB(FROM_HERE, 846, 33367, true));
++ video->Read(NewReadCB(FROM_HERE, 846, 33367, false));
+ base::RunLoop().Run();
+
+- video->Read(NewReadCB(FROM_HERE, 1255, 66733, true));
++ video->Read(NewReadCB(FROM_HERE, 1255, 66733, false));
+ base::RunLoop().Run();
+
+ // Seek back to the beginning and repeat the test.
+@@ -747,9 +748,6 @@ TEST_F(FFmpegDemuxerTest,
+ // Same test above, but using sync2.ogv which has video stream muxed before the
+ // audio stream, so seeking based only on start time will fail since ffmpeg is
+ // essentially just seeking based on file position.
+-//
+-// Android has no Theora support, so this test doesn't work.
+-#if !defined(OS_ANDROID)
+ TEST_F(FFmpegDemuxerTest, Read_AudioNegativeStartTimeAndOggDiscard_Sync) {
+ // Many ogg files have negative starting timestamps, so ensure demuxing and
+ // seeking work correctly with a negative start time.
+--
+2.17.0
+
More information about the arch-commits
mailing list