# HG changeset patch # User Wolfgang Rosenauer # Date 1598078019 -7200 # Node ID a9aa543a508ac21f624380ca4282bea17c79cf5e # Parent 4fd43e0d4a8f1a0504cc950e67bdaaaaf0c185aa FF79 latest diff -r 4fd43e0d4a8f -r a9aa543a508a MozillaFirefox/MozillaFirefox.changes --- a/MozillaFirefox/MozillaFirefox.changes Thu Jul 23 16:04:32 2020 +0200 +++ b/MozillaFirefox/MozillaFirefox.changes Sat Aug 22 08:33:39 2020 +0200 @@ -1,4 +1,56 @@ ------------------------------------------------------------------- +Thu Aug 20 13:07:33 UTC 2020 - Martin Liška + +- Use new memoryperjob _constraints instead of %limit_build macro. + +------------------------------------------------------------------- +Mon Aug 10 09:19:38 UTC 2020 - Wolfgang Rosenauer + +- use ccache for build +- replace versioned RPM deps with requires_ge +- parallelize locale build + +------------------------------------------------------------------- +Thu Aug 6 14:37:16 UTC 2020 - Yunhe Guo + +- Change *.appdata.xml location to latest AppStream standard + +------------------------------------------------------------------- +Thu Jul 23 21:00:34 UTC 2020 - Wolfgang Rosenauer + +- Mozilla Firefox 79.0 + MFSA 2020-30 (bsc#1174538) + * CVE-2020-15652 (bmo#1634872) + Potential leak of redirect targets when loading scripts in a worker + * CVE-2020-6514 (bmo#1642792) + WebRTC data channel leaks internal address to peer + * CVE-2020-15655 (bmo#1645204) + Extension APIs could be used to bypass Same-Origin Policy + * CVE-2020-15653 (bmo#1521542) + Bypassing iframe sandbox when allowing popups + * CVE-2020-6463 (bmo#1635293) + Use-after-free in ANGLE gl::Texture::onUnbindAsSamplerTexture + * CVE-2020-15656 (bmo#1647293) + Type confusion for special arguments in IonMonkey + * CVE-2020-15658 (bmo#1637745) + Overriding file type when saving to disk + * CVE-2020-15657 (bmo#1644954) + DLL hijacking due to incorrect loading path + * CVE-2020-15654 (bmo#1648333) + Custom cursor can overlay user interface + * CVE-2020-15659 (bmo#1550133, bmo#1633880, bmo#1638856, + bmo#1643613, bmo#1644839, bmo#1645835, bmo#1646006, bmo#1646220, + bmo#1646787, bmo#1649347, bmo#1650811, bmo#1651678) + Memory safety bugs fixed in Firefox 79 +- updated dependency requirements: + * mozilla-nspr >= 4.26 + * mozilla-nss >= 3.54 + * rust >= 1.43 + * rust-cbindgen >= 0.14.3 +- removed obsolete patch + mozilla-bmo1463035.patch + +------------------------------------------------------------------- Tue Jul 21 21:31:20 UTC 2020 - Wolfgang Rosenauer - fixed syntax issue in desktop file (boo#1174360) diff -r 4fd43e0d4a8f -r a9aa543a508a MozillaFirefox/MozillaFirefox.spec --- a/MozillaFirefox/MozillaFirefox.spec Thu Jul 23 16:04:32 2020 +0200 +++ b/MozillaFirefox/MozillaFirefox.spec Sat Aug 22 08:33:39 2020 +0200 @@ -82,13 +82,13 @@ BuildRequires: dbus-1-glib-devel BuildRequires: dejavu-fonts BuildRequires: fdupes -BuildRequires: memory-constraints %if 0%{?suse_version} <= 1320 BuildRequires: gcc9-c++ %else BuildRequires: gcc-c++ %endif BuildRequires: cargo >= 1.43 +BuildRequires: ccache BuildRequires: libXcomposite-devel BuildRequires: libcurl-devel BuildRequires: libidl-devel @@ -186,7 +186,6 @@ Patch2: mozilla-kde.patch Patch3: mozilla-ntlm-full-path.patch Patch4: mozilla-aarch64-startup-crash.patch -Patch5: mozilla-bmo1463035.patch Patch6: mozilla-sandbox-fips.patch Patch7: mozilla-fix-aarch64-libopus.patch Patch8: mozilla-disable-wasm-emulate-arm-unaligned-fp-access.patch @@ -217,8 +216,9 @@ Requires(post): coreutils shared-mime-info desktop-file-utils Requires(postun): shared-mime-info desktop-file-utils Requires: %{name}-branding >= 68 -Requires: mozilla-nspr >= %(rpm -q --queryformat '%%{VERSION}' mozilla-nspr) -Requires: mozilla-nss >= %(rpm -q --queryformat '%%{VERSION}' mozilla-nss) +%requires_ge mozilla-nspr +%requires_ge mozilla-nss +%requires_ge libfreetype6 Recommends: libcanberra0 Recommends: libpulse0 # addon leads to startup crash (bnc#908892) @@ -326,7 +326,6 @@ %patch2 -p1 %patch3 -p1 %patch4 -p1 -%patch5 -p1 %patch6 -p1 %patch7 -p1 %patch8 -p1 @@ -430,11 +429,6 @@ echo "" cat << EOF %else -%ifarch ppc64 ppc64le -%limit_build -m 2500 -%else -%limit_build -m 2000 -%endif cat << EOF > $MOZCONFIG %endif mk_add_options MOZILLA_OFFICIAL=1 @@ -465,6 +459,7 @@ #%endif ac_add_options --with-system-nspr ac_add_options --with-system-nss +ac_add_options --with-ccache %if %{localize} ac_add_options --with-l10n-base=$RPM_BUILD_DIR/l10n %endif @@ -533,7 +528,7 @@ mkdir -p %{buildroot}%{progdir}/browser/extensions truncate -s 0 %{_tmppath}/translations.{common,other} sed -r '/^(ja-JP-mac|en-US|)$/d;s/ .*$//' $RPM_BUILD_DIR/%{srcname}-%{orig_version}/browser/locales/shipped-locales \ - | xargs -n 1 -I {} /bin/sh -c ' + | xargs -n 1 -P 0 -I {} /bin/sh -c ' locale=$1 ./mach build langpack-$locale cp -L ../obj/dist/linux-*/xpi/firefox-%{orig_version}.$locale.langpack.xpi \ @@ -614,9 +609,9 @@ mkdir -p %{buildroot}%{_datadir}/mime/packages cp %{SOURCE8} %{buildroot}%{_datadir}/mime/packages/%{progname}.xml # appdata -mkdir -p %{buildroot}%{_datadir}/appdata +mkdir -p %{buildroot}%{_datadir}/metainfo sed "s:firefox.desktop:%{desktop_file_name}:g" \ - %{SOURCE15} > %{buildroot}%{_datadir}/appdata/%{desktop_file_name}.appdata.xml + %{SOURCE15} > %{buildroot}%{_datadir}/metainfo/%{desktop_file_name}.appdata.xml # install man-page mkdir -p %{buildroot}%{_mandir}/man1/ cp %{SOURCE11} %{buildroot}%{_mandir}/man1/%{progname}.1 @@ -749,7 +744,7 @@ %{gnome_dir}/share/icons/hicolor/ %{_bindir}/%{progname} %doc %{_mandir}/man1/%{progname}.1.gz -%{_datadir}/appdata/ +%{_datadir}/metainfo/ %if 0%{?devpkg} %files devel diff -r 4fd43e0d4a8f -r a9aa543a508a MozillaFirefox/_constraints --- a/MozillaFirefox/_constraints Thu Jul 23 16:04:32 2020 +0200 +++ b/MozillaFirefox/_constraints Sat Aug 22 08:33:39 2020 +0200 @@ -7,6 +7,9 @@ 8 + + 2000 + @@ -54,6 +57,9 @@ 10 + + 2500 + diff -r 4fd43e0d4a8f -r a9aa543a508a MozillaFirefox/firefox.1 --- a/MozillaFirefox/firefox.1 Thu Jul 23 16:04:32 2020 +0200 +++ b/MozillaFirefox/firefox.1 Sat Aug 22 08:33:39 2020 +0200 @@ -60,7 +60,7 @@ \fB\-\-UILocale\fR \fIlocale\fR Start with \fIlocale\fR resources as UI Locale. .TP -\fB\-\-save\-mode\fR +\fB\-\-safe\-mode\fR Disables extensions and themes for this session. .TP \fB\-\-headless\fR diff -r 4fd43e0d4a8f -r a9aa543a508a MozillaFirefox/mozilla-bmo1463035.patch --- a/MozillaFirefox/mozilla-bmo1463035.patch Thu Jul 23 16:04:32 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -../mozilla-bmo1463035.patch \ No newline at end of file diff -r 4fd43e0d4a8f -r a9aa543a508a MozillaFirefox/tar_stamps --- a/MozillaFirefox/tar_stamps Thu Jul 23 16:04:32 2020 +0200 +++ b/MozillaFirefox/tar_stamps Sat Aug 22 08:33:39 2020 +0200 @@ -1,11 +1,11 @@ PRODUCT="firefox" CHANNEL="release" -VERSION="78.0.2" +VERSION="79.0" VERSION_SUFFIX="" -PREV_VERSION="78.0.1" +PREV_VERSION="78.0.2" PREV_VERSION_SUFFIX="" #SKIP_LOCALES="" # Uncomment to skip l10n and compare-locales-generation RELEASE_REPO="https://hg.mozilla.org/releases/mozilla-release" -RELEASE_TAG="e56adbbfe01c2443bae35e3d6f34867e36c3828e" -RELEASE_TIMESTAMP="20200708170202" +RELEASE_TAG="df3ed76cf46b23c9b658cd5be4cdd4162d86f736" +RELEASE_TIMESTAMP="20200720193547" diff -r 4fd43e0d4a8f -r a9aa543a508a mozilla-bmo1463035.patch --- a/mozilla-bmo1463035.patch Thu Jul 23 16:04:32 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ - -# HG changeset patch -# User Mike Hommey -# Date 1526871862 -32400 -# Node ID 94f21505ff13cd089f7129cd24927cf8b31a0f43 -# Parent 0b7e1398ca2e15e27da93144ba9fb30db38367b1 -Bug 1463035 - Remove MOZ_SIGNAL_TRAMPOLINE. r?darchons - -For some reason, GNU as is not happy with the assembly generated after -bug 1238661 anymore on Debian armel. - -OTOH, as mentioned in bug 1238661 comment 4, we actually don't need this -workaround anymore, so let's just kill it. - -diff --git a/mozglue/baseprofiler/core/platform-linux-android.cpp b/mozglue/baseprofiler/core/platform-linux-android.cpp ---- a/mozglue/baseprofiler/core/platform-linux-android.cpp -+++ b/mozglue/baseprofiler/core/platform-linux-android.cpp -@@ -55,17 +55,16 @@ - #ifdef __GLIBC__ - # include // backtrace, backtrace_symbols - #endif // def __GLIBC__ - #include // index - #include - #include - - #include "prenv.h" --#include "mozilla/LinuxSignal.h" - #include "mozilla/PodOperations.h" - #include "mozilla/DebugOnly.h" - - #include - #include - - using namespace mozilla; - -@@ -266,17 +265,17 @@ Sampler::Sampler(PSLockRef aLock) - - // NOTE: We don't initialize LUL here, instead initializing it in - // SamplerThread's constructor. This is because with the - // profiler_suspend_and_sample_thread entry point, we want to be able to - // sample without waiting for LUL to be initialized. - - // Request profiling signals. - struct sigaction sa; -- sa.sa_sigaction = MOZ_SIGNAL_TRAMPOLINE(SigprofHandler); -+ sa.sa_sigaction = SigprofHandler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_RESTART | SA_SIGINFO; - if (sigaction(SIGPROF, &sa, &mOldSigprofHandler) != 0) { - MOZ_CRASH("Error installing SIGPROF handler in the profiler"); - } - } - - void Sampler::Disable(PSLockRef aLock) { -diff --git a/tools/profiler/core/platform-linux-android.cpp b/tools/profiler/core/platform-linux-android.cpp ---- a/tools/profiler/core/platform-linux-android.cpp -+++ b/tools/profiler/core/platform-linux-android.cpp -@@ -258,17 +258,17 @@ Sampler::Sampler(PSLockRef aLock) - - // NOTE: We don't initialize LUL here, instead initializing it in - // SamplerThread's constructor. This is because with the - // profiler_suspend_and_sample_thread entry point, we want to be able to - // sample without waiting for LUL to be initialized. - - // Request profiling signals. - struct sigaction sa; -- sa.sa_sigaction = MOZ_SIGNAL_TRAMPOLINE(SigprofHandler); -+ sa.sa_sigaction = SigprofHandler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_RESTART | SA_SIGINFO; - if (sigaction(SIGPROF, &sa, &mOldSigprofHandler) != 0) { - MOZ_CRASH("Error installing SIGPROF handler in the profiler"); - } - } - - void Sampler::Disable(PSLockRef aLock) { diff -r 4fd43e0d4a8f -r a9aa543a508a mozilla-kde.patch --- a/mozilla-kde.patch Thu Jul 23 16:04:32 2020 +0200 +++ b/mozilla-kde.patch Sat Aug 22 08:33:39 2020 +0200 @@ -3,7 +3,7 @@ # Date 1559294891 -7200 # Fri May 31 11:28:11 2019 +0200 # Node ID c2aa7198fb925e7fde96abf65b6f68b9b755f112 -# Parent aa58e8c70d1448a08407c6c191ea8b76d61e8bf6 +# Parent 43647626f7204e312a4e38cac0414a461b06667f Description: Add KDE integration to Firefox (toolkit parts) Author: Wolfgang Rosenauer Author: Lubos Lunak @@ -31,7 +31,7 @@ #ifdef MOZ_MEMORY # include "mozmemory.h" #endif -@@ -4566,25 +4567,37 @@ nsresult Preferences::InitInitialObjects +@@ -4570,25 +4571,37 @@ nsresult Preferences::InitInitialObjects // application pref files for backwards compatibility. static const char* specialFiles[] = { #if defined(XP_MACOSX) @@ -69,7 +69,7 @@ // Load jar:$app/omni.jar!/defaults/preferences/*.js // or jar:$gre/omni.jar!/defaults/preferences/*.js. -@@ -4630,17 +4643,17 @@ nsresult Preferences::InitInitialObjects +@@ -4634,17 +4647,17 @@ nsresult Preferences::InitInitialObjects } nsCOMPtr path = do_QueryInterface(elem); @@ -91,7 +91,7 @@ diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build --- a/modules/libpref/moz.build +++ b/modules/libpref/moz.build -@@ -114,16 +114,20 @@ EXPORTS.mozilla += [ +@@ -117,16 +117,20 @@ EXPORTS.mozilla += [ ] EXPORTS.mozilla += sorted(['!' + g for g in gen_h]) @@ -106,12 +106,12 @@ + gen_all_tuple = tuple(gen_h + gen_cpp + gen_rs) - GENERATED_FILES += [gen_all_tuple] + GeneratedFile(*gen_all_tuple, script='init/generate_static_pref_list.py', + entry_point='emit_code', inputs=['init/StaticPrefList.yaml']) - static_pref_list = GENERATED_FILES[gen_all_tuple] - static_pref_list.script = 'init/generate_static_pref_list.py:emit_code' - static_pref_list.inputs = ['init/StaticPrefList.yaml'] - + PYTHON_UNITTEST_MANIFESTS += [ + 'test/python.ini', + ] diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py --- a/python/mozbuild/mozpack/chrome/flags.py +++ b/python/mozbuild/mozpack/chrome/flags.py @@ -356,7 +356,7 @@ diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build --- a/toolkit/xre/moz.build +++ b/toolkit/xre/moz.build -@@ -88,17 +88,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co +@@ -90,17 +90,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co '../components/printingui', ] elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit': @@ -1293,7 +1293,7 @@ diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build --- a/widget/gtk/moz.build +++ b/widget/gtk/moz.build -@@ -131,16 +131,17 @@ include('/ipc/chromium/chromium-config.m +@@ -133,16 +133,17 @@ include('/ipc/chromium/chromium-config.m FINAL_LIBRARY = 'xul' diff -r 4fd43e0d4a8f -r a9aa543a508a mozilla-pipewire-0-3.patch --- a/mozilla-pipewire-0-3.patch Thu Jul 23 16:04:32 2020 +0200 +++ b/mozilla-pipewire-0-3.patch Sat Aug 22 08:33:39 2020 +0200 @@ -1,8 +1,15 @@ +# HG changeset patch +# Parent f530b1587cd1c0a79c34f91a9690c4cc4c33ac31 + diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild -index 2081d0c683a4..641133bf1ea4 100644 --- a/config/system-headers.mozbuild +++ b/config/system-headers.mozbuild -@@ -314,6 +314,7 @@ system_headers = [ +@@ -309,16 +309,17 @@ system_headers = [ + 'gdk/gdkkeysyms.h', + 'gdk/gdkprivate.h', + 'gdk/gdkwayland.h', + 'gdk/gdkx.h', + 'gdk-pixbuf/gdk-pixbuf.h', 'Gestalt.h', 'getopt.h', 'gio/gio.h', @@ -10,7 +17,17 @@ 'glibconfig.h', 'glib.h', 'glib-object.h', -@@ -607,6 +608,7 @@ system_headers = [ + 'glob.h', + 'gmodule.h', + 'gnome.h', + 'gnu/libc-version.h', + 'gps.h', +@@ -602,16 +603,17 @@ system_headers = [ + 'pango/pangoxft.h', + 'pascal.h', + 'Patches.h', + 'Path.h', + 'pcfs/pc_dir.h', 'Pgenerr.h', 'PGenErr.h', 'Ph.h', @@ -18,11 +35,20 @@ 'pixman.h', 'pk11func.h', 'pk11pqg.h', + 'pk11priv.h', + 'pk11pub.h', + 'pk11sdr.h', + 'pkcs11f.h', + 'pkcs11.h', diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn b/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn -index ba885217b3ba..201d3b755221 100644 --- a/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn -@@ -158,7 +158,7 @@ if (rtc_include_tests) { +@@ -153,17 +153,17 @@ if (rtc_include_tests) { + "../../test:test_support", + ] + } + } + if (is_linux) { if (rtc_use_pipewire) { pkg_config("pipewire") { @@ -31,12 +57,21 @@ defines = [ "WEBRTC_USE_PIPEWIRE" ] } + + pkg_config("gio") { + packages = [ + "gio-2.0", + "gio-unix-2.0", diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build -index 90b40431c7e4..d844aa79d591 100644 --- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build -@@ -194,6 +194,30 @@ if CONFIG["OS_TARGET"] == "Linux": - "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc" +@@ -289,16 +289,40 @@ if CONFIG["OS_TARGET"] == "WINNT": + "/media/webrtc/trunk/webrtc/modules/desktop_capture/win/screen_capturer_win_directx.cc", + "/media/webrtc/trunk/webrtc/modules/desktop_capture/win/screen_capturer_win_magnifier.cc", + "/media/webrtc/trunk/webrtc/modules/desktop_capture/win/win_shared.cc", + "/media/webrtc/trunk/webrtc/modules/desktop_capture/win/window_capture_utils.cc", + "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_win.cc", + "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_finder_win.cc" ] +# PipeWire specific files @@ -66,11 +101,20 @@ if CONFIG["OS_TARGET"] == "NetBSD": DEFINES["USE_X11"] = "1" + DEFINES["WEBRTC_BSD"] = True + DEFINES["WEBRTC_POSIX"] = True + DEFINES["_FILE_OFFSET_BITS"] = "64" + + OS_LIBS += [ diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h -index 1eb8ead26efa..316468eed1fc 100644 --- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h -@@ -141,7 +141,7 @@ class DesktopCaptureOptions { +@@ -136,15 +136,15 @@ class DesktopCaptureOptions { + #if defined(USE_X11) + bool use_update_notifications_ = false; + #else + bool use_update_notifications_ = true; + #endif bool disable_effects_ = true; bool detect_updated_region_ = false; #if defined(WEBRTC_USE_PIPEWIRE) @@ -79,11 +123,18 @@ #endif }; + } // namespace webrtc + + #endif // MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_ diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc -index 379341c833de..76349f1fbd4d 100644 --- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc -@@ -15,8 +15,11 @@ +@@ -10,18 +10,21 @@ + + #include "modules/desktop_capture/linux/base_capturer_pipewire.h" + + #include + #include #include #include @@ -97,34 +148,36 @@ #include #include -@@ -36,31 +39,36 @@ const char kSessionInterfaceName[] = "org.freedesktop.portal.Session"; + + #include "modules/desktop_capture/desktop_capture_options.h" + #include "modules/desktop_capture/desktop_capturer.h" + #include "rtc_base/checks.h" + #include "rtc_base/logging.h" +@@ -31,181 +34,158 @@ namespace webrtc { + const char kDesktopBusName[] = "org.freedesktop.portal.Desktop"; + const char kDesktopObjectPath[] = "/org/freedesktop/portal/desktop"; + const char kDesktopRequestObjectPath[] = + "/org/freedesktop/portal/desktop/request"; + const char kSessionInterfaceName[] = "org.freedesktop.portal.Session"; const char kRequestInterfaceName[] = "org.freedesktop.portal.Request"; const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast"; --// static ++ + // static -void BaseCapturerPipeWire::OnStateChanged(void* data, - pw_remote_state old_state, - pw_remote_state state, - const char* error_message) { - BaseCapturerPipeWire* that = static_cast(data); - RTC_DCHECK(that); ++void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) { ++ struct dma_buf_sync sync = { 0 }; ++ ++ sync.flags = start_or_end | DMA_BUF_SYNC_READ; - switch (state) { - case PW_REMOTE_STATE_ERROR: - RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message; -- break; -- case PW_REMOTE_STATE_CONNECTED: -- RTC_LOG(LS_INFO) << "PipeWire remote state: connected."; -- that->CreateReceivingStream(); -- break; -- case PW_REMOTE_STATE_CONNECTING: -- RTC_LOG(LS_INFO) << "PipeWire remote state: connecting."; -+// static -+void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) { -+ struct dma_buf_sync sync = { 0 }; -+ -+ sync.flags = start_or_end | DMA_BUF_SYNC_READ; -+ + while(true) { + int ret; + ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync); @@ -133,15 +186,22 @@ + } else if (ret == -1) { + RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: " << g_strerror(errno); break; +- case PW_REMOTE_STATE_CONNECTED: +- RTC_LOG(LS_INFO) << "PipeWire remote state: connected."; +- that->CreateReceivingStream(); ++ } else { + break; +- case PW_REMOTE_STATE_CONNECTING: +- RTC_LOG(LS_INFO) << "PipeWire remote state: connecting."; +- break; - case PW_REMOTE_STATE_UNCONNECTED: - RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected."; -+ } else { - break; +- break; + } } } -+// static + // static +void BaseCapturerPipeWire::OnCoreError(void *data, + uint32_t id, + int seq, @@ -150,23 +210,28 @@ + RTC_LOG(LS_ERROR) << "core error: " << message; +} + - // static ++// static void BaseCapturerPipeWire::OnStreamStateChanged(void* data, pw_stream_state old_state, -@@ -73,76 +81,54 @@ void BaseCapturerPipeWire::OnStreamStateChanged(void* data, + pw_stream_state state, + const char* error_message) { + BaseCapturerPipeWire* that = static_cast(data); + RTC_DCHECK(that); + + switch (state) { case PW_STREAM_STATE_ERROR: RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message; break; - case PW_STREAM_STATE_CONFIGURE: - pw_stream_set_active(that->pw_stream_, true); - break; -- case PW_STREAM_STATE_UNCONNECTED: -- case PW_STREAM_STATE_CONNECTING: ++ case PW_STREAM_STATE_PAUSED: ++ case PW_STREAM_STATE_STREAMING: + case PW_STREAM_STATE_UNCONNECTED: + case PW_STREAM_STATE_CONNECTING: - case PW_STREAM_STATE_READY: - case PW_STREAM_STATE_PAUSED: - case PW_STREAM_STATE_STREAMING: -+ case PW_STREAM_STATE_UNCONNECTED: -+ case PW_STREAM_STATE_CONNECTING: +- case PW_STREAM_STATE_PAUSED: +- case PW_STREAM_STATE_STREAMING: break; } } @@ -256,20 +321,20 @@ } // static -@@ -150,15 +136,25 @@ void BaseCapturerPipeWire::OnStreamProcess(void* data) { + void BaseCapturerPipeWire::OnStreamProcess(void* data) { BaseCapturerPipeWire* that = static_cast(data); RTC_DCHECK(that); - pw_buffer* buf = nullptr; + struct pw_buffer *next_buffer; + struct pw_buffer *buffer = nullptr; -+ + +- if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) { + next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); + while (next_buffer) { + buffer = next_buffer; + next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); - -- if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) { ++ + if (next_buffer) + pw_stream_queue_buffer (that->pw_stream_, buffer); + } @@ -286,7 +351,10 @@ } BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type) -@@ -169,38 +165,22 @@ BaseCapturerPipeWire::~BaseCapturerPipeWire() { + : capture_source_type_(source_type) {} + + BaseCapturerPipeWire::~BaseCapturerPipeWire() { + if (pw_main_loop_) { pw_thread_loop_stop(pw_main_loop_); } @@ -329,16 +397,22 @@ if (start_request_signal_id_) { g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_); } -@@ -250,27 +230,35 @@ void BaseCapturerPipeWire::InitPortal() { + if (sources_request_signal_id_) { + g_dbus_connection_signal_unsubscribe(connection_, + sources_request_signal_id_); + } + if (session_request_signal_id_) { +@@ -245,142 +225,220 @@ void BaseCapturerPipeWire::InitPortal() + kDesktopBusName, kDesktopObjectPath, kScreenCastInterfaceName, + /*cancellable=*/nullptr, + reinterpret_cast(OnProxyRequested), this); + } + void BaseCapturerPipeWire::InitPipeWire() { pw_init(/*argc=*/nullptr, /*argc=*/nullptr); - pw_loop_ = pw_loop_new(/*properties=*/nullptr); - pw_main_loop_ = pw_thread_loop_new(pw_loop_, "pipewire-main-loop"); -- -- pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr); -- pw_core_type_ = pw_core_get_type(pw_core_); -- pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0); + pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr); + pw_context_ = pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0); + if (!pw_context_) { @@ -346,6 +420,10 @@ + return; + } +- pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr); +- pw_core_type_ = pw_core_get_type(pw_core_); +- pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0); +- - InitPipeWireTypes(); + pw_core_ = pw_context_connect(pw_context_, nullptr, 0); + if (!pw_core_) { @@ -378,7 +456,7 @@ if (pw_thread_loop_start(pw_main_loop_) < 0) { RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop"; -@@ -278,81 +266,132 @@ void BaseCapturerPipeWire::InitPipeWire() { + portal_init_failed_ = true; } } @@ -391,19 +469,20 @@ - spa_type_format_video_map(map, &pw_type_->format_video); - spa_type_video_format_map(map, &pw_type_->video_format); -} -- ++pw_stream* BaseCapturerPipeWire::CreateReceivingStream() { ++ spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; ++ spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX}; + -void BaseCapturerPipeWire::CreateReceivingStream() { -+pw_stream* BaseCapturerPipeWire::CreateReceivingStream() { - spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; +- spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; - spa_rectangle pwScreenBounds = - spa_rectangle{static_cast(desktop_size_.width()), - static_cast(desktop_size_.height())}; -+ spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX}; ++ auto stream = pw_stream_new(pw_core_, "webrtc-pipewire-stream", nullptr); - spa_fraction pwFrameRateMin = spa_fraction{0, 1}; - spa_fraction pwFrameRateMax = spa_fraction{60, 1}; -+ auto stream = pw_stream_new(pw_core_, "webrtc-pipewire-stream", nullptr); - +- - pw_properties* reuseProps = pw_properties_new("pipewire.client.reuse", "1", - /*end of varargs*/ nullptr); - pw_stream_ = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps); @@ -439,12 +518,11 @@ - // min and max values and it is undecided (u) to allow negotiation - ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2, - &pwFrameRateMin, &pwFrameRateMax)); -- ++ const spa_pod* params[2]; ++ spa_pod_builder builder = SPA_POD_BUILDER_INIT(buffer, sizeof (buffer)); + - pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_, - this); -+ const spa_pod* params[2]; -+ spa_pod_builder builder = SPA_POD_BUILDER_INIT(buffer, sizeof (buffer)); -+ + params[0] = reinterpret_cast(spa_pod_builder_add_object(&builder, + SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, + SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video), @@ -494,13 +572,13 @@ + RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno); + return; + } -+ + +- if (!(src = spaBuffer->datas[0].data)) { + src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); + } else if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) { + int fd; + fd = spaBuffer->datas[0].fd; - -- if (!(src = spaBuffer->datas[0].data)) { ++ + map = static_cast(mmap( + nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, + PROT_READ, MAP_PRIVATE, fd, 0)); @@ -569,14 +647,27 @@ if (srcStride != (desktop_size_.width() * kBytesPerPixel)) { RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: " << srcStride -@@ -361,21 +400,40 @@ void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) { + << " != " << (desktop_size_.width() * kBytesPerPixel); + portal_init_failed_ = true; return; } - if (!current_frame_) { - current_frame_ = static_cast(malloc(maxSize)); +- } +- RTC_DCHECK(current_frame_ != nullptr); + dst = current_frame_.get(); -+ + +- // If both sides decided to go with the RGBx format we need to convert it to +- // BGRx to match color format expected by WebRTC. +- if (spa_video_format_->format == pw_type_->video_format.RGBx) { +- uint8_t* tempFrame = static_cast(malloc(maxSize)); +- std::memcpy(tempFrame, src, maxSize); +- ConvertRGBxToBGRx(tempFrame, maxSize); +- std::memcpy(current_frame_, tempFrame, maxSize); +- free(tempFrame); +- } else { +- std::memcpy(current_frame_, src, maxSize); + // Adjust source content based on crop video position + if (video_crop_size_initialized_ && + (video_crop->region.position.y + video_crop_size_.height() <= desktop_size_.height())) { @@ -602,19 +693,8 @@ + } + src += srcStride - xOffset; + dst += dstStride; - } -- RTC_DCHECK(current_frame_ != nullptr); - -- // If both sides decided to go with the RGBx format we need to convert it to -- // BGRx to match color format expected by WebRTC. -- if (spa_video_format_->format == pw_type_->video_format.RGBx) { -- uint8_t* tempFrame = static_cast(malloc(maxSize)); -- std::memcpy(tempFrame, src, maxSize); -- ConvertRGBxToBGRx(tempFrame, maxSize); -- std::memcpy(current_frame_, tempFrame, maxSize); -- free(tempFrame); -- } else { -- std::memcpy(current_frame_, src, maxSize); ++ } ++ + if (map) { + if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) { + SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_END); @@ -623,7 +703,17 @@ } } -@@ -725,10 +783,7 @@ void BaseCapturerPipeWire::OnStartRequestResponseSignal( + void BaseCapturerPipeWire::ConvertRGBxToBGRx(uint8_t* frame, uint32_t size) { + // Change color format for KDE KWin which uses RGBx and not BGRx + for (uint32_t i = 0; i < size; i += 4) { + uint8_t tempR = frame[i]; + uint8_t tempB = frame[i + 2]; +@@ -720,20 +778,17 @@ void BaseCapturerPipeWire::OnStartReques + guint32 stream_id; + gint32 width; + gint32 height; + GVariant* options; + g_variant_get(variant, "(u@a{sv})", &stream_id, &options); RTC_DCHECK(options != nullptr); @@ -635,7 +725,17 @@ g_variant_unref(options); g_variant_unref(variant); } -@@ -813,10 +868,15 @@ void BaseCapturerPipeWire::CaptureFrame() { + } + g_variant_iter_free(iter); + g_variant_unref(response_data); + + that->OpenPipeWireRemote(); +@@ -808,20 +863,25 @@ void BaseCapturerPipeWire::CaptureFrame( + return; + } + + if (!current_frame_) { + callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); return; } @@ -654,7 +754,17 @@ if (!result) { callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); return; -@@ -837,4 +897,22 @@ bool BaseCapturerPipeWire::SelectSource(SourceId id) { + } + callback_->OnCaptureResult(Result::SUCCESS, std::move(result)); + } + + bool BaseCapturerPipeWire::GetSourceList(SourceList* sources) { +@@ -832,9 +892,27 @@ bool BaseCapturerPipeWire::GetSourceList + return true; + } + + bool BaseCapturerPipeWire::SelectSource(SourceId id) { + // Screen selection is handled by the xdg-desktop-portal. return true; } @@ -678,10 +788,14 @@ + } // namespace webrtc diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h -index 56b101acbaa6..de54157d1a2a 100644 --- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h -@@ -22,17 +22,13 @@ +@@ -17,99 +17,103 @@ + #include + + #include "modules/desktop_capture/desktop_capture_options.h" + #include "modules/desktop_capture/desktop_capturer.h" + #include "rtc_base/constructormagic.h" namespace webrtc { @@ -704,7 +818,10 @@ explicit BaseCapturerPipeWire(CaptureSourceType source_type); ~BaseCapturerPipeWire() override; -@@ -43,28 +39,32 @@ class BaseCapturerPipeWire : public DesktopCapturer { + + // DesktopCapturer interface. + void Start(Callback* delegate) override; + void CaptureFrame() override; bool GetSourceList(SourceList* sources) override; bool SelectSource(SourceId id) override; @@ -745,7 +862,13 @@ // <-- end of PipeWire types -@@ -78,33 +78,37 @@ class BaseCapturerPipeWire : public DesktopCapturer { + GDBusConnection* connection_ = nullptr; + GDBusProxy* proxy_ = nullptr; + gchar* portal_handle_ = nullptr; + gchar* session_handle_ = nullptr; + gchar* sources_handle_ = nullptr; + gchar* start_handle_ = nullptr; + guint session_request_signal_id_ = 0; guint sources_request_signal_id_ = 0; guint start_request_signal_id_ = 0; @@ -792,11 +915,20 @@ static void OnStreamProcess(void* data); static void OnNewBuffer(void* data, uint32_t id); + guint SetupRequestResponseSignal(const gchar* object_path, + GDBusSignalCallback callback); + + static void OnProxyRequested(GObject* object, + GAsyncResult* result, diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc -index 26956fc67dc8..3813d697bb38 100644 --- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc -@@ -15,7 +15,7 @@ +@@ -10,17 +10,17 @@ + + #include "modules/desktop_capture/linux/screen_capturer_pipewire.h" + + #include + namespace webrtc { ScreenCapturerPipeWire::ScreenCapturerPipeWire() @@ -805,11 +937,20 @@ ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {} // static + std::unique_ptr + ScreenCapturerPipeWire::CreateRawScreenCapturer( + const DesktopCaptureOptions& options) { + return std::make_unique(); + } diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc -index 35436475cb4d..c43a1f1a0c4e 100644 --- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc -@@ -15,7 +15,7 @@ +@@ -10,17 +10,17 @@ + + #include "modules/desktop_capture/linux/window_capturer_pipewire.h" + + #include + namespace webrtc { WindowCapturerPipeWire::WindowCapturerPipeWire() @@ -818,11 +959,20 @@ WindowCapturerPipeWire::~WindowCapturerPipeWire() {} // static + std::unique_ptr + WindowCapturerPipeWire::CreateRawWindowCapturer( + const DesktopCaptureOptions& options) { + return std::make_unique(); + } diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc -index cf8a9dd0e0db..d27fab8d28d9 100644 --- a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc -@@ -26,7 +26,7 @@ std::unique_ptr DesktopCapturer::CreateRawScreenCapturer( +@@ -21,17 +21,17 @@ + + namespace webrtc { + + // static + std::unique_ptr DesktopCapturer::CreateRawScreenCapturer( const DesktopCaptureOptions& options) { #if defined(WEBRTC_USE_PIPEWIRE) if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { @@ -831,11 +981,20 @@ } #endif // defined(WEBRTC_USE_PIPEWIRE) + #if defined(USE_X11) + return ScreenCapturerX11::CreateRawScreenCapturer(options); + #endif // defined(USE_X11) + + return nullptr; diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc -index 82359e50c2db..bb9724cf7cc2 100644 --- a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc -@@ -26,7 +26,7 @@ std::unique_ptr DesktopCapturer::CreateRawWindowCapturer( +@@ -21,17 +21,17 @@ + + namespace webrtc { + + // static + std::unique_ptr DesktopCapturer::CreateRawWindowCapturer( const DesktopCaptureOptions& options) { #if defined(WEBRTC_USE_PIPEWIRE) if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { @@ -844,3 +1003,8 @@ } #endif // defined(WEBRTC_USE_PIPEWIRE) + #if defined(USE_X11) + return WindowCapturerX11::CreateRawWindowCapturer(options); + #endif // defined(USE_X11) + + return nullptr; diff -r 4fd43e0d4a8f -r a9aa543a508a series --- a/series Thu Jul 23 16:04:32 2020 +0200 +++ b/series Sat Aug 22 08:33:39 2020 +0200 @@ -3,7 +3,6 @@ mozilla-kde.patch mozilla-ntlm-full-path.patch mozilla-aarch64-startup-crash.patch -mozilla-bmo1463035.patch mozilla-sandbox-fips.patch mozilla-fix-aarch64-libopus.patch mozilla-disable-wasm-emulate-arm-unaligned-fp-access.patch