Index: branches/2018Q2/www/waterfox/Makefile =================================================================== --- branches/2018Q2/www/waterfox/Makefile (revision 473585) +++ branches/2018Q2/www/waterfox/Makefile (revision 473586) @@ -1,78 +1,77 @@ # $FreeBSD$ PORTNAME= waterfox -DISTVERSION= 56.2.1-19 -DISTVERSIONSUFFIX= -gff88ad0b627dc -PORTREVISION= 2 +DISTVERSION= 56.2.1-48 +DISTVERSIONSUFFIX= -g7f6ff796eeda4 CATEGORIES= www ipv6 MAINTAINER= jbeich@FreeBSD.org COMMENT= Distilled fork of Firefox DEPRECATED= Temporary experiment EXPIRATION_DATE=2018-07-10 BUILD_DEPENDS= nspr>=4.16:devel/nspr \ nss>=3.32.1:security/nss \ icu>=59.1,1:devel/icu \ libevent>=2.1.8:devel/libevent \ harfbuzz>=1.4.7:print/harfbuzz \ graphite2>=1.3.10:graphics/graphite2 \ png>=1.6.31:graphics/png \ libvorbis>=1.3.5,3:audio/libvorbis \ libvpx>=1.5.0:multimedia/libvpx \ sqlite3>=3.19.3:databases/sqlite3 \ ${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3@${PY_FLAVOR} \ v4l_compat>0:multimedia/v4l_compat \ autoconf-2.13:devel/autoconf213 \ yasm:devel/yasm \ zip:archivers/zip # soundtouch>=1.9.0:audio/soundtouch \ LIB_DEPENDS= libv4l2.so:multimedia/libv4l USE_GITHUB= yes GH_ACCOUNT= MrAlex94 GH_PROJECT= Waterfox USE_GECKO= gecko MOZ_PKGCONFIG_FILES= # empty USE_MOZILLA= -soundtouch MOZILLA_NAME= Waterfox USE_GL= gl WATERFOX_ICON= ${MOZILLA}.png WATERFOX_ICON_SRC= ${PREFIX}/lib/${MOZILLA}/browser/chrome/icons/default/default256.png WATERFOX_DESKTOP= ${MOZSRC}/taskcluster/docker/firefox-snap/firefox.desktop MOZ_OPTIONS= --enable-application=browser \ --with-app-name=${MOZILLA} \ --with-app-basename=${MOZILLA_NAME} \ --with-distribution-id=org.${MOZILLA}project OPTIONS_DEFAULT= BUNDLED_CAIRO .include "${.CURDIR}/../../www/firefox/Makefile.options" # Inconsistent fallback order (libcubeb vs. audio_device) SNDIO_PREVENTS= ${OPTIONS_MULTI_AUDIO:NSNDIO} post-patch: @${REINPLACE_CMD} -e 's/%u/%U/' -e '/X-MultipleArgs/d' \ -e 's/firefox/${MOZILLA}/' \ -e 's/Firefox/${MOZILLA_NAME}/' \ ${WATERFOX_DESKTOP} @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ ${WRKSRC}/browser/app/nsBrowserApp.cpp pre-configure: (cd ${WRKSRC} && ${LOCALBASE}/bin/autoconf-2.13) (cd ${WRKSRC}/js/src/ && ${LOCALBASE}/bin/autoconf-2.13) post-install: ${INSTALL_DATA} ${WATERFOX_DESKTOP} \ ${STAGEDIR}${PREFIX}/share/applications/${MOZILLA}.desktop ${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps ${LN} -sf ${WATERFOX_ICON_SRC} ${STAGEDIR}${PREFIX}/share/pixmaps/${WATERFOX_ICON} .include Index: branches/2018Q2/www/waterfox/distinfo =================================================================== --- branches/2018Q2/www/waterfox/distinfo (revision 473585) +++ branches/2018Q2/www/waterfox/distinfo (revision 473586) @@ -1,3 +1,3 @@ -TIMESTAMP = 1529323760 -SHA256 (MrAlex94-Waterfox-56.2.1-19-gff88ad0b627dc_GH0.tar.gz) = f94cb6a907e287fd599cbd57dd2cabc0dd9a4747dd2ec38600db7709dcd1b04b -SIZE (MrAlex94-Waterfox-56.2.1-19-gff88ad0b627dc_GH0.tar.gz) = 395126403 +TIMESTAMP = 1530292793 +SHA256 (MrAlex94-Waterfox-56.2.1-48-g7f6ff796eeda4_GH0.tar.gz) = 07b65c4e20917968ce5086ddef09dcfe37bd90135f4f37fa2d4cd6029ac38df8 +SIZE (MrAlex94-Waterfox-56.2.1-48-g7f6ff796eeda4_GH0.tar.gz) = 395133776 Index: branches/2018Q2/www/waterfox/files/patch-bug1459162 =================================================================== --- branches/2018Q2/www/waterfox/files/patch-bug1459162 (revision 473585) +++ branches/2018Q2/www/waterfox/files/patch-bug1459162 (nonexistent) @@ -1,71 +0,0 @@ -commit 7588031f0792 -Author: Jonathan Kew -Date: Thu May 17 09:49:58 2018 +0100 - - Bug 1459162 - Update dimensions early in ClearTarget. r=lsalzman a=abillings ---- - dom/canvas/CanvasRenderingContext2D.cpp | 14 +++++++++----- - dom/canvas/CanvasRenderingContext2D.h | 5 ++++- - 2 files changed, 13 insertions(+), 6 deletions(-) - -diff --git dom/canvas/CanvasRenderingContext2D.cpp dom/canvas/CanvasRenderingContext2D.cpp -index 1e057824a4675..4501ffaff2d97 100644 ---- dom/canvas/CanvasRenderingContext2D.cpp -+++ dom/canvas/CanvasRenderingContext2D.cpp -@@ -1928,8 +1928,6 @@ CanvasRenderingContext2D::GetHeight() const - NS_IMETHODIMP - CanvasRenderingContext2D::SetDimensions(int32_t aWidth, int32_t aHeight) - { -- ClearTarget(); -- - // Zero sized surfaces can cause problems. - mZero = false; - if (aHeight == 0) { -@@ -1940,14 +1938,14 @@ CanvasRenderingContext2D::SetDimensions(int32_t aWidth, int32_t aHeight) - aWidth = 1; - mZero = true; - } -- mWidth = aWidth; -- mHeight = aHeight; -+ -+ ClearTarget(aWidth, aHeight); - - return NS_OK; - } - - void --CanvasRenderingContext2D::ClearTarget() -+CanvasRenderingContext2D::ClearTarget(int32_t aWidth, int32_t aHeight) - { - Reset(); - -@@ -1955,6 +1953,12 @@ CanvasRenderingContext2D::ClearTarget() - - SetInitialState(); - -+ // Update dimensions only if new (strictly positive) values were passed. -+ if (aWidth > 0 && aHeight > 0) { -+ mWidth = aWidth; -+ mHeight = aHeight; -+ } -+ - // For vertical writing-mode, unless text-orientation is sideways, - // we'll modify the initial value of textBaseline to 'middle'. - RefPtr canvasStyle; -diff --git dom/canvas/CanvasRenderingContext2D.h dom/canvas/CanvasRenderingContext2D.h -index 6f0f6279e0cf5..c2ed098b053d0 100644 ---- dom/canvas/CanvasRenderingContext2D.h -+++ dom/canvas/CanvasRenderingContext2D.h -@@ -683,8 +683,11 @@ protected: - - /** - * Disposes an old target and prepares to lazily create a new target. -+ * -+ * Parameters are the new dimensions to be used, or if either is negative, -+ * existing dimensions will be left unchanged. - */ -- void ClearTarget(); -+ void ClearTarget(int32_t aWidth = -1, int32_t aHeight = -1); - - /* - * Returns the target to the buffer provider. i.e. this will queue a frame for Property changes on: branches/2018Q2/www/waterfox/files/patch-bug1459162 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: branches/2018Q2/www/waterfox/files/patch-bug1463244 =================================================================== --- branches/2018Q2/www/waterfox/files/patch-bug1463244 (revision 473585) +++ branches/2018Q2/www/waterfox/files/patch-bug1463244 (nonexistent) @@ -1,161 +0,0 @@ -commit 937a30033acb -Author: Lee Salzman -Date: Fri May 25 00:56:22 2018 -0400 - - Bug 1463244 - Cleanup of swizzle stride calculations. r=rhunt, a=RyanVM - - MozReview-Commit-ID: GMXRKnu8zHB - - --HG-- - extra : source : 2aaf8f2a1975c57f5467968734d110ac7becc7ee ---- - gfx/2d/DataSurfaceHelpers.cpp | 33 ++++++++++++++++++++++++--------- - gfx/2d/Swizzle.cpp | 34 +++++++++++++++++++++++++++------- - 2 files changed, 51 insertions(+), 16 deletions(-) - -diff --git gfx/2d/DataSurfaceHelpers.cpp gfx/2d/DataSurfaceHelpers.cpp -index f13be059c8ba0..7af32ff005771 100644 ---- gfx/2d/DataSurfaceHelpers.cpp -+++ gfx/2d/DataSurfaceHelpers.cpp -@@ -157,9 +157,16 @@ SurfaceToPackedBGRA(DataSourceSurface *aSurface) - } - - IntSize size = aSurface->GetSize(); -- -- UniquePtr imageBuffer( -- new (std::nothrow) uint8_t[size.width * size.height * sizeof(uint32_t)]); -+ if (size.width < 0 || size.width >= INT32_MAX / 4) { -+ return nullptr; -+ } -+ int32_t stride = size.width * 4; -+ CheckedInt bufferSize = -+ CheckedInt(stride) * CheckedInt(size.height); -+ if (!bufferSize.isValid()) { -+ return nullptr; -+ } -+ UniquePtr imageBuffer(new (std::nothrow) uint8_t[bufferSize.value()]); - if (!imageBuffer) { - return nullptr; - } -@@ -170,14 +177,14 @@ SurfaceToPackedBGRA(DataSourceSurface *aSurface) - } - - CopySurfaceDataToPackedArray(map.mData, imageBuffer.get(), size, -- map.mStride, 4 * sizeof(uint8_t)); -+ map.mStride, 4); - - aSurface->Unmap(); - - if (format == SurfaceFormat::B8G8R8X8) { - // Convert BGRX to BGRA by setting a to 255. -- SwizzleData(imageBuffer.get(), size.width * sizeof(uint32_t), SurfaceFormat::X8R8G8B8_UINT32, -- imageBuffer.get(), size.width * sizeof(uint32_t), SurfaceFormat::A8R8G8B8_UINT32, -+ SwizzleData(imageBuffer.get(), stride, SurfaceFormat::X8R8G8B8_UINT32, -+ imageBuffer.get(), stride, SurfaceFormat::A8R8G8B8_UINT32, - size); - } - -@@ -196,8 +203,16 @@ SurfaceToPackedBGR(DataSourceSurface *aSurface) - } - - IntSize size = aSurface->GetSize(); -- -- uint8_t* imageBuffer = new (std::nothrow) uint8_t[size.width * size.height * 3 * sizeof(uint8_t)]; -+ if (size.width < 0 || size.width >= INT32_MAX / 3) { -+ return nullptr; -+ } -+ int32_t stride = size.width * 3; -+ CheckedInt bufferSize = -+ CheckedInt(stride) * CheckedInt(size.height); -+ if (!bufferSize.isValid()) { -+ return nullptr; -+ } -+ uint8_t* imageBuffer = new (std::nothrow) uint8_t[bufferSize.value()]; - if (!imageBuffer) { - return nullptr; - } -@@ -209,7 +224,7 @@ SurfaceToPackedBGR(DataSourceSurface *aSurface) - } - - SwizzleData(map.mData, map.mStride, SurfaceFormat::B8G8R8X8, -- imageBuffer, size.width * 3, SurfaceFormat::B8G8R8, -+ imageBuffer, stride, SurfaceFormat::B8G8R8, - size); - - aSurface->Unmap(); -diff --git gfx/2d/Swizzle.cpp gfx/2d/Swizzle.cpp -index 99bd1e17662c4..acbe2cabf9819 100644 ---- gfx/2d/Swizzle.cpp -+++ gfx/2d/Swizzle.cpp -@@ -259,7 +259,8 @@ static inline IntSize - CollapseSize(const IntSize& aSize, int32_t aSrcStride, int32_t aDstStride) - { - if (aSrcStride == aDstStride && -- aSrcStride == 4 * aSize.width) { -+ (aSrcStride & 3) == 0 && -+ aSrcStride / 4 == aSize.width) { - CheckedInt32 area = CheckedInt32(aSize.width) * CheckedInt32(aSize.height); - if (area.isValid()) { - return IntSize(area.value(), 1); -@@ -268,6 +269,16 @@ CollapseSize(const IntSize& aSize, int32_t aSrcStride, int32_t aDstStride) - return aSize; - } - -+static inline int32_t -+GetStrideGap(int32_t aWidth, SurfaceFormat aFormat, int32_t aStride) -+{ -+ CheckedInt32 used = CheckedInt32(aWidth) * BytesPerPixel(aFormat); -+ if (!used.isValid() || used.value() < 0) { -+ return -1; -+ } -+ return aStride - used.value(); -+} -+ - bool - PremultiplyData(const uint8_t* aSrc, int32_t aSrcStride, SurfaceFormat aSrcFormat, - uint8_t* aDst, int32_t aDstStride, SurfaceFormat aDstFormat, -@@ -278,9 +289,12 @@ PremultiplyData(const uint8_t* aSrc, int32_t aSrcStride, SurfaceFormat aSrcForma - } - IntSize size = CollapseSize(aSize, aSrcStride, aDstStride); - // Find gap from end of row to the start of the next row. -- int32_t srcGap = aSrcStride - BytesPerPixel(aSrcFormat) * aSize.width; -- int32_t dstGap = aDstStride - BytesPerPixel(aDstFormat) * aSize.width; -+ int32_t srcGap = GetStrideGap(aSize.width, aSrcFormat, aSrcStride); -+ int32_t dstGap = GetStrideGap(aSize.width, aDstFormat, aDstStride); - MOZ_ASSERT(srcGap >= 0 && dstGap >= 0); -+ if (srcGap < 0 || dstGap < 0) { -+ return false; -+ } - - #define FORMAT_CASE_CALL(...) __VA_ARGS__(aSrc, srcGap, aDst, dstGap, size) - -@@ -404,9 +418,12 @@ UnpremultiplyData(const uint8_t* aSrc, int32_t aSrcStride, SurfaceFormat aSrcFor - } - IntSize size = CollapseSize(aSize, aSrcStride, aDstStride); - // Find gap from end of row to the start of the next row. -- int32_t srcGap = aSrcStride - BytesPerPixel(aSrcFormat) * aSize.width; -- int32_t dstGap = aDstStride - BytesPerPixel(aDstFormat) * aSize.width; -+ int32_t srcGap = GetStrideGap(aSize.width, aSrcFormat, aSrcStride); -+ int32_t dstGap = GetStrideGap(aSize.width, aDstFormat, aDstStride); - MOZ_ASSERT(srcGap >= 0 && dstGap >= 0); -+ if (srcGap < 0 || dstGap < 0) { -+ return false; -+ } - - #define FORMAT_CASE_CALL(...) __VA_ARGS__(aSrc, srcGap, aDst, dstGap, size) - -@@ -702,9 +719,12 @@ SwizzleData(const uint8_t* aSrc, int32_t aSrcStride, SurfaceFormat aSrcFormat, - } - IntSize size = CollapseSize(aSize, aSrcStride, aDstStride); - // Find gap from end of row to the start of the next row. -- int32_t srcGap = aSrcStride - BytesPerPixel(aSrcFormat) * aSize.width; -- int32_t dstGap = aDstStride - BytesPerPixel(aDstFormat) * aSize.width; -+ int32_t srcGap = GetStrideGap(aSize.width, aSrcFormat, aSrcStride); -+ int32_t dstGap = GetStrideGap(aSize.width, aDstFormat, aDstStride); - MOZ_ASSERT(srcGap >= 0 && dstGap >= 0); -+ if (srcGap < 0 || dstGap < 0) { -+ return false; -+ } - - #define FORMAT_CASE_CALL(...) __VA_ARGS__(aSrc, srcGap, aDst, dstGap, size) - Property changes on: branches/2018Q2/www/waterfox/files/patch-bug1463244 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: branches/2018Q2/www/waterfox/files/patch-bug1464829 =================================================================== --- branches/2018Q2/www/waterfox/files/patch-bug1464829 (revision 473585) +++ branches/2018Q2/www/waterfox/files/patch-bug1464829 (nonexistent) @@ -1,55 +0,0 @@ -commit 325496dfe42a -Author: Nicolas B. Pierron -Date: Thu May 31 14:22:14 2018 +0200 - - Bug 1464829 - Ensure the recover instruction vector has the expected size. r=jandem, a=jcristau - - --HG-- - extra : source : 931f3ee17589096df1e87223362051c0aec26931 - extra : intermediate-source : eab56078999a914abc3cf9ac16ca2ca7c06548d8 ---- - js/src/jit/JitFrameIterator.h | 2 -- - js/src/jit/JitFrames.cpp | 4 +--- - 2 files changed, 1 insertion(+), 5 deletions(-) - -diff --git js/src/jit/JitFrameIterator.h js/src/jit/JitFrameIterator.h -index ba5efef6a5438..3620badbda07e 100644 ---- js/src/jit/JitFrameIterator.h -+++ js/src/jit/JitFrameIterator.h -@@ -322,9 +322,7 @@ class RInstructionResults - - MOZ_MUST_USE bool init(JSContext* cx, uint32_t numResults); - bool isInitialized() const; --#ifdef DEBUG - size_t length() const; --#endif - - JitFrameLayout* frame() const; - -diff --git js/src/jit/JitFrames.cpp js/src/jit/JitFrames.cpp -index 646442b4c0358..dbb080e3d08d7 100644 ---- js/src/jit/JitFrames.cpp -+++ js/src/jit/JitFrames.cpp -@@ -1621,13 +1621,11 @@ RInstructionResults::isInitialized() const - return initialized_; - } - --#ifdef DEBUG - size_t - RInstructionResults::length() const - { - return results_->length(); - } --#endif - - JitFrameLayout* - RInstructionResults::frame() const -@@ -2083,7 +2081,7 @@ SnapshotIterator::initInstructionResults(MaybeReadFallback& fallback) - } - - MOZ_ASSERT(results->isInitialized()); -- MOZ_ASSERT(results->length() == recover_.numInstructions() - 1); -+ MOZ_RELEASE_ASSERT(results->length() == recover_.numInstructions() - 1); - instructionResults_ = results; - return true; - } Property changes on: branches/2018Q2/www/waterfox/files/patch-bug1464829 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: branches/2018Q2/www/waterfox/files/patch-bug1459206 =================================================================== --- branches/2018Q2/www/waterfox/files/patch-bug1459206 (revision 473585) +++ branches/2018Q2/www/waterfox/files/patch-bug1459206 (nonexistent) @@ -1,44 +0,0 @@ -commit 4741651d3ac6 -Author: Andrea Marchesini -Date: Thu May 10 11:24:25 2018 +0200 - - Bug 1459206 - Use FileSystemSecurity in ContentParent::RecvGetFilesRequest. r=ehsan, a=RyanVM - - --HG-- - extra : source : a3ebab26f0d9e962f1f892335838ee1b51335378 ---- - dom/filesystem/tests/test_webkitdirectory.html | 1 + - dom/ipc/ContentParent.cpp | 8 ++++++++ - 2 files changed, 9 insertions(+) - -diff --git dom/filesystem/tests/test_webkitdirectory.html dom/filesystem/tests/test_webkitdirectory.html -index 3611039a5a46a..45957f9bb56d0 100644 ---- dom/filesystem/tests/test_webkitdirectory.html -+++ dom/filesystem/tests/test_webkitdirectory.html -@@ -151,6 +151,7 @@ function test_changeDataWhileWorking() { - - function test_setup() { - SpecialPowers.pushPrefEnv({"set": [["dom.input.dirpicker", true], -+ ["dom.filesystem.pathcheck.disabled", true], - ["dom.webkitBlink.dirPicker.enabled", true]]}, next); - } - -diff --git dom/ipc/ContentParent.cpp dom/ipc/ContentParent.cpp -index 9912238b27744..c55fb106690f0 100644 ---- dom/ipc/ContentParent.cpp -+++ dom/ipc/ContentParent.cpp -@@ -5241,6 +5241,14 @@ ContentParent::RecvGetFilesRequest(const nsID& aUUID, - { - MOZ_ASSERT(!mGetFilesPendingRequests.GetWeak(aUUID)); - -+ if (!mozilla::Preferences::GetBool("dom.filesystem.pathcheck.disabled", false)) { -+ RefPtr fss = FileSystemSecurity::Get(); -+ if (NS_WARN_IF(!fss || -+ !fss->ContentProcessHasAccessTo(ChildID(), aDirectoryPath))) { -+ return IPC_FAIL_NO_REASON(this); -+ } -+ } -+ - ErrorResult rv; - RefPtr helper = - GetFilesHelperParent::Create(aUUID, aDirectoryPath, aRecursiveFlag, this, Property changes on: branches/2018Q2/www/waterfox/files/patch-bug1459206 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: branches/2018Q2/www/waterfox/files/patch-bug1261175 =================================================================== --- branches/2018Q2/www/waterfox/files/patch-bug1261175 (revision 473585) +++ branches/2018Q2/www/waterfox/files/patch-bug1261175 (nonexistent) @@ -1,31 +0,0 @@ -commit 315fe73694f9 -Author: Matt Woodrow -Date: Tue Nov 14 10:31:36 2017 +1300 - - Bug 1261175. r=bobowen a=gchang - - MozReview-Commit-ID: B9yAN0F01rj - - --HG-- - extra : amend_source : 7585df8257930896070ddcb64c93a28a39fbbee7 ---- - layout/base/nsDocumentViewer.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git layout/base/nsDocumentViewer.cpp layout/base/nsDocumentViewer.cpp -index be33cf990d91..4fe03d3f7f88 100644 ---- layout/base/nsDocumentViewer.cpp -+++ layout/base/nsDocumentViewer.cpp -@@ -549,6 +549,12 @@ nsDocumentViewer::~nsDocumentViewer() - mDocument->Destroy(); - } - -+ if (mPrintEngine) { -+ mPrintEngine->Destroy(); -+ mPrintEngine = nullptr; -+ } -+ -+ MOZ_RELEASE_ASSERT(mDestroyRefCount == 0); - NS_ASSERTION(!mPresShell && !mPresContext, - "User did not call nsIContentViewer::Destroy"); - if (mPresShell || mPresContext) { Property changes on: branches/2018Q2/www/waterfox/files/patch-bug1261175 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: branches/2018Q2/www/waterfox/files/patch-bug1452375 =================================================================== --- branches/2018Q2/www/waterfox/files/patch-bug1452375 (revision 473585) +++ branches/2018Q2/www/waterfox/files/patch-bug1452375 (nonexistent) @@ -1,133 +0,0 @@ -commit 73284efb9ac4 -Author: Jeff Muizelaar -Date: Thu May 31 21:19:18 2018 -0400 - - Bug 1452375 - ssse3-scaler: handle init failure. r=sotaro, a=abillings - - --HG-- - extra : amend_source : b9070901c9a52e7790db4e81ba093b08511bab6a ---- - gfx/2d/ssse3-scaler.c | 8 +++++++- - gfx/2d/ssse3-scaler.h | 4 +++- - gfx/layers/basic/BasicCompositor.cpp | 14 +++++++------- - 3 files changed, 17 insertions(+), 9 deletions(-) - -diff --git gfx/2d/ssse3-scaler.c gfx/2d/ssse3-scaler.c -index 345844b841dc5..0a571e064dc31 100644 ---- gfx/2d/ssse3-scaler.c -+++ gfx/2d/ssse3-scaler.c -@@ -37,6 +37,7 @@ - #include - #include - #include -+#include "ssse3-scaler.h" - - typedef int32_t pixman_fixed_16_16_t; - typedef pixman_fixed_16_16_t pixman_fixed_t; -@@ -505,7 +506,7 @@ fail: - /* scale the src from src_width/height to dest_width/height drawn - * into the rectangle x,y width,height - * src_stride and dst_stride are 4 byte units */ --void ssse3_scale_data(uint32_t *src, int src_width, int src_height, int src_stride, -+bool ssse3_scale_data(uint32_t *src, int src_width, int src_height, int src_stride, - uint32_t *dest, int dest_width, int dest_height, - int dest_stride, - int x, int y, -@@ -551,6 +552,10 @@ void ssse3_scale_data(uint32_t *src, int src_width, int src_height, int src_stri - iter.data = NULL; - - ssse3_bilinear_cover_iter_init(&iter); -+ -+ if (!iter.fini) -+ return false; -+ - if (iter.data) { - for (int iy = 0; iy < height; iy++) { - ssse3_fetch_bilinear_cover(&iter, NULL); -@@ -558,4 +563,5 @@ void ssse3_scale_data(uint32_t *src, int src_width, int src_height, int src_stri - } - ssse3_bilinear_cover_iter_fini(&iter); - } -+ return true; - } -diff --git gfx/2d/ssse3-scaler.h gfx/2d/ssse3-scaler.h -index b3b53ed643689..ea8d8a066303a 100644 ---- gfx/2d/ssse3-scaler.h -+++ gfx/2d/ssse3-scaler.h -@@ -6,10 +6,12 @@ - #ifndef MOZILLA_GFX_2D_SSSE3_SCALER_H_ - #define MOZILLA_GFX_2D_SSSE3_SCALER_H_ - -+#include -+ - #ifdef __cplusplus - extern "C" { - #endif --void ssse3_scale_data(uint32_t *src, int src_width, int src_height, -+bool ssse3_scale_data(uint32_t *src, int src_width, int src_height, - int src_stride, - uint32_t *dest, int dest_width, int dest_height, - int dest_rowstride, -diff --git gfx/layers/basic/BasicCompositor.cpp gfx/layers/basic/BasicCompositor.cpp -index 1ff27f7957301..634d9e3407f7b 100644 ---- gfx/layers/basic/BasicCompositor.cpp -+++ gfx/layers/basic/BasicCompositor.cpp -@@ -470,15 +470,15 @@ AttemptVideoScale(TextureSourceBasic* aSource, const SourceSurface* aSourceMask, - RefPtr srcSource = aSource->GetSurface(aDest)->GetDataSurface(); - DataSourceSurface::ScopedMap mapSrc(srcSource, DataSourceSurface::READ); - -- ssse3_scale_data((uint32_t*)mapSrc.GetData(), srcSource->GetSize().width, srcSource->GetSize().height, -- mapSrc.GetStride()/4, -- ((uint32_t*)dstData) + fillRect.x + (dstStride / 4) * fillRect.y, dstRect.width, dstRect.height, -- dstStride / 4, -- offset.x, offset.y, -- fillRect.width, fillRect.height); -+ bool success = ssse3_scale_data((uint32_t*)mapSrc.GetData(), srcSource->GetSize().width, srcSource->GetSize().height, -+ mapSrc.GetStride()/4, -+ ((uint32_t*)dstData) + fillRect.x + (dstStride / 4) * fillRect.y, dstRect.width, dstRect.height, -+ dstStride / 4, -+ offset.x, offset.y, -+ fillRect.width, fillRect.height); - - aDest->ReleaseBits(dstData); -- return true; -+ return success; - } else - #endif // MOZILLA_SSE_HAVE_CPUID_DETECTION - return false; - -commit 083548141193 (origin/esr52) -Author: Jeff Muizelaar -Date: Thu May 31 21:20:05 2018 -0400 - - Bug 1452375 - ssse3-scaler: make sure iter->x/y is representable. r=sotaro, a=abillings ---- - gfx/2d/ssse3-scaler.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git gfx/2d/ssse3-scaler.c gfx/2d/ssse3-scaler.c -index 0a571e064dc31..745f58f6f8f43 100644 ---- gfx/2d/ssse3-scaler.c -+++ gfx/2d/ssse3-scaler.c -@@ -45,6 +45,8 @@ typedef pixman_fixed_16_16_t pixman_fixed_t; - #define pixman_fixed_to_int(f) ((int) ((f) >> 16)) - #define pixman_int_to_fixed(i) ((pixman_fixed_t) ((i) << 16)) - #define pixman_double_to_fixed(d) ((pixman_fixed_t) ((d) * 65536.0)) -+#define PIXMAN_FIXED_INT_MAX 32767 -+#define PIXMAN_FIXED_INT_MIN -32768 - typedef struct pixman_vector pixman_vector_t; - - typedef int pixman_bool_t; -@@ -464,6 +466,12 @@ ssse3_bilinear_cover_iter_init (pixman_iter_t *iter) - bilinear_info_t *info; - pixman_vector_t v; - -+ if (iter->x > PIXMAN_FIXED_INT_MAX || -+ iter->x < PIXMAN_FIXED_INT_MIN || -+ iter->y > PIXMAN_FIXED_INT_MAX || -+ iter->y < PIXMAN_FIXED_INT_MIN) -+ goto fail; -+ - /* Reference point is the center of the pixel */ - v.vector[0] = pixman_int_to_fixed (iter->x) + pixman_fixed_1 / 2; - v.vector[1] = pixman_int_to_fixed (iter->y) + pixman_fixed_1 / 2; Property changes on: branches/2018Q2/www/waterfox/files/patch-bug1452375 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: branches/2018Q2/www/waterfox/files/patch-bug1436241 =================================================================== --- branches/2018Q2/www/waterfox/files/patch-bug1436241 (revision 473585) +++ branches/2018Q2/www/waterfox/files/patch-bug1436241 (nonexistent) @@ -1,54 +0,0 @@ -commit 540471c8085c -Author: Kyle Machulis -Date: Mon Apr 30 12:49:15 2018 -0700 - - Bug 1436241 - Check redirect status code before forwarding to NPAPI. r=jimm, r=pauljt, a=RyanVM - - NPAPI may handle a 307 redirect across different origins, while they - should only happen on same origin requests. Have the browser check - this before forwarding to NPAPI. - - MozReview-Commit-ID: 5vxMooygI4g - - --HG-- - extra : source : 6d595a423fb52766abb5c1d10d4b9d7d6027d68a ---- - dom/plugins/base/nsPluginStreamListenerPeer.cpp | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - -diff --git dom/plugins/base/nsPluginStreamListenerPeer.cpp dom/plugins/base/nsPluginStreamListenerPeer.cpp -index b780688ddd0c7..dd8e84d2df075 100644 ---- dom/plugins/base/nsPluginStreamListenerPeer.cpp -+++ dom/plugins/base/nsPluginStreamListenerPeer.cpp -@@ -668,15 +668,6 @@ nsPluginStreamListenerPeer::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsICh - return NS_ERROR_FAILURE; - } - -- nsCOMPtr proxyCallback = -- new ChannelRedirectProxyCallback(this, callback, oldChannel, newChannel); -- -- // Give NPAPI a chance to control redirects. -- bool notificationHandled = mPStreamListener->HandleRedirectNotification(oldChannel, newChannel, proxyCallback); -- if (notificationHandled) { -- return NS_OK; -- } -- - // Don't allow cross-origin 307 POST redirects. - nsCOMPtr oldHttpChannel(do_QueryInterface(oldChannel)); - if (oldHttpChannel) { -@@ -700,6 +691,15 @@ nsPluginStreamListenerPeer::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsICh - } - } - -+ nsCOMPtr proxyCallback = -+ new ChannelRedirectProxyCallback(this, callback, oldChannel, newChannel); -+ -+ // Give NPAPI a chance to control redirects. -+ bool notificationHandled = mPStreamListener->HandleRedirectNotification(oldChannel, newChannel, proxyCallback); -+ if (notificationHandled) { -+ return NS_OK; -+ } -+ - // Fall back to channel event sink for window. - nsCOMPtr channelEventSink; - nsresult rv = GetInterfaceGlobal(NS_GET_IID(nsIChannelEventSink), getter_AddRefs(channelEventSink)); Property changes on: branches/2018Q2/www/waterfox/files/patch-bug1436241 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: branches/2018Q2/www/waterfox/files/patch-bug1465686 =================================================================== --- branches/2018Q2/www/waterfox/files/patch-bug1465686 (revision 473585) +++ branches/2018Q2/www/waterfox/files/patch-bug1465686 (nonexistent) @@ -1,52 +0,0 @@ -commit e963f75ef278 -Author: Lee Salzman -Date: Fri Jun 1 15:52:26 2018 -0400 - - Bug 1465686 - Validate SkArenaAlloc sizes. r=rhunt, a=RyanVM - - MozReview-Commit-ID: Cc4cxKeF4xn - - --HG-- - extra : source : 9019db1eaddb79dbfd1d4c357765599499eb02b4 ---- - gfx/skia/skia/src/core/SkArenaAlloc.h | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git gfx/skia/skia/src/core/SkArenaAlloc.h gfx/skia/skia/src/core/SkArenaAlloc.h -index c9e7274e63ded..b93054cff0177 100644 ---- gfx/skia/skia/src/core/SkArenaAlloc.h -+++ gfx/skia/skia/src/core/SkArenaAlloc.h -@@ -112,9 +112,14 @@ public: - return sk_sp(SkRef(this->make(std::forward(args)...))); - } - -+ uint32_t safeU32(size_t n) { -+ SkASSERT_RELEASE(SkTFitsIn(n)); -+ return uint32_t(n); -+ } -+ - template - T* makeArrayDefault(size_t count) { -- uint32_t safeCount = SkTo(count); -+ uint32_t safeCount = safeU32(count); - T* array = (T*)this->commonArrayAlloc(safeCount); - - // If T is primitive then no initialization takes place. -@@ -126,7 +131,7 @@ public: - - template - T* makeArray(size_t count) { -- uint32_t safeCount = SkTo(count); -+ uint32_t safeCount = safeU32(count); - T* array = (T*)this->commonArrayAlloc(safeCount); - - // If T is primitive then the memory is initialized. For example, an array of chars will -@@ -139,7 +144,7 @@ public: - - // Only use makeBytesAlignedTo if none of the typed variants are impractical to use. - void* makeBytesAlignedTo(size_t size, size_t align) { -- auto objStart = this->allocObject(SkTo(size), SkTo(align)); -+ auto objStart = this->allocObject(safeU32(size), safeU32(align)); - fCursor = objStart + size; - return objStart; - } Property changes on: branches/2018Q2/www/waterfox/files/patch-bug1465686 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: branches/2018Q2/www/waterfox/files/patch-bug1459693 =================================================================== --- branches/2018Q2/www/waterfox/files/patch-bug1459693 (revision 473585) +++ branches/2018Q2/www/waterfox/files/patch-bug1459693 (nonexistent) @@ -1,26 +0,0 @@ -commit b639bb848489 -Author: Olli Pettay -Date: Wed May 30 17:04:18 2018 +0300 - - Bug 1459693 - Ensure the right anonymous element is focused when calling input.focus(). r=mccr8, a=RyanVM - - --HG-- - extra : source : 8398d902299c9df8c0cb522d2d34c1419ee2682b ---- - dom/html/HTMLInputElement.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git dom/html/HTMLInputElement.cpp dom/html/HTMLInputElement.cpp -index 4ba4ef9f9371b..9b4862626c6e0 100644 ---- dom/html/HTMLInputElement.cpp -+++ dom/html/HTMLInputElement.cpp -@@ -3177,7 +3177,8 @@ HTMLInputElement::Focus(ErrorResult& aError) - nsNumberControlFrame* numberControlFrame = - do_QueryFrame(GetPrimaryFrame()); - if (numberControlFrame) { -- HTMLInputElement* textControl = numberControlFrame->GetAnonTextControl(); -+ RefPtr textControl = -+ numberControlFrame->GetAnonTextControl(); - if (textControl) { - textControl->Focus(aError); - return; Property changes on: branches/2018Q2/www/waterfox/files/patch-bug1459693 ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: branches/2018Q2/www/waterfox/files/patch-bug1453127 =================================================================== --- branches/2018Q2/www/waterfox/files/patch-bug1453127 (revision 473585) +++ branches/2018Q2/www/waterfox/files/patch-bug1453127 (revision 473586) @@ -1,641 +1,605 @@ -commit 7f8f5d958ed6 -Author: Bryce Van Dyk -Date: Wed Apr 18 15:30:57 2018 -0400 - - Bug 1453127 - Do not use iterators in MediaStreamTrack when removing listeners. r=pehrsons a=lizzard - - --HG-- - extra : source : 6b3aaee40f7507e240da08d6e073cff3c53971f4 ---- - dom/media/MediaStreamTrack.cpp | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git dom/media/MediaStreamTrack.cpp dom/media/MediaStreamTrack.cpp -index 010373e9086dc..af6c6014cf02a 100644 ---- dom/media/MediaStreamTrack.cpp -+++ dom/media/MediaStreamTrack.cpp -@@ -166,11 +166,15 @@ MediaStreamTrack::Destroy() - mPrincipalHandleListener->Forget(); - mPrincipalHandleListener = nullptr; - } -- for (auto l : mTrackListeners) { -- RemoveListener(l); -+ // Remove all listeners -- avoid iterating over the list we're removing from -+ const nsTArray> trackListeners(mTrackListeners); -+ for (auto listener : trackListeners) { -+ RemoveListener(listener); - } -- for (auto l : mDirectTrackListeners) { -- RemoveDirectListener(l); -+ // Do the same as above for direct listeners -+ const nsTArray> directTrackListeners(mDirectTrackListeners); -+ for (auto listener : directTrackListeners) { -+ RemoveDirectListener(listener); - } - } - commit 890e77744a2a Author: Andreas Pehrson Date: Tue May 29 10:13:14 2018 +0200 Bug 1453127 - Make sure decoder-captured tracks end when changing src. r=jya, a=RyanVM --- dom/html/HTMLMediaElement.cpp | 18 ++++++++++++++++++ dom/html/HTMLMediaElement.h | 5 +++++ 2 files changed, 23 insertions(+) diff --git dom/html/HTMLMediaElement.cpp dom/html/HTMLMediaElement.cpp index b0e787fbf9278..d1502cecfb237 100644 --- dom/html/HTMLMediaElement.cpp +++ dom/html/HTMLMediaElement.cpp @@ -1429,6 +1429,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLMediaElement, nsGenericHTM NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mErrorSink->mError) for (uint32_t i = 0; i < tmp->mOutputStreams.Length(); ++i) { NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOutputStreams[i].mStream); + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOutputStreams[i].mPreCreatedTracks) } NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPlayed); NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTextTrackManager) @@ -3494,6 +3495,7 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded, RefPtr track = out->mStream->CreateDOMTrack(audioTrackId, MediaSegment::AUDIO, trackSource); + out->mPreCreatedTracks.AppendElement(track); out->mStream->AddTrackInternal(track); LOG(LogLevel::Debug, ("Created audio track %d for captured decoder", audioTrackId)); @@ -3505,6 +3507,7 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded, RefPtr track = out->mStream->CreateDOMTrack(videoTrackId, MediaSegment::VIDEO, trackSource); + out->mPreCreatedTracks.AppendElement(track); out->mStream->AddTrackInternal(track); LOG(LogLevel::Debug, ("Created video track %d for captured decoder", videoTrackId)); @@ -7526,6 +7529,21 @@ HTMLMediaElement::RemoveMediaTracks() } mMediaTracksConstructed = false; + + for (OutputMediaStream& ms : mOutputStreams) { + if (!ms.mCapturingDecoder) { + continue; + } + for (RefPtr& t : ms.mPreCreatedTracks) { + if (t->Ended()) { + continue; + } + mAbstractMainThread->Dispatch(NewRunnableMethod( + "dom::HTMLMediaElement::RemoveMediaTracks", + t, &MediaStreamTrack::OverrideEnded)); + } + ms.mPreCreatedTracks.Clear(); + } } class MediaElementGMPCrashHelper : public GMPCrashHelper diff --git dom/html/HTMLMediaElement.h dom/html/HTMLMediaElement.h index a81a2dfb22f39..126aaee2ae655 100644 --- dom/html/HTMLMediaElement.h +++ dom/html/HTMLMediaElement.h @@ -843,6 +843,11 @@ protected: bool mCapturingDecoder; bool mCapturingMediaStream; + // The following members are keeping state for a captured MediaDecoder. + // Tracks that were created on main thread before MediaDecoder fed them + // to the MediaStreamGraph. + nsTArray> mPreCreatedTracks; + // The following members are keeping state for a captured MediaStream. TrackID mNextAvailableTrackID; nsTArray>> mTrackPorts; commit dee1e1ec98be Author: Andreas Pehrson Date: Tue May 29 10:21:51 2018 +0200 Bug 1453127 - Ensure TrackID uniqueness for captured MediaDecoder. r=jya, a=RyanVM --- dom/html/HTMLMediaElement.cpp | 22 +++++++--- dom/html/HTMLMediaElement.h | 2 +- dom/media/MediaDecoder.cpp | 13 +++++- dom/media/MediaDecoder.h | 3 ++ dom/media/MediaDecoderStateMachine.cpp | 10 ++++- dom/media/MediaDecoderStateMachine.h | 5 ++- dom/media/mediasink/DecodedStream.cpp | 11 +++-- dom/media/mediasink/OutputStreamManager.cpp | 68 ++++++++++++++++++++++------- dom/media/mediasink/OutputStreamManager.h | 33 ++++++++++---- 9 files changed, 131 insertions(+), 36 deletions(-) diff --git dom/html/HTMLMediaElement.cpp dom/html/HTMLMediaElement.cpp index d1502cecfb237..d11c9d03a7e52 100644 --- dom/html/HTMLMediaElement.cpp +++ dom/html/HTMLMediaElement.cpp @@ -1710,6 +1710,14 @@ void HTMLMediaElement::ShutdownDecoder() if (mMediaSource) { mMediaSource->CompletePendingTransactions(); } + for (OutputMediaStream& out : mOutputStreams) { + if (!out.mCapturingDecoder) { + continue; + } + out.mNextAvailableTrackID = std::max( + mDecoder->NextAvailableTrackIDFor(out.mStream->GetInputStream()), + out.mNextAvailableTrackID); + } mDecoder->Shutdown(); mDecoder = nullptr; } @@ -3476,6 +3484,7 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded, if (mDecoder) { out->mCapturingDecoder = true; mDecoder->AddOutputStream(out->mStream->GetInputStream()->AsProcessedStream(), + out->mNextAvailableTrackID, aFinishWhenEnded); } else if (mSrcStream) { out->mCapturingMediaStream = true; @@ -3489,11 +3498,12 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded, if (mDecoder) { if (HasAudio()) { - TrackID audioTrackId = mMediaInfo.mAudio.mTrackId; + TrackID audioTrackId = out->mNextAvailableTrackID++; RefPtr trackSource = getter->GetMediaStreamTrackSource(audioTrackId); RefPtr track = - out->mStream->CreateDOMTrack(audioTrackId, MediaSegment::AUDIO, + out->mStream->CreateDOMTrack(audioTrackId, + MediaSegment::AUDIO, trackSource); out->mPreCreatedTracks.AppendElement(track); out->mStream->AddTrackInternal(track); @@ -3501,7 +3511,7 @@ HTMLMediaElement::CaptureStreamInternal(bool aFinishWhenEnded, ("Created audio track %d for captured decoder", audioTrackId)); } if (IsVideo() && HasVideo() && !out->mCapturingAudioOnly) { - TrackID videoTrackId = mMediaInfo.mVideo.mTrackId; + TrackID videoTrackId = out->mNextAvailableTrackID++; RefPtr trackSource = getter->GetMediaStreamTrackSource(videoTrackId); RefPtr track = @@ -4241,11 +4251,12 @@ HTMLMediaElement::WakeLockRelease() } HTMLMediaElement::OutputMediaStream::OutputMediaStream() - : mFinishWhenEnded(false) + : mNextAvailableTrackID(1) + , mFinishWhenEnded(false) , mCapturingAudioOnly(false) , mCapturingDecoder(false) , mCapturingMediaStream(false) - , mNextAvailableTrackID(1) {} +{} HTMLMediaElement::OutputMediaStream::~OutputMediaStream() { @@ -4844,6 +4855,7 @@ HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder) ms.mCapturingDecoder = true; aDecoder->AddOutputStream(ms.mStream->GetInputStream()->AsProcessedStream(), + ms.mNextAvailableTrackID, ms.mFinishWhenEnded); } diff --git dom/html/HTMLMediaElement.h dom/html/HTMLMediaElement.h index 126aaee2ae655..aeccfa5ba221d 100644 --- dom/html/HTMLMediaElement.h +++ dom/html/HTMLMediaElement.h @@ -838,6 +838,7 @@ protected: ~OutputMediaStream(); RefPtr mStream; + TrackID mNextAvailableTrackID; bool mFinishWhenEnded; bool mCapturingAudioOnly; bool mCapturingDecoder; @@ -849,7 +850,6 @@ protected: nsTArray> mPreCreatedTracks; // The following members are keeping state for a captured MediaStream. - TrackID mNextAvailableTrackID; nsTArray>> mTrackPorts; }; diff --git dom/media/MediaDecoder.cpp dom/media/MediaDecoder.cpp index c4bf14d1206fd..11d48fb9921c1 100644 --- dom/media/MediaDecoder.cpp +++ dom/media/MediaDecoder.cpp @@ -322,11 +322,13 @@ MediaDecoder::SetVolume(double aVolume) void MediaDecoder::AddOutputStream(ProcessedMediaStream* aStream, + TrackID aNextAvailableTrackID, bool aFinishWhenEnded) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mDecoderStateMachine, "Must be called after Load()."); - mDecoderStateMachine->AddOutputStream(aStream, aFinishWhenEnded); + mDecoderStateMachine->AddOutputStream( + aStream, aNextAvailableTrackID, aFinishWhenEnded); } void @@ -337,6 +339,14 @@ MediaDecoder::RemoveOutputStream(MediaStream* aStream) mDecoderStateMachine->RemoveOutputStream(aStream); } +TrackID +MediaDecoder::NextAvailableTrackIDFor(MediaStream* aOutputStream) const +{ + MOZ_ASSERT(NS_IsMainThread()); + MOZ_ASSERT(mDecoderStateMachine, "Must be called after Load()."); + return mDecoderStateMachine->NextAvailableTrackIDFor(aOutputStream); +} + double MediaDecoder::GetDuration() { diff --git dom/media/MediaDecoder.h dom/media/MediaDecoder.h index a8708b390433a..357f87ef8e0e8 100644 --- dom/media/MediaDecoder.h +++ dom/media/MediaDecoder.h @@ -183,9 +183,12 @@ public: // The stream is initially blocked. The decoder is responsible for unblocking // it while it is playing back. virtual void AddOutputStream(ProcessedMediaStream* aStream, + TrackID aNextAvailableTrackID, bool aFinishWhenEnded); // Remove an output stream added with AddOutputStream. virtual void RemoveOutputStream(MediaStream* aStream); + // The next TrackID that can be used without risk of a collision. + virtual TrackID NextAvailableTrackIDFor(MediaStream* aOutputStream) const; // Return the duration of the video in seconds. virtual double GetDuration(); diff --git dom/media/MediaDecoderStateMachine.cpp dom/media/MediaDecoderStateMachine.cpp index cea333f5d9a05..fef3b318b48cb 100644 --- dom/media/MediaDecoderStateMachine.cpp +++ dom/media/MediaDecoderStateMachine.cpp @@ -3973,11 +3973,12 @@ MediaDecoderStateMachine::RequestDebugInfo() } void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream, + TrackID aNextAvailableTrackID, bool aFinishWhenEnded) { MOZ_ASSERT(NS_IsMainThread()); LOG("AddOutputStream aStream=%p!", aStream); - mOutputStreamManager->Add(aStream, aFinishWhenEnded); + mOutputStreamManager->Add(aStream, aNextAvailableTrackID, aFinishWhenEnded); nsCOMPtr r = NewRunnableMethod("MediaDecoderStateMachine::SetAudioCaptured", this, @@ -4001,6 +4002,13 @@ void MediaDecoderStateMachine::RemoveOutputStream(MediaStream* aStream) } } +TrackID +MediaDecoderStateMachine::NextAvailableTrackIDFor(MediaStream* aOutputStream) const +{ + MOZ_ASSERT(NS_IsMainThread()); + return mOutputStreamManager->NextAvailableTrackIDFor(aOutputStream); +} + class VideoQueueMemoryFunctor : public nsDequeFunctor { public: diff --git dom/media/MediaDecoderStateMachine.h dom/media/MediaDecoderStateMachine.h index 6f7fcf825ea83..b59bcca7dc70a 100644 --- dom/media/MediaDecoderStateMachine.h +++ dom/media/MediaDecoderStateMachine.h @@ -175,9 +175,12 @@ public: RefPtr RequestDebugInfo(); - void AddOutputStream(ProcessedMediaStream* aStream, bool aFinishWhenEnded); + void AddOutputStream(ProcessedMediaStream* aStream, + TrackID aNextAvailableTrackID, + bool aFinishWhenEnded); // Remove an output stream added with AddOutputStream. void RemoveOutputStream(MediaStream* aStream); + TrackID NextAvailableTrackIDFor(MediaStream* aOutputStream) const; // Seeks to the decoder to aTarget asynchronously. RefPtr InvokeSeek(const SeekTarget& aTarget); diff --git dom/media/mediasink/DecodedStream.cpp dom/media/mediasink/DecodedStream.cpp index 5244a087c77e7..b5c40b9067e57 100644 --- dom/media/mediasink/DecodedStream.cpp +++ dom/media/mediasink/DecodedStream.cpp @@ -193,17 +193,22 @@ DecodedStreamData::DecodedStreamData(OutputStreamManager* aOutputStreamManager, , mAbstractMainThread(aMainThread) { mStream->AddListener(mListener); - mOutputStreamManager->Connect(mStream); + TrackID audioTrack = TRACK_NONE; + TrackID videoTrack = TRACK_NONE; // Initialize tracks. if (aInit.mInfo.HasAudio()) { - mStream->AddAudioTrack(aInit.mInfo.mAudio.mTrackId, + audioTrack = aInit.mInfo.mAudio.mTrackId; + mStream->AddAudioTrack(audioTrack, aInit.mInfo.mAudio.mRate, 0, new AudioSegment()); } if (aInit.mInfo.HasVideo()) { - mStream->AddTrack(aInit.mInfo.mVideo.mTrackId, 0, new VideoSegment()); + videoTrack = aInit.mInfo.mVideo.mTrackId; + mStream->AddTrack(videoTrack, 0, new VideoSegment()); } + + mOutputStreamManager->Connect(mStream, audioTrack, videoTrack); } DecodedStreamData::~DecodedStreamData() diff --git dom/media/mediasink/OutputStreamManager.cpp dom/media/mediasink/OutputStreamManager.cpp index d5685837a6783..b3ec8936d435e 100644 --- dom/media/mediasink/OutputStreamManager.cpp +++ dom/media/mediasink/OutputStreamManager.cpp @@ -13,29 +13,41 @@ OutputStreamData::~OutputStreamData() { MOZ_ASSERT(NS_IsMainThread()); // Break the connection to the input stream if necessary. - if (mPort) { - mPort->Destroy(); + for (RefPtr& port : mPorts) { + port->Destroy(); } } void -OutputStreamData::Init(OutputStreamManager* aOwner, ProcessedMediaStream* aStream) +OutputStreamData::Init(OutputStreamManager* aOwner, + ProcessedMediaStream* aStream, + TrackID aNextAvailableTrackID) { mOwner = aOwner; mStream = aStream; + mNextAvailableTrackID = aNextAvailableTrackID; } bool -OutputStreamData::Connect(MediaStream* aStream) +OutputStreamData::Connect(MediaStream* aStream, + TrackID aInputAudioTrackID, + TrackID aInputVideoTrackID) { MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(!mPort, "Already connected?"); + MOZ_ASSERT(mPorts.IsEmpty(), "Already connected?"); if (mStream->IsDestroyed()) { return false; } - mPort = mStream->AllocateInputPort(aStream); + for (TrackID tid : {aInputAudioTrackID, aInputVideoTrackID}) { + if (tid == TRACK_NONE) { + continue; + } + MOZ_ASSERT(IsTrackIDExplicit(tid)); + mPorts.AppendElement(mStream->AllocateInputPort( + aStream, tid, mNextAvailableTrackID++)); + } return true; } @@ -51,11 +63,11 @@ OutputStreamData::Disconnect() return false; } - // Disconnect the existing port if necessary. - if (mPort) { - mPort->Destroy(); - mPort = nullptr; + // Disconnect any existing port. + for (RefPtr& port : mPorts) { + port->Destroy(); } + mPorts.Clear(); return true; } @@ -71,8 +83,16 @@ OutputStreamData::Graph() const return mStream->Graph(); } +TrackID +OutputStreamData::NextAvailableTrackID() const +{ + return mNextAvailableTrackID; +} + void -OutputStreamManager::Add(ProcessedMediaStream* aStream, bool aFinishWhenEnded) +OutputStreamManager::Add(ProcessedMediaStream* aStream, + TrackID aNextAvailableTrackID, + bool aFinishWhenEnded) { MOZ_ASSERT(NS_IsMainThread()); // All streams must belong to the same graph. @@ -84,12 +104,12 @@ OutputStreamManager::Add(ProcessedMediaStream* aStream, bool aFinishWhenEnded) } OutputStreamData* p = mStreams.AppendElement(); - p->Init(this, aStream); + p->Init(this, aStream, aNextAvailableTrackID); // Connect to the input stream if we have one. Otherwise the output stream // will be connected in Connect(). if (mInputStream) { - p->Connect(mInputStream); + p->Connect(mInputStream, mInputAudioTrackID, mInputVideoTrackID); } } @@ -105,13 +125,29 @@ OutputStreamManager::Remove(MediaStream* aStream) } } +TrackID +OutputStreamManager::NextAvailableTrackIDFor(MediaStream* aOutputStream) const +{ + MOZ_ASSERT(NS_IsMainThread()); + for (const OutputStreamData& out : mStreams) { + if (out.Equals(aOutputStream)) { + return out.NextAvailableTrackID(); + } + } + return TRACK_INVALID; +} + void -OutputStreamManager::Connect(MediaStream* aStream) +OutputStreamManager::Connect(MediaStream* aStream, + TrackID aAudioTrackID, + TrackID aVideoTrackID) { MOZ_ASSERT(NS_IsMainThread()); mInputStream = aStream; + mInputAudioTrackID = aAudioTrackID; + mInputVideoTrackID = aVideoTrackID; for (int32_t i = mStreams.Length() - 1; i >= 0; --i) { - if (!mStreams[i].Connect(aStream)) { + if (!mStreams[i].Connect(aStream, mInputAudioTrackID, mInputVideoTrackID)) { // Probably the DOMMediaStream was GCed. Clean up. mStreams.RemoveElementAt(i); } @@ -123,6 +159,8 @@ OutputStreamManager::Disconnect() { MOZ_ASSERT(NS_IsMainThread()); mInputStream = nullptr; + mInputAudioTrackID = TRACK_INVALID; + mInputVideoTrackID = TRACK_INVALID; for (int32_t i = mStreams.Length() - 1; i >= 0; --i) { if (!mStreams[i].Disconnect()) { // Probably the DOMMediaStream was GCed. Clean up. diff --git dom/media/mediasink/OutputStreamManager.h dom/media/mediasink/OutputStreamManager.h index 7f91a60c1e9dd..8e89878e45090 100644 --- dom/media/mediasink/OutputStreamManager.h +++ dom/media/mediasink/OutputStreamManager.h @@ -9,6 +9,7 @@ #include "mozilla/RefPtr.h" #include "nsTArray.h" +#include "MediaSegment.h" namespace mozilla { @@ -21,11 +22,13 @@ class ProcessedMediaStream; class OutputStreamData { public: ~OutputStreamData(); - void Init(OutputStreamManager* aOwner, ProcessedMediaStream* aStream); + void Init(OutputStreamManager* aOwner, + ProcessedMediaStream* aStream, + TrackID aNextAvailableTrackID); - // Connect mStream to the input stream. + // Connect the given input stream's audio and video tracks to mStream. // Return false is mStream is already destroyed, otherwise true. - bool Connect(MediaStream* aStream); + bool Connect(MediaStream* aStream, TrackID aAudioTrackID, TrackID aVideoTrackID); // Disconnect mStream from its input stream. // Return false is mStream is already destroyed, otherwise true. bool Disconnect(); @@ -34,12 +37,16 @@ public: bool Equals(MediaStream* aStream) const; // Return the graph mStream belongs to. MediaStreamGraph* Graph() const; + // The next TrackID that will not cause a collision in mStream. + TrackID NextAvailableTrackID() const; private: OutputStreamManager* mOwner; RefPtr mStream; - // mPort connects our mStream to an input stream. - RefPtr mPort; + // mPort connects an input stream to our mStream. + nsTArray> mPorts; + // For guaranteeing TrackID uniqueness in our mStream. + TrackID mNextAvailableTrackID = TRACK_INVALID; }; class OutputStreamManager { @@ -47,18 +54,24 @@ class OutputStreamManager { public: // Add the output stream to the collection. - void Add(ProcessedMediaStream* aStream, bool aFinishWhenEnded); + void Add(ProcessedMediaStream* aStream, + TrackID aNextAvailableTrackID, + bool aFinishWhenEnded); // Remove the output stream from the collection. void Remove(MediaStream* aStream); + // The next TrackID that will not cause a collision in aOutputStream. + TrackID NextAvailableTrackIDFor(MediaStream* aOutputStream) const; // Return true if the collection empty. bool IsEmpty() const { MOZ_ASSERT(NS_IsMainThread()); return mStreams.IsEmpty(); } - // Connect all output streams in the collection to the input stream. - void Connect(MediaStream* aStream); - // Disconnect all output streams from the input stream. + // Connect the given input stream's tracks to all output streams. + void Connect(MediaStream* aStream, + TrackID aAudioTrackID, + TrackID aVideoTrackID); + // Disconnect the input stream to all output streams. void Disconnect(); // Return the graph these streams belong to or null if empty. MediaStreamGraph* Graph() const @@ -72,6 +85,8 @@ private: // Keep the input stream so we can connect the output streams that // are added after Connect(). RefPtr mInputStream; + TrackID mInputAudioTrackID = TRACK_INVALID; + TrackID mInputVideoTrackID = TRACK_INVALID; nsTArray mStreams; }; commit 91317ba976c8 Author: Andreas Pehrson Date: Wed May 30 10:44:56 2018 +0200 Bug 1453127 - Clear output streams on shutdown. r=jya, a=RyanVM --- dom/media/MediaDecoderStateMachine.cpp | 4 ++++ dom/media/mediasink/OutputStreamManager.cpp | 7 +++++++ dom/media/mediasink/OutputStreamManager.h | 2 ++ 3 files changed, 13 insertions(+) diff --git dom/media/MediaDecoderStateMachine.cpp dom/media/MediaDecoderStateMachine.cpp index fef3b318b48cb..582fe7ba995fe 100644 --- dom/media/MediaDecoderStateMachine.cpp +++ dom/media/MediaDecoderStateMachine.cpp @@ -3564,6 +3564,10 @@ MediaDecoderStateMachine::FinishDecodeFirstFrame() RefPtr MediaDecoderStateMachine::BeginShutdown() { + MOZ_ASSERT(NS_IsMainThread()); + if (mOutputStreamManager) { + mOutputStreamManager->Clear(); + } return InvokeAsync(OwnerThread(), this, __func__, &MediaDecoderStateMachine::Shutdown); } diff --git dom/media/mediasink/OutputStreamManager.cpp dom/media/mediasink/OutputStreamManager.cpp index b3ec8936d435e..7ecc203ed8309 100644 --- dom/media/mediasink/OutputStreamManager.cpp +++ dom/media/mediasink/OutputStreamManager.cpp @@ -125,6 +125,13 @@ OutputStreamManager::Remove(MediaStream* aStream) } } +void +OutputStreamManager::Clear() +{ + MOZ_ASSERT(NS_IsMainThread()); + mStreams.Clear(); +} + TrackID OutputStreamManager::NextAvailableTrackIDFor(MediaStream* aOutputStream) const { diff --git dom/media/mediasink/OutputStreamManager.h dom/media/mediasink/OutputStreamManager.h index 8e89878e45090..ec5040178ee0b 100644 --- dom/media/mediasink/OutputStreamManager.h +++ dom/media/mediasink/OutputStreamManager.h @@ -59,6 +59,8 @@ public: bool aFinishWhenEnded); // Remove the output stream from the collection. void Remove(MediaStream* aStream); + // Clear all output streams from the collection. + void Clear(); // The next TrackID that will not cause a collision in aOutputStream. TrackID NextAvailableTrackIDFor(MediaStream* aOutputStream) const; // Return true if the collection empty. Index: branches/2018Q2 =================================================================== --- branches/2018Q2 (revision 473585) +++ branches/2018Q2 (revision 473586) Property changes on: branches/2018Q2 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r473585