Commit graph

94 commits

Author SHA1 Message Date
OpenSauce04
d504c22284 Added USE_STATIC_MSVC_RUNTIME cmake option
Some checks are pending
Build / build (macos-13, Debug) (push) Waiting to run
Build / build (macos-13, Release) (push) Waiting to run
Build / build (macos-14, Debug) (push) Waiting to run
Build / build (macos-14, Release) (push) Waiting to run
Build / build (ubuntu-20.04, Debug) (push) Waiting to run
Build / build (ubuntu-20.04, Release) (push) Waiting to run
Build / build (windows-2019, Debug) (push) Waiting to run
Build / build (windows-2019, Release) (push) Waiting to run
Build / build-android (arm64-v8a, Debug) (push) Waiting to run
Build / build-android (arm64-v8a, Release) (push) Waiting to run
Build / build-android (armeabi-v7a, Debug) (push) Waiting to run
Build / build-android (armeabi-v7a, Release) (push) Waiting to run
Build / build-android (x86_64, Debug) (push) Waiting to run
Build / build-android (x86_64, Release) (push) Waiting to run
Build / check_format (push) Waiting to run
2024-11-20 16:54:43 +01:00
Miriam Zimmerman
0426c8532a Update rust submodules.
Some checks are pending
Build / build (macos-13, Debug) (push) Waiting to run
Build / build (macos-13, Release) (push) Waiting to run
Build / build (macos-14, Debug) (push) Waiting to run
Build / build (macos-14, Release) (push) Waiting to run
Build / build (ubuntu-20.04, Debug) (push) Waiting to run
Build / build (ubuntu-20.04, Release) (push) Waiting to run
Build / build (windows-2019, Debug) (push) Waiting to run
Build / build (windows-2019, Release) (push) Waiting to run
Build / build-android (arm64-v8a, Debug) (push) Waiting to run
Build / build-android (arm64-v8a, Release) (push) Waiting to run
Build / build-android (armeabi-v7a, Debug) (push) Waiting to run
Build / build-android (armeabi-v7a, Release) (push) Waiting to run
Build / build-android (x86_64, Debug) (push) Waiting to run
Build / build-android (x86_64, Release) (push) Waiting to run
Build / check_format (push) Waiting to run
Also, use gecko-in-tree feature to break circular dependency.
2024-11-20 12:15:56 +13:00
Miriam Zimmerman
877364f050
windows: Set debug options if appropriate. (#798)
Some checks failed
Build / build (macos-13, Debug) (push) Has been cancelled
Build / build (macos-13, Release) (push) Has been cancelled
Build / build (macos-14, Debug) (push) Has been cancelled
Build / build (macos-14, Release) (push) Has been cancelled
Build / build (ubuntu-20.04, Debug) (push) Has been cancelled
Build / build (ubuntu-20.04, Release) (push) Has been cancelled
Build / build (windows-2019, Debug) (push) Has been cancelled
Build / build (windows-2019, Release) (push) Has been cancelled
Build / build-android (arm64-v8a, Debug) (push) Has been cancelled
Build / build-android (arm64-v8a, Release) (push) Has been cancelled
Build / build-android (armeabi-v7a, Debug) (push) Has been cancelled
Build / build-android (armeabi-v7a, Release) (push) Has been cancelled
Build / build-android (x86_64, Debug) (push) Has been cancelled
Build / build-android (x86_64, Release) (push) Has been cancelled
Build / check_format (push) Has been cancelled
* windows: Set debug options if appropriate.

If building with debug, also build standard libraries with debug. This
ensures that any libraries linking against cubeb won't have mismatched
symbol definitions.

* Properly allow dynamic linking.

* Set global CMAKE_MSVC_RUNTIME_LIBRARY.

This variable will apply to all targets, rather than needing to apply a
per-target setting.

* remove unnecessary whitespace

* Simplify variable expression
2024-09-17 11:56:53 +12:00
Paul Adenot
6c1a6e151c Revert "Fetch avrt.dll functions dynamically again."
This reverts commit aaffe75c25.
2024-05-21 18:11:12 +02:00
Paul Adenot
a6752d6ffe Add internal utility to log audio streams to disk from real-time audio callbacks 2024-04-16 16:31:18 +02:00
Paul Adenot
aaffe75c25 Fetch avrt.dll functions dynamically again.
Turns out this can crash sometimes, and we need to be more careful.

This reverts commit 661c653c86.
2024-03-19 16:22:27 +01:00
Paul Adenot
625213fd9f Non-functional change: Check tests when checking format 2023-11-10 15:31:57 +01:00
Paul Adenot
3f86a06fce Generate compile_commands.json while building 2023-08-25 20:09:58 +02:00
Paul Adenot
33ade008b5 OpenSLES: compile as C++ 2023-08-25 20:09:58 +02:00
Paul Adenot
cfd7bf22d6 Compile in C++17, like Gecko 2023-07-26 14:02:22 +02:00
Paul Adenot
5e12bb870d Allow specifying a particular clang-format binary (version), and pin the CI to version 15 2023-05-17 10:57:17 +02:00
Macdu
88585b669b cmake: Make undefined symbols weak on Android 2023-01-27 13:07:18 +01:00
Liam
67af793663 cmake: quote CXX_FLAGS substitution for MSVC 2023-01-23 14:55:16 +13:00
Paul Adenot
304ef97245 Add a triple_buffer class that allows publishing data in a wait-free manner from a real-time thread to another thread.
It's largely inspired from the crate cubeb-coreaudio-rs uses, but ported to
C++.
2022-12-14 18:33:27 +01:00
Paul Adenot
7f5589a431 Allow dynamic enabling and disabling of the log, add tests for the logging system.
Also clear out the memory used by the async logger when it's shut down.

This relies on the fact that enabling and disabling logging is performed
on the same thread, but I think this is a reasonnable thing to do. We
could assert it though.
2022-12-02 14:17:18 +01:00
Alexandre Bouvier
06aa271e5b cmake: fix install rules
* don't install cmake test binaries
* fix variable names in Doxyfile.in
* install doc files
2022-09-21 18:47:36 +12:00
Matthew Gregan
6e5b9fe38c build: Return to building bundled speexdsp as object library. 2022-03-09 15:10:52 +13:00
Matthew Gregan
2fb20f7b9c Assert device collection callbacks were unregistered before cubeb_destroy is called. 2022-02-28 23:38:46 +13:00
Andrea Pappacoda
f79e0cf9f0 build: use libbsd when using OSS and glibc
Some systems offer OSS v4 but do not have BSD-only functions like
strlcpy, used in cubeb_oss.c. An example is Debian GNU/kFreeBSD, that
uses a FreeBSD kernel with GNU userspace utilities, like glibc.

With this patch cubeb will be able to build on these systems thanks to
the help of libbsd, that privides most libc functions that you would
expect on BSD.
2022-02-02 12:40:57 +13:00
Paul Adenot
9937d0bb57 Fix build on MinGW
Original downstream patch by Tom Ritter <tom@mozilla.com>.
2021-12-08 08:47:42 +13:00
Matthew Gregan
df1f3e9d87 build: Bump minimum CMake to 3.14.
This is required since the install() cleanup in
e690fc21bb.
2021-11-23 12:35:11 +13:00
Andrea Pappacoda
e690fc21bb build: minor CMake cleanups
These are minor cleanups that do not affect the behaviour of the script.

In particular, I removed most `DESTINATION` arguments from `install()`,
since they are automatically deduced based on the type of file to be
installed.

In #662 I also added doxygen_add_docs and gtest_discover_tests, but they
require CMake version 3.9 and 3.10 respectively, and I think that the
advantages they provide are not worth dropping support for older versions
2021-11-10 08:53:06 +13:00
Andrea Pappacoda
07c352c65a build: use system speex when possible
Following
https://github.com/mozilla/cubeb/issues/658#issuecomment-955998734, the
speex library is now handled like a normal dependency: cubeb will link
against the system version if available, and fall back to the bundled
one if not.

I've also added a BUNDLE_SPEEX option, so that you can force the use of
the bundled library if needed (e.g. creating a standalone libcubeb on a
system where libspeex is available).

I also had to move the bundled library to a separate folder. As `src` is
always added as an include path, the headers in `src/speex` would
conflict with system headers. And it also clears the relationship
between cubeb and speex. I choose the "subprojects" name to follow the
Meson convention, since CMake does not have one. A bit OT, but if you're
curious you can see their rationale here:
https://mesonbuild.com/Subprojects.html#why-must-all-subprojects-be-inside-a-single-directory

Lastly, I added cubeb_log.cpp to the list of sources of test_resampler,
as I was getting linking errors when building with BUILD_SHARED_LIBS=true

Fixes #658
2021-11-09 09:38:18 +13:00
Andrea Pappacoda
5a64bc898c build: add USE_SANITIZERS option
This is useful to users who can't recursively clone the repo or that
simply want to build the project from the downloadable tarball (like
Linux distributions, for example)
2021-11-09 09:32:05 +13:00
Andrea Pappacoda
5d93d2dc0b build: add LAZY_LOAD_LIBS option and always link with threads
Users can now disable the lazy loading of libraries, and use classic
linkage instead.

Previously, cubeb would link with threads only if using some backends.
This caused linking issues when no backends were active, because cubeb
wasn't linked against pthread or similar, while the library is needed by
src/cubeb_log.cpp, as it uses std::thread.

 #cleanup
2021-11-06 10:07:58 +13:00
Andrea Pappacoda
f132be2032 build(cmake): add version and soversion to the built library 2021-11-01 20:31:46 +13:00
Andrea Pappacoda
72f959807d build(cmake): use system GTest when available
This speeds up compilation times and makes downstream packaging easier.
2021-11-01 20:28:31 +13:00
Matthew Gregan
f495dc9825 Add clang-format-check target to CMake and run on CI. 2021-07-28 11:43:17 +12:00
Paul Adenot
f61dd1ebea Tell GTest that RTTI is not available for clang (for other compilers it's automatically detected) 2020-10-30 16:38:43 +00:00
Paul Adenot
5a76f201ec Don't use exception in the new cubeb_aaudio.cpp, and don't build with exception or RTTI 2020-10-30 16:38:43 +00:00
nyorain
9183f2e654 Move aaudio backend to C++ & enable low latency 2020-10-28 16:55:14 +00:00
nyorain
767c2891f1 Remove pthread from libraries on android 2020-10-28 16:55:14 +00:00
nyorain
b3e3e2af0a Add first AAudio backend prototype 2020-10-28 16:55:14 +00:00
khng300
226d383c13
OSS (FreeBSD/illumos) backend (#600)
* ossaudio (FreeBSD currently) backend

The ossaudio backend was rewritten from the sunaudio
backend.

* Fix leaking of mixer_fd in oss_enumerate_devices

* Both input/output can be detected at the same DSP

* Update on device detection during enumeration

* Remove spurious calls to SNDCTL_CARDINFO

* Fix string allocation detection in oss_enumerate_devices

* On FreeBSD, try to open and probe the device's capability in oss_enumerate_devices

* Rewrite oss_io_routine() to implement correctly for all stream directions

* Add preferred device detection for FreeBSD

* Emits stable devid from oss_enumerate_devices on FreeBSD

* Fix SNDCTL_DSP_GETI/OSPACE calls in oss_stream_init

* Use /dev/sndstat instead on FreeBSD for oss_enumerate_devices

* Unify both play and record nfr and take the minimum value between them

* Fix allocating both input/output buffers to input/output-only streams

* Fix clipping issue

* Fix misuse of input_device and output_device in oss_stream_init

* Fix builds on Illumos

* Code refactoring on oss_enumerate_devices

* Improve oss_io_routine for the case when the stream is in both direction

* Use fragsize instead of total buffer size for number of frames

* Probe OSS audio availability in cubeb_init when backend is not specified

* Fix scan-build10 report on src/cubeb_oss.c:285

* Add __DragonFly__ pp macro testing along-side __FreeBSD__

* Move oss_init in default_init[] table right below alsa to respect POLA

* Fix use-after-free of s->mutex in oss_stream_destroy

* Fix inconsistent indentation

* Remove blocks_written from cubeb_stream

* Add LL integer suffix to make 0x80000000 more clear

* Add parsing of /dev/sndstat for hw.snd.verbose > 0 in FreeBSD

* Do device setup in the order of channels, format and speed, according to developer/callorder.html of OSS v4.x API reference

* Add proper latency_frame support for oss_stream_init

* Mark close brackets and close braces NUL in oss_sndstat_line_parse

* Search close brackets and close braces from the end of line in oss_sndstat_line_parse

* Use 32 frames for each fragments in oss_calc_frag_params

* Drop unnecessary #include <sys/sysctl.h>

* Add support for cubeb_channel_layout

* Compilation and scan-build fixes:

* Fix warnings in oss_chn_from_cubeb
* Include cubeb_mixer.h to have cubeb_channel_layout_nb_channels
* Fix potential resource leakage in input_stream_layout->layout does not
match input_stream_params->channels. (The same for
		output_stream_layout)
* Classify cubeb_stream_params::layout and cubeb_stream_params::channels
mismatch as CUBEB_ERROR_INVALID_PARAMETER

* AUDIODEVICE can now override /dev/dsp

AUDIODEVICE was chosen to match the sndio backend.

* Change environment variable AUDIODEVICE to AUDIO_DEVICE in oss backend

* Change the format of cubeb_device_info's friendly_name

This avoids name collision when setting media.cubeb.output_device in
about:config of Firefox. However, I think it makes more sense on
Firefox's side to use device_id instead.

* Fix warning of a missing %d in LOG() in oss_io_routine

* Do not enable OSS compilation when SOUND_VERSION < 0x040000

* Add mutex to serialize access to cubeb_strings in cubeb_oss's cubeb_context

* Change the calculation of fragsize/nfr to match stream latency, with 2 fragments available. By HPS

* Now reuse the same thread for audiostream

* Redo the duplex logic

* Restructure the use of buffers

* Fix problems dealing with draining

* Revert "Fix problems dealing with draining"

This reverts commit 30301ba101.

* Revert "Restructure the use of buffers"

This reverts commit 9823ca889c.

* Revert "Revert "Restructure the use of buffers""

This reverts commit 10dc869b85.

* Revert "Revert "Fix problems dealing with draining""

This reverts commit 9d19b10944.

* Make sure there are at least s->nfr available before calling data_cb

* Kill a signed/unsigned comparison

* Add The FreeBSD Foundation copyright line for recent commits

* Fix race condition when restarting a stream by HPS

Originally, when stopping a stream and immediately starting the stream
again, the start call might be lost.

* Do not signal the doorbell_cv again when a stream is already stopped

This is redundant.

* Revert "Do not signal the doorbell_cv again when a stream is already stopped"

This reverts commit fbdf753fc7.

* Make state changes look more similar to pulse backend

This also allows drained/short-input stream to be resumed without
stopping it first.

* Remove a spurious s->running = false
2020-10-09 19:09:39 +02:00
Guillaume Besson
082ba33d12 Fix CMake rust path and only use rust deps if needed 2020-09-28 14:23:32 +02:00
Matthew Gregan
7f94e27fdc Force Rust builds to always rerun cargo. 2020-03-24 13:10:11 +13:00
Jan Beich
797779866b build: sndio needs -ldl on Linux after 39d20a326f 2019-09-10 10:20:24 +12:00
Jan Beich
a7ae0234e8 alsa: don't depend on libasound by default 2019-09-09 13:49:48 +12:00
Jan Beich
edf8c13d00 sndio: don't depend on libsndio by default 2019-09-09 13:49:48 +12:00
Jan Beich
7b7bdfc2fe build: explicitly link sndio against -lpthread
/usr/bin/ld.bfd: libcubeb.so: undefined reference to `pthread_create'
2019-09-09 13:49:48 +12:00
Jan Beich
552454f621 build: pulse/jack use dlopen, so don't link directly 2019-09-09 13:49:48 +12:00
Jan Beich
9456b3687f build: simplify -ldl handling 2019-09-09 13:49:48 +12:00
Paul Adenot
8c3e32bd24 Remove panning API from cubeb
This is best done by the host application, and had very little
implementation anyways.
2019-08-22 10:11:25 +12:00
Paul Adenot
0b5b52d371 Link pulse when building the rust pulse backend
This fixes #480.
2019-07-19 13:45:46 +12:00
Matthew Gregan
0d1d9d84fb Link pthread when building USE_PULSE.
This was working accidentally by picking up pthread via the common
configuration including USE_ALSA.
2019-07-02 13:48:36 +12:00
nia
9f39687e7f sunaudio (NetBSD/illumos) backend (#510)
* Initial support. Device scanning and sanity checks work.

Playback and recording does not.

* stream_init fixes. Audio test now runs, though doesn't do anything.

* Set the prinfo type to the device type we'll later be limited to.

* Playback support.

Also implement stream_get_current_device and stream_device_destroy.

* AUDIO_SETINFO properly.

* Don't poll forever when recording.

Use the recommended number of latency_frames as our BUFSIZE.

* Fix typo.

* Don't allocate devid. Required for a sanity test.

* Fix some tests

* Initial attempt to support Solaris

* stdlib.h for calloc.

* undo local change

* Should probably be using "events" here, and the state change isn't
necessary now that it's done elsewhere.

* Avoid format truncation warning.

* more illumos fixes

* Performance improvements.

It seems polling for input is not a viable strategy.

* Protect volume and frames_written with a mutex.

* Protect running with a mutex.
2019-06-12 10:35:08 +12:00
Chun-Min Chang
acbed7de51 Add audiounit-rust backend (#511) 2019-06-08 14:06:30 +12:00
Matthew Gregan
7b7210bf63 Link ole32 in WASAPI backend for COM symbols.
Fixes build on aarch64.  We must've been picking ole32 up implicitly on x86
platforms.
2019-04-10 10:48:54 +02:00
Alex Chronopoulos
643a4aa6d0
Cubeb app for basic testing. (#487)
* Cubeb app for basic testing.

* cubeb-test: fix windows build

* address review comments
2019-02-01 11:30:40 +02:00
Chun-Min Chang
42e931de37 Add tests for cubeb_stream_register_device_changed_callback 2019-01-06 16:52:29 -05:00