forked from Lainports/freebsd-ports
www/firefox: update to 97.0 (rc1)
Release Notes (soon): https://www.mozilla.org/en-US/firefox/97.0/releasenotes/ PR: 261642
This commit is contained in:
parent
b6643bf0a3
commit
a012dd67b2
11 changed files with 20249 additions and 253473 deletions
|
|
@ -167,6 +167,9 @@ pixman_MOZ_OPTIONS= --enable-system-pixman
|
|||
|
||||
png_LIB_DEPENDS= libpng.so:graphics/png
|
||||
png_MOZ_OPTIONS= --with-system-png=${LOCALBASE}
|
||||
.if ${MOZILLA_VER:R:R} >= 97
|
||||
png_MOZ_OPTIONS= --with-system-png
|
||||
.endif
|
||||
|
||||
sqlite_LIB_DEPENDS= libsqlite3.so:databases/sqlite3
|
||||
sqlite_MOZ_OPTIONS= --enable-system-sqlite
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Created by: Alan Eldridge <alane@FreeBSD.org>
|
||||
|
||||
PORTNAME= firefox
|
||||
DISTVERSION= 96.0.3
|
||||
DISTVERSION= 97.0
|
||||
PORTEPOCH= 2
|
||||
CATEGORIES= www
|
||||
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \
|
||||
|
|
@ -12,7 +12,7 @@ MAINTAINER= gecko@FreeBSD.org
|
|||
COMMENT= Web browser based on the browser portion of Mozilla
|
||||
|
||||
BUILD_DEPENDS= nspr>=4.32:devel/nspr \
|
||||
nss>=3.73:security/nss \
|
||||
nss>=3.74:security/nss \
|
||||
icu>=70.1:devel/icu \
|
||||
libevent>=2.1.8:devel/libevent \
|
||||
harfbuzz>=2.9.1:print/harfbuzz \
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1643336011
|
||||
SHA256 (firefox-96.0.3.source.tar.xz) = 1a741d6fcf20e6833a90169f41d29141ea4610f58b848e06091a683af6304dea
|
||||
SIZE (firefox-96.0.3.source.tar.xz) = 406721708
|
||||
TIMESTAMP = 1643713139
|
||||
SHA256 (firefox-97.0.source.tar.xz) = 7a98c83d552ffde2b858fa288778c6d44d0077c3a9488293280184ee856420ee
|
||||
SIZE (firefox-97.0.source.tar.xz) = 487369236
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ Unbreak build with Rust 1.45.0
|
|||
|
||||
error: options `-C embed-bitcode=no` and `-C lto` are incompatible
|
||||
|
||||
--- config/makefiles/rust.mk.orig 2020-05-12 09:36:22 UTC
|
||||
|
||||
diff --git config/makefiles/rust.mk config/makefiles/rust.mk
|
||||
index 75570d3..94ec33f 100644
|
||||
--- config/makefiles/rust.mk
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ created by libcubeb.
|
|||
#include "Tracing.h"
|
||||
#include "webaudio/blink/DenormalDisabler.h"
|
||||
-#include "AudioThreadRegistry.h"
|
||||
#include "mozilla/StaticPrefs_media.h"
|
||||
|
||||
// Use abort() instead of exception in SoundTouch.
|
||||
#define ST_NO_EXCEPTION_HANDLING 1
|
||||
@@ -140,9 +139,7 @@
|
||||
@@ -141,9 +140,7 @@ AudioStream::AudioStream(DataSource& aSource)
|
||||
mTimeStretcher(nullptr),
|
||||
mState(INITIALIZED),
|
||||
mDataSource(aSource),
|
||||
|
|
|
|||
249
www/firefox/files/patch-bug1749604
Normal file
249
www/firefox/files/patch-bug1749604
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
https://bugzilla.mozilla.org/show_bug.cgi?id=1749604
|
||||
https://hg.mozilla.org/mozilla-central/rev/f6031b5927f5
|
||||
https://hg.mozilla.org/mozilla-central/rev/c7440a6eb545
|
||||
https://github.com/mozilla/gecko-dev/commit/e6f459cd77e3
|
||||
(Avoid ~13 GB clone of moz-libwebrtc for libwebrtc regen)
|
||||
(To be dropped for 98)
|
||||
|
||||
Updated README.md to reflect simplified setup for generation.
|
||||
Updated generate-gn-build-files.sh:
|
||||
- remove dependencies on MOZ_LIBWEBRTC environment variable
|
||||
- add checking for GN environment variable
|
||||
---
|
||||
|
||||
diff --git a/dom/media/webrtc/third_party_build/gn-configs/README.md b/dom/media/webrtc/third_party_build/gn-configs/README.md
|
||||
index bc54ba183d016..09dea1ae87833 100644
|
||||
--- dom/media/webrtc/third_party_build/gn-configs/README.md
|
||||
+++ dom/media/webrtc/third_party_build/gn-configs/README.md
|
||||
@@ -1,9 +1,10 @@
|
||||
# Generate new gn json files and moz.build files for building libwebrtc in our tree
|
||||
|
||||
-1. If generating on macOS for Apple Silicon (cross-compiling), make sure to have at least
|
||||
-[Xcode 12.2](https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip).
|
||||
+1. If generating on macOS for Apple Silicon (cross-compiling), make sure to have
|
||||
+ at least [Xcode 12.2](https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip).
|
||||
|
||||
- In addition the aarch64 Rust target will need to be installed via: `rustup target add aarch64-apple-darwin`
|
||||
+ The aarch64 Rust target will need to be installed via:
|
||||
+ `rustup target add aarch64-apple-darwin`
|
||||
|
||||
2. If generating on Windows 10, Visual Studio 2019 is required. Please follow
|
||||
the install instructions from [here](https://firefox-source-docs.mozilla.org/setup/windows_build.html)
|
||||
@@ -14,86 +15,85 @@
|
||||
- MSVC v142 - VS2019 C++ ARM64 build tools
|
||||
|
||||
"Debugging Tools for Windows" is also required.
|
||||
- - Under `Settings -> Apps` search for "Windows Software Development Kit" with the version
|
||||
- number 10.0.19041.685.
|
||||
+ - Under `Settings -> Apps` search for "Windows Software Development Kit" with
|
||||
+ the version number 10.0.19041.685.
|
||||
- select Modify (and allow the installer to modify)
|
||||
- select Change and then click Next
|
||||
- select "Debugging Tools for Windows" and then click Change.
|
||||
|
||||
- And the aarch64 Rust target will need to be installed via: `rustup target add aarch64-pc-windows-msvc`
|
||||
+ The aarch64 Rust target will need to be installed via:
|
||||
+ `rustup target add aarch64-pc-windows-msvc`
|
||||
|
||||
-3. See information in `third_party/libwebrtc/README.mozilla` for the proper revision of libwebrtc
|
||||
+3. See information in `third_party/libwebrtc/README.mozilla` for the proper
|
||||
+ revision of libwebrtc
|
||||
|
||||
libwebrtc updated from commit https://github.com/mozilla/libwebrtc/archive/149d693483e9055f574d9d65b01fe75a186b654b.tar.gz on 2020-11-30T15:48:48.472088.
|
||||
third_party updated from commit https://chromium.googlesource.com/chromium/src/third_party/+archive/5dc5a4a45df9592baa8e8c5f896006d9193d8e45.tar.gz on 2020-11-30T17:00:15.612630.
|
||||
|
||||
- In our current case, the revision is `149d693483e9055f574d9d65b01fe75a186b654b` which
|
||||
- corresponds to:
|
||||
+ In our current case, the revision is `149d693483e9055f574d9d65b01fe75a186b654b`
|
||||
+ which corresponds to:
|
||||
|
||||
mozilla-modifications-rel86
|
||||
|
||||
-4. Clone Mozilla's version of libwebrtc from [libwebrtc](https://github.com/mozilla/libwebrtc)
|
||||
+ This commit was made on `Thu Nov 19 14:14:00 2020`.
|
||||
|
||||
- git clone https://github.com/mozilla/libwebrtc moz-libwebrtc
|
||||
- export MOZ_LIBWEBRTC=`pwd`/moz-libwebrtc
|
||||
- (cd moz-libwebrtc ; git checkout mozilla-modifications-rel86)
|
||||
+4. Download a version of the `gn` executable that corresponds to
|
||||
+ `Thu Nov 19 14:14:00 2020`. In our case, that is version `1889 (8fe02009)`.
|
||||
+
|
||||
+ - [Win](https://chrome-infra-packages.appspot.com/p/gn/gn/windows-amd64/+/e_UmTHedzuu4zJ2gdpW8jrFFNnzIhThljx3jn3RMlVsC)
|
||||
+ - [Linux](https://chrome-infra-packages.appspot.com/p/gn/gn/linux-amd64/+/bvBFKgehaepiKy_YhFnbiOpF38CK26N2OyE1R1jXof0C)
|
||||
+ - [macOS](https://chrome-infra-packages.appspot.com/p/gn/gn/mac-amd64/+/nXvMRpyJhLhisAcnRmU5s9UZqovzMAhKAvWjax-swioC)
|
||||
|
||||
- Note that branch was made on `Thu Nov 19 14:14:00 2020`
|
||||
+ Find the downloaded `.zip` file, unzip and export the location of the
|
||||
+ executable:
|
||||
|
||||
-5. Clone `depot_tools` from [depot_tools](https://chromium.googlesource.com/chromium/tools/depot_tools.git)
|
||||
+ unzip gn-mac-amd64.zip && export GN=`pwd`/gn
|
||||
+ unzip gn-windows-amd64.zip && export GN=`pwd`/gn.exe
|
||||
+ unzip gn-linux-amd64.zip && export GN=`pwd`/gn
|
||||
|
||||
- git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
- export DEPOT_TOOLS=`pwd`/depot_tools
|
||||
+ On platforms that don't have pre-built `gn` executables, `ninja` and `gn` can
|
||||
+ be easily built:
|
||||
|
||||
- If generating files on Windows, the following steps must be completed
|
||||
- from a traditional Windows Cmd prompt (cmd.exe) launched from the start
|
||||
- menu or search bar. This allows `gclient` to properly bootstrap the
|
||||
- required python setup.
|
||||
+ git clone https://github.com/ninja-build/ninja.git
|
||||
+ git clone https://gn.googlesource.com/gn
|
||||
+ (cd gn && git checkout 8fe02009)
|
||||
+ (cd ninja && ./configure.py --bootstrap)
|
||||
+ (export NINJA=`pwd`/ninja/ninja ; cd gn && python build/gen.py && $NINJA -C out)
|
||||
+ export GN=`pwd`/gn/out/gn
|
||||
|
||||
- cd {depot_tools directory}
|
||||
- set PATH=%CD%;%PATH%
|
||||
- set DEPOT_TOOLS_WIN_TOOLCHAIN=0
|
||||
- set vs2019_install="c:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
|
||||
- gclient
|
||||
- exit
|
||||
+ On OpenBSD, a slightly newer version of `gn` is needed in order to build:
|
||||
|
||||
- Now, we need to checkout a revision of `depot_tools` that corresponds to the date of
|
||||
- our libwebrtc branch. The closest `depot_tools` commit to `Thu Nov 19 14:14:00 2020` is
|
||||
- `e7d1862b155ac3ccbef72c4d70629b5c88ffcb32`. There is additional information on how to
|
||||
- more automatically determine this [here](https://chromium.googlesource.com/chromium/src/+/master/docs/building_old_revisions.md).
|
||||
+ (cd gn && git checkout 31f2bba8)
|
||||
|
||||
- (cd depot_tools ; git checkout e7d1862b155ac3ccbef72c4d70629b5c88ffcb32 )
|
||||
+5. Clone `depot_tools` from [depot_tools](https://chromium.googlesource.com/chromium/tools/depot_tools.git)
|
||||
|
||||
-6. It is necessary to let `depot_tools` pull information into the `libwebrtc` tree as well. This can take a while.
|
||||
+ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
+ export DEPOT_TOOLS=`pwd`/depot_tools
|
||||
|
||||
- (cd moz-libwebrtc ; \
|
||||
- export PATH=$DEPOT_TOOLS:$PATH ; \
|
||||
- export DEPOT_TOOLS_UPDATE=0 ; \
|
||||
- export DEPOT_TOOLS_WIN_TOOLCHAIN=0 ; \
|
||||
- gclient config https://github.com/mozilla/libwebrtc && \
|
||||
- gclient sync -D --force --reset --with_branch_heads \
|
||||
- )
|
||||
-
|
||||
- Note that if one uses `gclient` sync with a different output directory `$MOZ_LIBWEBRTC_GIT`
|
||||
- must be set to the original clone directory, and `$MOZ_LIBWEBRTC` needs to be set to the
|
||||
- directory created by `gclient sync`.
|
||||
+ Now, we need to checkout a revision of `depot_tools` that corresponds to the
|
||||
+ date of our libwebrtc branch. The closest `depot_tools` commit to
|
||||
+ `Thu Nov 19 14:14:00 2020` is `e7d1862b155ac3ccbef72c4d70629b5c88ffcb32`.
|
||||
+ There is additional information on how to more automatically determine this
|
||||
+ [here](https://chromium.googlesource.com/chromium/src/+/master/docs/building_old_revisions.md).
|
||||
+
|
||||
+ (cd depot_tools ; git checkout e7d1862b155ac3ccbef72c4d70629b5c88ffcb32 )
|
||||
|
||||
-7. Now it is time to generate the build files. The script should be run from the top
|
||||
-directory of our firefox tree.
|
||||
+6. It is time to generate the build files. The script should be run from the
|
||||
+ top directory of our firefox tree.
|
||||
|
||||
- ./dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh
|
||||
+ bash ./dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh
|
||||
|
||||
- Debugging the generate script itself may prove useful, and one can do this by setting the DEBUG_GEN environment
|
||||
- variable to a non-empty value. This will print everything that the script executes.
|
||||
+ Debugging the generate script itself may prove useful, and one can do this by
|
||||
+ setting the DEBUG_GEN environment variable to a non-empty value. This will
|
||||
+ print everything that the script executes.
|
||||
|
||||
-8. Checkin all the generated/modified files and try your build!
|
||||
+7. Checkin all the generated/modified files and try your build!
|
||||
|
||||
# Adding new configurations to the build
|
||||
|
||||
-- Each new platform/architecture will require 2 new mozconfig files,
|
||||
- one for the debug build and one for the non-debug build. The
|
||||
- filenames follow the same pattern as the generated json files,
|
||||
- `a-b-c-d.mozconfig` where:
|
||||
+- Each new platform/architecture will require 2 new mozconfig files, one for the
|
||||
+ debug build and one for the non-debug build. The filenames follow the same
|
||||
+ pattern as the generated json files, `a-b-c-d.mozconfig` where:
|
||||
- a = generating cpu (example: x64)
|
||||
- b = debug (True / False)
|
||||
- c = target cpu (example: x64 / arm64)
|
||||
@@ -103,9 +103,9 @@ directory of our firefox tree.
|
||||
- The new configs must be added to the appropriate platform section in
|
||||
`generate-gn-build-files.sh`.
|
||||
|
||||
-**Note:** when adding new mozconfig files, especially for linux/android
|
||||
-configs, it is important to include the `ac_add_options
|
||||
---enable-bootstrap`. This ensures switching archtectures for
|
||||
-"cross-compiled" generation works properly. For example, when generating
|
||||
-`x86` or `arm64` linux json files, it would be necessary to install additional
|
||||
-libraries in order for the configure step to complete.
|
||||
+**Note:** when adding new mozconfig files, especially for linux/android configs,
|
||||
+it is important to include the `ac_add_options --enable-bootstrap`. This
|
||||
+ensures switching archtectures for "cross-compiled" generation works properly.
|
||||
+For example, when generating `x86` or `arm64` linux json files, it would be
|
||||
+necessary to install additional libraries in order for the configure step to
|
||||
+complete.
|
||||
diff --git a/dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh b/dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh
|
||||
index 4452b0ce76aeb..8d1acbf783514 100755
|
||||
--- dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh
|
||||
+++ dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh
|
||||
@@ -8,33 +8,15 @@ if [ ! "x$DEBUG_GEN" = "x" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
-if [ "x$MOZ_LIBWEBRTC" = "x" ]; then
|
||||
- echo "MOZ_LIBWEBRTC is not defined, see README.md"
|
||||
+if [ "x$GN" = "x" ]; then
|
||||
+ echo "GN is not defined, see README.md"
|
||||
exit
|
||||
fi
|
||||
|
||||
-if [ -d $MOZ_LIBWEBRTC ]; then
|
||||
- echo "MOZ_LIBWEBRTC is $MOZ_LIBWEBRTC"
|
||||
+if [ -f $GN ]; then
|
||||
+ echo "GN is $GN"
|
||||
else
|
||||
- echo "Path $MOZ_LIBWEBRTC is not found, see README.md"
|
||||
- exit
|
||||
-fi
|
||||
-
|
||||
-# git clone and gclient checkout may be in different places
|
||||
-if [ "x$MOZ_LIBWEBRTC_GIT" = "x" ]; then
|
||||
- MOZ_LIBWEBRTC_GIT=$MOZ_LIBWEBRTC
|
||||
-fi
|
||||
-
|
||||
-if [ ! -d $MOZ_LIBWEBRTC_GIT/.git ]; then
|
||||
- echo "No .git directory is found in the libwebrtc checkout, see README.md"
|
||||
- exit
|
||||
-fi
|
||||
-
|
||||
-if [ ! -d $MOZ_LIBWEBRTC/src/buildtools ]; then
|
||||
- echo "Path $MOZ_LIBWEBRTC/src/buildtools is not found, see README.md"
|
||||
- echo "Please run the following commands from inside $MOZ_LIBWEBRTC:"
|
||||
- echo "\tgclient config https://github.com/mozilla/libwebrtc"
|
||||
- echo "\tgclient sync -D --force --reset --with_branch_heads # this make take a while"
|
||||
+ echo "Path $GN is not found, see README.md"
|
||||
exit
|
||||
fi
|
||||
|
||||
@@ -115,21 +97,6 @@ fi
|
||||
export PATH=$DEPOT_TOOLS:$PATH
|
||||
export DEPOT_TOOLS_UPDATE=0
|
||||
|
||||
-# Symlink in the buildtools and .git directories from our copy of libwebrtc.
|
||||
-if [ -L ./third_party/libwebrtc/buildtools ]; then
|
||||
- rm ./third_party/libwebrtc/buildtools
|
||||
-elif [ -d ./third_party/libwebrtc/buildtools ]; then
|
||||
- rm -rf ./third_party/libwebrtc/buildtools
|
||||
-fi
|
||||
-ln -s $MOZ_LIBWEBRTC/src/buildtools ./third_party/libwebrtc/
|
||||
-
|
||||
-if [ -L ./third_party/libwebrtc/.git ]; then
|
||||
- rm ./third_party/libwebrtc/.git
|
||||
-elif [ -d ./third_party/libwebrtc/.git ]; then
|
||||
- rm -rf ./third_party/libwebrtc/.git
|
||||
-fi
|
||||
-ln -s $MOZ_LIBWEBRTC_GIT/.git ./third_party/libwebrtc/
|
||||
-
|
||||
CONFIG_DIR=dom/media/webrtc/third_party_build/gn-configs
|
||||
echo "CONFIG_DIR is $CONFIG_DIR"
|
||||
|
||||
|
|
@ -28,9 +28,9 @@ diff --git dom/base/moz.build dom/base/moz.build
|
|||
index d390adf..4508f19 100644
|
||||
--- dom/base/moz.build
|
||||
+++ dom/base/moz.build
|
||||
@@ -567,6 +567,9 @@ FINAL_LIBRARY = "xul"
|
||||
if CONFIG["MOZ_X11"]:
|
||||
CXXFLAGS += CONFIG["TK_CFLAGS"]
|
||||
@@ -576,6 +576,9 @@ FINAL_LIBRARY = "xul"
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
||||
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
|
||||
|
||||
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
|
||||
+ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
|
||||
|
|
@ -215,9 +215,9 @@ diff --git old-configure.in old-configure.in
|
|||
index d147957..d332b34 100644
|
||||
--- old-configure.in
|
||||
+++ old-configure.in
|
||||
@@ -2217,6 +2217,27 @@ dnl ========================================================
|
||||
|
||||
AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
|
||||
@@ -1335,6 +1335,27 @@ fi
|
||||
AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
|
||||
AC_SUBST(MOZ_MACBUNDLE_ID)
|
||||
|
||||
+dnl ========================================================
|
||||
+dnl Check for graphite2
|
||||
|
|
@ -241,7 +241,7 @@ index d147957..d332b34 100644
|
|||
+fi
|
||||
+
|
||||
dnl ========================================================
|
||||
dnl Check for pixman and cairo
|
||||
dnl = Child Process Name for IPC
|
||||
dnl ========================================================
|
||||
diff --git toolkit/library/moz.build toolkit/library/moz.build
|
||||
index 2c3f869..e8a9d23 100644
|
||||
|
|
|
|||
192
www/firefox/files/patch-libwebrtc-generate
Normal file
192
www/firefox/files/patch-libwebrtc-generate
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
# Below are the changes needed for generate-gn-build-files.sh
|
||||
# except for depot_tools
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=1654448
|
||||
|
||||
diff --git dom/media/webrtc/third_party_build/gn-configs/arm64_False_arm64_freebsd.mozconfig dom/media/webrtc/third_party_build/gn-configs/arm64_False_arm64_freebsd.mozconfig
|
||||
new file mode 100644
|
||||
index 0000000000..7c76576969
|
||||
--- /dev/null
|
||||
+++ dom/media/webrtc/third_party_build/gn-configs/arm64_False_arm64_freebsd.mozconfig
|
||||
@@ -0,0 +1,12 @@
|
||||
+export M4=/usr/local/bin/gm4
|
||||
+export CC=/usr/local/bin/clang13
|
||||
+export CXX=/usr/local/bin/clang++13
|
||||
+export CPP=/usr/local/bin/clang-cpp13
|
||||
+ac_add_options --prefix="/usr/local"
|
||||
+ac_add_options --with-libclang-path="/usr/local/llvm13/lib"
|
||||
+ac_add_options --with-wasi-sysroot="/usr/local/share/wasi-sysroot"
|
||||
+
|
||||
+ac_add_options --target=aarch64
|
||||
+ac_add_options --enable-bootstrap
|
||||
+
|
||||
+mk_add_options MOZ_OBJDIR=obj-arm64_False_arm64_freebsd
|
||||
diff --git dom/media/webrtc/third_party_build/gn-configs/arm64_True_arm64_freebsd.mozconfig dom/media/webrtc/third_party_build/gn-configs/arm64_True_arm64_freebsd.mozconfig
|
||||
new file mode 100644
|
||||
index 0000000000..d056686355
|
||||
--- /dev/null
|
||||
+++ dom/media/webrtc/third_party_build/gn-configs/arm64_True_arm64_freebsd.mozconfig
|
||||
@@ -0,0 +1,13 @@
|
||||
+export M4=/usr/local/bin/gm4
|
||||
+export CC=/usr/local/bin/clang13
|
||||
+export CXX=/usr/local/bin/clang++13
|
||||
+export CPP=/usr/local/bin/clang-cpp13
|
||||
+ac_add_options --prefix="/usr/local"
|
||||
+ac_add_options --with-libclang-path="/usr/local/llvm13/lib"
|
||||
+ac_add_options --with-wasi-sysroot="/usr/local/share/wasi-sysroot"
|
||||
+
|
||||
+ac_add_options --target=aarch64
|
||||
+ac_add_options --enable-debug
|
||||
+ac_add_options --enable-bootstrap
|
||||
+
|
||||
+mk_add_options MOZ_OBJDIR=obj-arm64_True_arm64_freebsd
|
||||
diff --git dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh
|
||||
index 4452b0ce76..34a8ddf28e 100755
|
||||
--- dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh
|
||||
+++ dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh
|
||||
@@ -57,17 +57,6 @@ set -eEuo pipefail
|
||||
|
||||
SYS_NAME=`uname`
|
||||
|
||||
-# Check for modified files and abort if present.
|
||||
-MODIFIED_FILES=`hg status --modified --added --exclude "**/moz.build" --exclude "dom/media/webrtc/third_party_build/**.json"`
|
||||
-if [ "x$MODIFIED_FILES" = "x" ]; then
|
||||
- # Completely clean the mercurial checkout before proceeding
|
||||
- hg update -C -r .
|
||||
- hg purge
|
||||
-else
|
||||
- echo "There are modified files in the checkout. Cowardly aborting!"
|
||||
- echo "$MODIFIED_FILES"
|
||||
- exit 1
|
||||
-fi
|
||||
|
||||
IS_WIN=0
|
||||
IS_DARWIN=0
|
||||
@@ -94,6 +83,10 @@ elif [ "x$SYS_NAME" = "xMINGW32_NT-6.2" ]; then
|
||||
IS_WIN=1
|
||||
elif [ "x$SYS_NAME" = "xOpenBSD" ]; then
|
||||
CONFIGS="x64_False_x64_openbsd x64_True_x64_openbsd"
|
||||
+elif [ "x$SYS_NAME" = "xFreeBSD" ]; then
|
||||
+ CONFIGS="x64_False_x64_freebsd x64_True_x64_freebsd"
|
||||
+ CONFIGS="$CONFIGS x64_False_x86_freebsd x64_True_x86_freebsd"
|
||||
+ #CONFIGS="arm64_False_arm64_freebsd arm64_True_arm64_freebsd"
|
||||
else
|
||||
# Ensure rust has the correct targets for building x86 and arm64. These
|
||||
# operations succeed quickly if previously completed.
|
||||
diff --git dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_freebsd.mozconfig dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_freebsd.mozconfig
|
||||
new file mode 100644
|
||||
index 0000000000..37319939ba
|
||||
--- /dev/null
|
||||
+++ dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_freebsd.mozconfig
|
||||
@@ -0,0 +1,11 @@
|
||||
+export M4=/usr/local/bin/gm4
|
||||
+export CC=/usr/local/bin/clang13
|
||||
+export CXX=/usr/local/bin/clang++13
|
||||
+export CPP=/usr/local/bin/clang-cpp13
|
||||
+ac_add_options --prefix="/usr/local"
|
||||
+ac_add_options --with-libclang-path="/usr/local/llvm13/lib"
|
||||
+ac_add_options --with-wasi-sysroot="/usr/local/share/wasi-sysroot"
|
||||
+
|
||||
+ac_add_options --enable-bootstrap
|
||||
+
|
||||
+mk_add_options MOZ_OBJDIR=obj-x64_False_x64_freebsd
|
||||
diff --git dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_freebsd.mozconfig dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_freebsd.mozconfig
|
||||
new file mode 100644
|
||||
index 0000000000..4bcac5d797
|
||||
--- /dev/null
|
||||
+++ dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_freebsd.mozconfig
|
||||
@@ -0,0 +1,12 @@
|
||||
+export M4=/usr/local/bin/gm4
|
||||
+export CC=/usr/local/bin/clang13
|
||||
+export CXX=/usr/local/bin/clang++13
|
||||
+export CPP=/usr/local/bin/clang-cpp13
|
||||
+ac_add_options --prefix="/usr/local"
|
||||
+ac_add_options --with-libclang-path="/usr/local/llvm13/lib"
|
||||
+ac_add_options --with-wasi-sysroot="/usr/local/share/wasi-sysroot"
|
||||
+
|
||||
+ac_add_options --target=i686
|
||||
+ac_add_options --enable-bootstrap
|
||||
+
|
||||
+mk_add_options MOZ_OBJDIR=obj-x64_False_x86_freebsd
|
||||
diff --git dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_freebsd.mozconfig dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_freebsd.mozconfig
|
||||
new file mode 100644
|
||||
index 0000000000..7c5ae25d67
|
||||
--- /dev/null
|
||||
+++ dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_freebsd.mozconfig
|
||||
@@ -0,0 +1,12 @@
|
||||
+export M4=/usr/local/bin/gm4
|
||||
+export CC=/usr/local/bin/clang13
|
||||
+export CXX=/usr/local/bin/clang++13
|
||||
+export CPP=/usr/local/bin/clang-cpp13
|
||||
+ac_add_options --prefix="/usr/local"
|
||||
+ac_add_options --with-libclang-path="/usr/local/llvm13/lib"
|
||||
+ac_add_options --with-wasi-sysroot="/usr/local/share/wasi-sysroot"
|
||||
+
|
||||
+ac_add_options --enable-debug
|
||||
+ac_add_options --enable-bootstrap
|
||||
+
|
||||
+mk_add_options MOZ_OBJDIR=obj-x64_True_x64_freebsd
|
||||
diff --git dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_freebsd.mozconfig dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_freebsd.mozconfig
|
||||
new file mode 100644
|
||||
index 0000000000..ee95c64a23
|
||||
--- /dev/null
|
||||
+++ dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_freebsd.mozconfig
|
||||
@@ -0,0 +1,13 @@
|
||||
+export M4=/usr/local/bin/gm4
|
||||
+export CC=/usr/local/bin/clang13
|
||||
+export CXX=/usr/local/bin/clang++13
|
||||
+export CPP=/usr/local/bin/clang-cpp13
|
||||
+ac_add_options --prefix="/usr/local"
|
||||
+ac_add_options --with-libclang-path="/usr/local/llvm13/lib"
|
||||
+ac_add_options --with-wasi-sysroot="/usr/local/share/wasi-sysroot"
|
||||
+
|
||||
+ac_add_options --target=i686
|
||||
+ac_add_options --enable-debug
|
||||
+ac_add_options --enable-bootstrap
|
||||
+
|
||||
+mk_add_options MOZ_OBJDIR=obj-x64_True_x86_freebsd
|
||||
diff --git third_party/libwebrtc/build/config/BUILDCONFIG.gn third_party/libwebrtc/build/config/BUILDCONFIG.gn
|
||||
index fe6f5b7d2a..1092f99c65 100644
|
||||
--- third_party/libwebrtc/build/config/BUILDCONFIG.gn
|
||||
+++ third_party/libwebrtc/build/config/BUILDCONFIG.gn
|
||||
@@ -131,10 +131,12 @@ declare_args() {
|
||||
is_official_build = false
|
||||
|
||||
# Whether we're a traditional desktop unix.
|
||||
- is_desktop_linux = current_os == "linux" || current_os == "openbsd"
|
||||
+ is_desktop_linux = current_os == "linux" || current_os == "openbsd" ||
|
||||
+ current_os == "freebsd"
|
||||
|
||||
# Set to true when compiling with the Clang compiler.
|
||||
is_clang = current_os != "linux" || current_os == "openbsd" ||
|
||||
+ current_os == "freebsd" ||
|
||||
(current_cpu != "s390x" && current_cpu != "s390" &&
|
||||
current_cpu != "ppc64" && current_cpu != "ppc" &&
|
||||
current_cpu != "mips" && current_cpu != "mips64")
|
||||
@@ -186,7 +188,7 @@ if (host_toolchain == "") {
|
||||
# TODO(dpranke): Add some sort of assert here that verifies that
|
||||
# no toolchain omitted host_toolchain from its toolchain_args().
|
||||
|
||||
- if (host_os == "linux" || host_os == "openbsd") {
|
||||
+ if (host_os == "linux" || host_os == "openbsd" || host_os == "freebsd" ) {
|
||||
if (target_os != "linux") {
|
||||
host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
|
||||
} else if (is_clang) {
|
||||
@@ -224,7 +226,8 @@ if (target_os == "android") {
|
||||
assert(host_os == "linux" || host_os == "mac",
|
||||
"Android builds are only supported on Linux and Mac hosts.")
|
||||
_default_toolchain = "//build/toolchain/android:android_clang_$target_cpu"
|
||||
-} else if (target_os == "chromeos" || target_os == "linux" || target_os == "openbsd") {
|
||||
+} else if (target_os == "chromeos" || target_os == "linux" ||
|
||||
+ target_os == "openbsd" || target_os == "freebsd") {
|
||||
# See comments in build/toolchain/cros/BUILD.gn about board compiles.
|
||||
if (is_clang) {
|
||||
_default_toolchain = "//build/toolchain/linux:clang_$target_cpu"
|
||||
@@ -289,7 +292,7 @@ is_chromeos = current_os == "chromeos"
|
||||
is_fuchsia = current_os == "fuchsia"
|
||||
is_ios = current_os == "ios"
|
||||
is_linux = current_os == "chromeos" || current_os == "linux"
|
||||
-is_bsd = current_os == "openbsd"
|
||||
+is_bsd = current_os == "openbsd" || current_os == "freebsd"
|
||||
is_mac = current_os == "mac"
|
||||
is_nacl = current_os == "nacl"
|
||||
is_win = current_os == "win" || current_os == "winuwp"
|
||||
19756
www/firefox/files/patch-libwebrtc-generated
Normal file
19756
www/firefox/files/patch-libwebrtc-generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,378 +1,63 @@
|
|||
--- media/libcubeb/src/cubeb_oss.c.orig 2021-12-18 20:36:16 UTC
|
||||
+++ media/libcubeb/src/cubeb_oss.c
|
||||
@@ -96,6 +96,8 @@ struct oss_stream {
|
||||
oss_devnode_t name;
|
||||
@@ -97,6 +97,7 @@ struct oss_stream {
|
||||
int fd;
|
||||
void * buf;
|
||||
+ unsigned int bufframes;
|
||||
unsigned int bufframes;
|
||||
+ unsigned int maxframes;
|
||||
|
||||
struct stream_info {
|
||||
int channels;
|
||||
@@ -126,9 +128,6 @@ struct cubeb_stream {
|
||||
cubeb_data_callback data_cb;
|
||||
cubeb_state_callback state_cb;
|
||||
uint64_t frames_written /* (m) */;
|
||||
- unsigned int nfr; /* Number of frames allocated */
|
||||
- unsigned int nfrags;
|
||||
- unsigned int bufframes;
|
||||
};
|
||||
|
||||
static char const *
|
||||
@@ -786,40 +785,72 @@ oss_put_play_frames(cubeb_stream * s, unsigned int nfr
|
||||
}
|
||||
|
||||
static int
|
||||
-oss_wait_playfd_for_space(cubeb_stream * s)
|
||||
+oss_wait_fds_for_space(cubeb_stream * s, long * nfrp)
|
||||
{
|
||||
- struct pollfd pfd;
|
||||
+ audio_buf_info bi;
|
||||
+ struct pollfd pfds[2];
|
||||
+ long nfr, tnfr;
|
||||
+ int i;
|
||||
|
||||
- pfd.events = POLLOUT | POLLHUP;
|
||||
- pfd.revents = 0;
|
||||
- pfd.fd = s->play.fd;
|
||||
+ assert(s->play.fd != -1 || s->record.fd != -1);
|
||||
+ pfds[0].events = POLLOUT | POLLHUP;
|
||||
+ pfds[0].revents = 0;
|
||||
+ pfds[0].fd = s->play.fd;
|
||||
+ pfds[1].events = POLLIN | POLLHUP;
|
||||
+ pfds[1].revents = 0;
|
||||
+ pfds[1].fd = s->record.fd;
|
||||
|
||||
- if (poll(&pfd, 1, 2000) == -1) {
|
||||
- return CUBEB_ERROR;
|
||||
- }
|
||||
+retry:
|
||||
+ nfr = LONG_MAX;
|
||||
|
||||
- if (pfd.revents & POLLHUP) {
|
||||
+ if (poll(pfds, 2, 1000) == -1) {
|
||||
return CUBEB_ERROR;
|
||||
}
|
||||
- return 0;
|
||||
-}
|
||||
|
||||
-static int
|
||||
-oss_wait_recfd_for_space(cubeb_stream * s)
|
||||
-{
|
||||
- struct pollfd pfd;
|
||||
-
|
||||
- pfd.events = POLLIN | POLLHUP;
|
||||
- pfd.revents = 0;
|
||||
- pfd.fd = s->record.fd;
|
||||
-
|
||||
- if (poll(&pfd, 1, 2000) == -1) {
|
||||
- return CUBEB_ERROR;
|
||||
+ for (i = 0; i < 2; i++) {
|
||||
+ if (pfds[i].revents & POLLHUP) {
|
||||
+ return CUBEB_ERROR;
|
||||
+ }
|
||||
}
|
||||
|
||||
- if (pfd.revents & POLLHUP) {
|
||||
- return CUBEB_ERROR;
|
||||
+ if (s->play.fd != -1) {
|
||||
+ if (ioctl(s->play.fd, SNDCTL_DSP_GETOSPACE, &bi) == -1) {
|
||||
+ return CUBEB_STATE_ERROR;
|
||||
+ }
|
||||
+ tnfr = bi.bytes / s->play.frame_size;
|
||||
+ if (tnfr <= 0) {
|
||||
+ /* too little space - stop polling record, if any */
|
||||
+ pfds[0].fd = s->play.fd;
|
||||
+ pfds[1].fd = -1;
|
||||
+ goto retry;
|
||||
@@ -822,9 +823,9 @@ retry:
|
||||
pfds[0].fd = s->play.fd;
|
||||
pfds[1].fd = -1;
|
||||
goto retry;
|
||||
- } else if (tnfr > (long)s->play.bufframes) {
|
||||
+ } else if (tnfr > (long)s->play.maxframes) {
|
||||
+ /* too many frames available - limit */
|
||||
/* too many frames available - limit */
|
||||
- tnfr = (long)s->play.bufframes;
|
||||
+ tnfr = (long)s->play.maxframes;
|
||||
+ }
|
||||
+ if (nfr > tnfr) {
|
||||
+ nfr = tnfr;
|
||||
+ }
|
||||
}
|
||||
+ if (s->record.fd != -1) {
|
||||
+ if (ioctl(s->record.fd, SNDCTL_DSP_GETISPACE, &bi) == -1) {
|
||||
+ return CUBEB_STATE_ERROR;
|
||||
+ }
|
||||
+ tnfr = bi.bytes / s->record.frame_size;
|
||||
+ if (tnfr <= 0) {
|
||||
+ /* too little space - stop polling playback, if any */
|
||||
+ pfds[0].fd = -1;
|
||||
+ pfds[1].fd = s->record.fd;
|
||||
+ goto retry;
|
||||
}
|
||||
if (nfr > tnfr) {
|
||||
nfr = tnfr;
|
||||
@@ -840,9 +841,9 @@ retry:
|
||||
pfds[0].fd = -1;
|
||||
pfds[1].fd = s->record.fd;
|
||||
goto retry;
|
||||
- } else if (tnfr > (long)s->record.bufframes) {
|
||||
+ } else if (tnfr > (long)s->record.maxframes) {
|
||||
+ /* too many frames available - limit */
|
||||
/* too many frames available - limit */
|
||||
- tnfr = (long)s->record.bufframes;
|
||||
+ tnfr = (long)s->record.maxframes;
|
||||
+ }
|
||||
+ if (nfr > tnfr) {
|
||||
+ nfr = tnfr;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ *nfrp = nfr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -840,7 +871,7 @@ oss_audio_loop(cubeb_stream * s, cubeb_state * new_sta
|
||||
}
|
||||
|
||||
trig |= PCM_ENABLE_INPUT;
|
||||
- memset(s->record.buf, 0, s->bufframes * s->record.frame_size);
|
||||
+ memset(s->record.buf, 0, s->record.bufframes * s->record.frame_size);
|
||||
|
||||
if (ioctl(s->record.fd, SNDCTL_DSP_SETTRIGGER, &trig) == -1) {
|
||||
LOG("Error %d occured when setting trigger on record fd", errno);
|
||||
@@ -877,6 +908,7 @@ oss_audio_loop(cubeb_stream * s, cubeb_state * new_sta
|
||||
oss_linear32_to_float(s->record.buf, s->record.info.channels * nfr);
|
||||
}
|
||||
}
|
||||
+
|
||||
got = s->data_cb(s, s->user_ptr, s->record.buf, s->play.buf, nfr);
|
||||
if (got == CUBEB_ERROR) {
|
||||
state = CUBEB_STATE_ERROR;
|
||||
@@ -920,45 +952,10 @@ oss_audio_loop(cubeb_stream * s, cubeb_state * new_sta
|
||||
}
|
||||
}
|
||||
|
||||
- nfr = s->bufframes;
|
||||
-
|
||||
- if (record_on) {
|
||||
- long mfr;
|
||||
-
|
||||
- if (oss_wait_recfd_for_space(s) != 0) {
|
||||
- state = CUBEB_STATE_ERROR;
|
||||
- goto breakdown;
|
||||
- }
|
||||
-
|
||||
- audio_buf_info bi;
|
||||
- if (ioctl(s->record.fd, SNDCTL_DSP_GETISPACE, &bi) == -1) {
|
||||
- state = CUBEB_STATE_ERROR;
|
||||
- goto breakdown;
|
||||
- }
|
||||
-
|
||||
- mfr = (bi.fragsize * bi.fragments) / s->record.frame_size;
|
||||
- if (nfr > mfr)
|
||||
- nfr = mfr;
|
||||
+ if (oss_wait_fds_for_space(s, &nfr) != 0) {
|
||||
+ state = CUBEB_STATE_ERROR;
|
||||
+ goto breakdown;
|
||||
}
|
||||
-
|
||||
- if (play_on) {
|
||||
- long mfr;
|
||||
-
|
||||
- if (oss_wait_playfd_for_space(s) != 0) {
|
||||
- state = CUBEB_STATE_ERROR;
|
||||
- goto breakdown;
|
||||
- }
|
||||
-
|
||||
- audio_buf_info bi;
|
||||
- if (ioctl(s->play.fd, SNDCTL_DSP_GETOSPACE, &bi) == -1) {
|
||||
- state = CUBEB_STATE_ERROR;
|
||||
- goto breakdown;
|
||||
- }
|
||||
-
|
||||
- mfr = (bi.fragsize * bi.fragments) / s->play.frame_size;
|
||||
- if (nfr > mfr)
|
||||
- nfr = mfr;
|
||||
- }
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -1015,9 +1012,10 @@ static inline int
|
||||
oss_calc_frag_shift(unsigned int frames, unsigned int frame_size)
|
||||
{
|
||||
int n = 4;
|
||||
- int blksize = (frames * frame_size + OSS_NFRAGS - 1) / OSS_NFRAGS;
|
||||
- while ((1 << n) < blksize)
|
||||
+ int blksize = frames * frame_size;
|
||||
+ while ((1 << n) < blksize) {
|
||||
n++;
|
||||
+ }
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -1037,7 +1035,6 @@ oss_stream_init(cubeb * context, cubeb_stream ** strea
|
||||
cubeb_state_callback state_callback, void * user_ptr)
|
||||
{
|
||||
int ret = CUBEB_OK;
|
||||
- unsigned int playnfr = 0, recnfr = 0;
|
||||
cubeb_stream * s = NULL;
|
||||
const char * defdsp;
|
||||
|
||||
@@ -1051,7 +1048,6 @@ oss_stream_init(cubeb * context, cubeb_stream ** strea
|
||||
}
|
||||
s->state = CUBEB_STATE_STOPPED;
|
||||
s->record.fd = s->play.fd = -1;
|
||||
- s->nfr = latency_frames;
|
||||
if (input_device != NULL) {
|
||||
strlcpy(s->record.name, input_device, sizeof(s->record.name));
|
||||
} else {
|
||||
@@ -1064,6 +1060,8 @@ oss_stream_init(cubeb * context, cubeb_stream ** strea
|
||||
}
|
||||
if (input_stream_params != NULL) {
|
||||
unsigned int nb_channels;
|
||||
+ uint32_t minframes;
|
||||
+
|
||||
if (input_stream_params->prefs & CUBEB_STREAM_PREF_LOOPBACK) {
|
||||
LOG("Loopback not supported");
|
||||
ret = CUBEB_ERROR_NOT_SUPPORTED;
|
||||
@@ -1077,13 +1075,11 @@ oss_stream_init(cubeb * context, cubeb_stream ** strea
|
||||
ret = CUBEB_ERROR_INVALID_PARAMETER;
|
||||
goto error;
|
||||
}
|
||||
- if (s->record.fd == -1) {
|
||||
- if ((s->record.fd = open(s->record.name, O_RDONLY)) == -1) {
|
||||
- LOG("Audio device \"%s\" could not be opened as read-only",
|
||||
- s->record.name);
|
||||
- ret = CUBEB_ERROR_DEVICE_UNAVAILABLE;
|
||||
- goto error;
|
||||
- }
|
||||
+ if ((s->record.fd = open(s->record.name, O_RDONLY)) == -1) {
|
||||
+ LOG("Audio device \"%s\" could not be opened as read-only",
|
||||
+ s->record.name);
|
||||
+ ret = CUBEB_ERROR_DEVICE_UNAVAILABLE;
|
||||
+ goto error;
|
||||
}
|
||||
if ((ret = oss_copy_params(s->record.fd, s, input_stream_params,
|
||||
&s->record.info)) != CUBEB_OK) {
|
||||
@@ -1094,11 +1090,17 @@ oss_stream_init(cubeb * context, cubeb_stream ** strea
|
||||
(input_stream_params->format == CUBEB_SAMPLE_FLOAT32NE);
|
||||
s->record.frame_size =
|
||||
s->record.info.channels * (s->record.info.precision / 8);
|
||||
- recnfr = (1 << oss_calc_frag_shift(s->nfr, s->record.frame_size)) /
|
||||
- s->record.frame_size;
|
||||
+ s->record.bufframes = latency_frames;
|
||||
+
|
||||
+ oss_get_min_latency(context, *input_stream_params, &minframes);
|
||||
+ if (s->record.bufframes < minframes) {
|
||||
+ s->record.bufframes = minframes;
|
||||
+ }
|
||||
}
|
||||
if (output_stream_params != NULL) {
|
||||
unsigned int nb_channels;
|
||||
+ uint32_t minframes;
|
||||
+
|
||||
if (output_stream_params->prefs & CUBEB_STREAM_PREF_LOOPBACK) {
|
||||
LOG("Loopback not supported");
|
||||
ret = CUBEB_ERROR_NOT_SUPPORTED;
|
||||
@@ -1113,13 +1115,11 @@ oss_stream_init(cubeb * context, cubeb_stream ** strea
|
||||
ret = CUBEB_ERROR_INVALID_PARAMETER;
|
||||
goto error;
|
||||
}
|
||||
- if (s->play.fd == -1) {
|
||||
- if ((s->play.fd = open(s->play.name, O_WRONLY)) == -1) {
|
||||
- LOG("Audio device \"%s\" could not be opened as write-only",
|
||||
- s->play.name);
|
||||
- ret = CUBEB_ERROR_DEVICE_UNAVAILABLE;
|
||||
- goto error;
|
||||
- }
|
||||
+ if ((s->play.fd = open(s->play.name, O_WRONLY)) == -1) {
|
||||
+ LOG("Audio device \"%s\" could not be opened as write-only",
|
||||
+ s->play.name);
|
||||
+ ret = CUBEB_ERROR_DEVICE_UNAVAILABLE;
|
||||
+ goto error;
|
||||
}
|
||||
if ((ret = oss_copy_params(s->play.fd, s, output_stream_params,
|
||||
&s->play.info)) != CUBEB_OK) {
|
||||
@@ -1128,19 +1128,16 @@ oss_stream_init(cubeb * context, cubeb_stream ** strea
|
||||
}
|
||||
s->play.floating = (output_stream_params->format == CUBEB_SAMPLE_FLOAT32NE);
|
||||
s->play.frame_size = s->play.info.channels * (s->play.info.precision / 8);
|
||||
- playnfr = (1 << oss_calc_frag_shift(s->nfr, s->play.frame_size)) /
|
||||
- s->play.frame_size;
|
||||
+ s->play.bufframes = latency_frames;
|
||||
+
|
||||
+ oss_get_min_latency(context, *output_stream_params, &minframes);
|
||||
+ if (s->play.bufframes < minframes) {
|
||||
+ s->play.bufframes = minframes;
|
||||
+ }
|
||||
}
|
||||
- /*
|
||||
- * Use the largest nframes among playing and recording streams to set OSS
|
||||
- * buffer size. After that, use the smallest allocated nframes among both
|
||||
- * direction to allocate our temporary buffers.
|
||||
- */
|
||||
- s->nfr = (playnfr > recnfr) ? playnfr : recnfr;
|
||||
- s->nfrags = OSS_NFRAGS;
|
||||
if (s->play.fd != -1) {
|
||||
- int frag =
|
||||
- oss_get_frag_params(oss_calc_frag_shift(s->nfr, s->play.frame_size));
|
||||
+ int frag = oss_get_frag_params(
|
||||
+ oss_calc_frag_shift(s->play.bufframes, s->play.frame_size));
|
||||
if (ioctl(s->play.fd, SNDCTL_DSP_SETFRAGMENT, &frag))
|
||||
LOG("Failed to set play fd with SNDCTL_DSP_SETFRAGMENT. frag: 0x%x",
|
||||
frag);
|
||||
@@ -1148,13 +1145,28 @@ oss_stream_init(cubeb * context, cubeb_stream ** strea
|
||||
if (ioctl(s->play.fd, SNDCTL_DSP_GETOSPACE, &bi))
|
||||
LOG("Failed to get play fd's buffer info.");
|
||||
if (nfr > tnfr) {
|
||||
nfr = tnfr;
|
||||
@@ -1146,8 +1147,19 @@ oss_stream_init(cubeb * context, cubeb_stream ** stream,
|
||||
else {
|
||||
- if (bi.fragsize / s->play.frame_size < s->nfr)
|
||||
- s->nfr = bi.fragsize / s->play.frame_size;
|
||||
+ s->play.bufframes = (bi.fragsize * bi.fragstotal) / s->play.frame_size;
|
||||
s->play.bufframes = (bi.fragsize * bi.fragstotal) / s->play.frame_size;
|
||||
}
|
||||
+ int lw;
|
||||
+
|
||||
|
||||
- int lw = s->play.frame_size;
|
||||
+ /*
|
||||
+ * Force 32 ms service intervals at most, or when recording is
|
||||
+ * active, use the recording service intervals as a reference.
|
||||
+ */
|
||||
+ s->play.maxframes = (32 * output_stream_params->rate) / 1000;
|
||||
+ if (s->record.fd != -1 || s->play.maxframes >= s->play.bufframes) {
|
||||
+ lw = s->play.frame_size; /* Feed data when possible. */
|
||||
+ lw = s->play.frame_size; /* Feed data when possible. */
|
||||
+ s->play.maxframes = s->play.bufframes;
|
||||
+ } else {
|
||||
+ lw = (s->play.bufframes - s->play.maxframes) * s->play.frame_size;
|
||||
+ }
|
||||
+ if (ioctl(s->play.fd, SNDCTL_DSP_LOW_WATER, &lw))
|
||||
+ LOG("Audio device \"%s\" (play) could not set trigger threshold",
|
||||
+ s->play.name);
|
||||
}
|
||||
if (s->record.fd != -1) {
|
||||
- int frag =
|
||||
- oss_get_frag_params(oss_calc_frag_shift(s->nfr, s->record.frame_size));
|
||||
+ int frag = oss_get_frag_params(
|
||||
+ oss_calc_frag_shift(s->record.bufframes, s->record.frame_size));
|
||||
if (ioctl(s->record.fd, SNDCTL_DSP_SETFRAGMENT, &frag))
|
||||
LOG("Failed to set record fd with SNDCTL_DSP_SETFRAGMENT. frag: 0x%x",
|
||||
frag);
|
||||
@@ -1162,11 +1174,16 @@ oss_stream_init(cubeb * context, cubeb_stream ** strea
|
||||
if (ioctl(s->record.fd, SNDCTL_DSP_GETISPACE, &bi))
|
||||
LOG("Failed to get record fd's buffer info.");
|
||||
else {
|
||||
- if (bi.fragsize / s->record.frame_size < s->nfr)
|
||||
- s->nfr = bi.fragsize / s->record.frame_size;
|
||||
+ s->record.bufframes =
|
||||
+ (bi.fragsize * bi.fragstotal) / s->record.frame_size;
|
||||
if (ioctl(s->play.fd, SNDCTL_DSP_LOW_WATER, &lw))
|
||||
LOG("Audio device \"%s\" (play) could not set trigger threshold",
|
||||
s->play.name);
|
||||
@@ -1166,6 +1178,7 @@ oss_stream_init(cubeb * context, cubeb_stream ** stream,
|
||||
(bi.fragsize * bi.fragstotal) / s->record.frame_size;
|
||||
}
|
||||
+
|
||||
+ s->record.maxframes = s->record.bufframes;
|
||||
+ int lw = s->record.frame_size;
|
||||
+ if (ioctl(s->record.fd, SNDCTL_DSP_LOW_WATER, &lw))
|
||||
+ LOG("Audio device \"%s\" (record) could not set trigger threshold",
|
||||
+ s->record.name);
|
||||
}
|
||||
- s->bufframes = s->nfr * s->nfrags;
|
||||
s->context = context;
|
||||
s->volume = 1.0;
|
||||
s->state_cb = state_callback;
|
||||
@@ -1188,13 +1205,14 @@ oss_stream_init(cubeb * context, cubeb_stream ** strea
|
||||
s->doorbell = false;
|
||||
|
||||
if (s->play.fd != -1) {
|
||||
- if ((s->play.buf = calloc(s->bufframes, s->play.frame_size)) == NULL) {
|
||||
+ if ((s->play.buf = calloc(s->play.bufframes, s->play.frame_size)) == NULL) {
|
||||
ret = CUBEB_ERROR;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
if (s->record.fd != -1) {
|
||||
- if ((s->record.buf = calloc(s->bufframes, s->record.frame_size)) == NULL) {
|
||||
+ if ((s->record.buf = calloc(s->record.bufframes, s->record.frame_size)) ==
|
||||
+ NULL) {
|
||||
ret = CUBEB_ERROR;
|
||||
goto error;
|
||||
}
|
||||
+ s->record.maxframes = s->record.bufframes;
|
||||
int lw = s->record.frame_size;
|
||||
if (ioctl(s->record.fd, SNDCTL_DSP_LOW_WATER, &lw))
|
||||
LOG("Audio device \"%s\" (record) could not set trigger threshold",
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue