Граф коммитов

1680 Коммитов

Автор SHA1 Сообщение Дата
Paul Adenot 6442216760 Change the WinMM backend so that it doesn't call the user callback during initialization 2023-04-26 14:28:46 +02:00
aeiouaeiouaeiouaeiouaeiouaeiou 3981f4a7ec Re-enable the test job on macOS CI 2023-04-23 12:54:56 +12:00
Paul Adenot 3ecf0c8f83 Sync back BMO#1825328
https://bugzilla.mozilla.org/show_bug.cgi?id=1825328 landed in Firefox
without going through upstream. It's necessary to build in an
environment where gtests are all compiled in the same executable.

Original patch by serge-sans-paille <sguelton@mozilla.com>.
2023-04-20 14:07:44 +02:00
Paul Adenot 479f8c5dec Don't spin when waiting for streams to be stopped. 2023-04-19 13:37:43 +02:00
Paul Adenot 55893cfa16 When an error happens, wait for the streams to be stopped before dispatching the error callback 2023-04-19 13:37:43 +02:00
Paul Adenot 3f45761b4f Add a way to know if the data callback is running 2023-04-19 13:37:43 +02:00
Paul Adenot 2840590aff Fix formatting warning 2023-04-19 13:37:43 +02:00
Paul Adenot 964a31b0fc Rename shutdown to shutdown_with_error got better convey the meaning 2023-04-19 13:37:43 +02:00
Matthew Gregan 2071354a69 opensl: Attempt to avoid a race with active callbacks during shutdown.
Based on examining crash dumps and investigating OpenSL workarounds in
liboboe, there is a potential race between active buffer callbacks and
stream shutdown, resulting in a buffer callback attempting to use a new
buffer after stream destroy has freed the backing allocation.

Ideally there would be a concrete event to watch for to ensure the
last callbacks have completed before destroying the stream, but I'm not
aware of one and the existing workaround in liboboe relies on an
arbitrary ("long enough") sleep between stopping and destroying streams.
2023-03-22 09:02:06 +13:00
Ryo ONODERA 63c148f602 On NetBSD, define _NETBSD_SOURCE for timersub() 2023-03-21 13:01:46 +13:00
Paul Adenot 70b4e3db78 format cubeb_sndio.c 2023-02-01 15:54:51 +01:00
Alexandre Ratchov 0846b39f1f sndio: switch audio to 24-bit precision 2023-02-01 15:54:51 +01: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 c96f0d4e7f Prefer the AAudio backend over the OpenSL ES backend
The last issues have been fixed, and it's now better (and also uses an
API that isn't deprecated).
2023-01-09 17:12:54 +01:00
Ryo ONODERA 28e4e20ca1 Enable strdup(3) for NetBSD 2023-01-09 15:55:53 +01:00
Matthew Gregan 1736e4aed3 wasapi: Drop context lock before deleting context. 2023-01-05 14:21:58 +01:00
Paul Adenot dbc60333f5 Fix warnings 2022-12-14 18:33:27 +01:00
Paul Adenot ffa3a43ef6 Generalize latency reporting to make it work in input-only and duplex modes 2022-12-14 18:33:27 +01:00
Paul Adenot 36ac2a31d8 Rewrite aaudio_stream_get_position with the accurate timing info provided by AAudio
A/V sync is now perfect regardless of the output device (bluetooth,
wired, speaker), and client side interpolation provides high accuracy
regardless of the buffer-size that the users decides on.
2022-12-14 18:33:27 +01:00
Paul Adenot ab242f6935 Compute and publish timing info, including position and latency, from the real-time audio callback (output-only)
This is essentially the same technique we're using on macOS in
cubeb-coreaudio-rs, ported for AAudio, and extended to input.
2022-12-14 18:33:27 +01:00
Paul Adenot 052e2a8001 Store the sample-rate on the stream struct 2022-12-14 18:33:27 +01:00
Paul Adenot cfcd4f3c42 Allow directly logging from cubeb_aaudio.cpp to logcat 2022-12-14 18:33:27 +01: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 e4da2d47c3 Don't include timeapi.h because it doesn't exist in MinGW, include mmsystem.h that declares timeGetTime instead. 2022-12-13 15:10:22 +01:00
Paul Adenot 274d8b56bc Fix warnings in cubeb_wasapi.cpp.
This fixes #733.
2022-12-13 15:09:21 +01:00
Paul Adenot f4b583c045 Include timeapi.h in cubeb_wasapi.cpp manually to unbreak the build when WIN32_LEAN_AND_MEAN is defined. 2022-12-12 16:45:21 +01:00
Paul Adenot 6a6113b6ff Add a test to stress test the asynchronous logging system 2022-12-12 12:03:47 +01:00
Paul Adenot 8eedc12369 Allow the asynchronous logging system to safely delete its storage. 2022-12-12 12:03:47 +01:00
Matthew Gregan 51728e55cd wasapi: Avoid reconfiguring default output stream spuriously. 2022-12-08 09:24:26 +13:00
Matthew Gregan eb8c4ff060 wasapi: Fix default device change filtering logic. 2022-12-08 09:24:26 +13:00
Matthew Gregan 784f4d7e3f wasapi: Typo fix. 2022-12-08 09:24:26 +13:00
Matthew Gregan 93d0b1247f cubeb-test: Add a newline after each log message. 2022-12-08 09:24:26 +13:00
Matthew Gregan 8d7365a9d5 wasapi: Release WASAPI resources in inverse order to acquisition.
This shouldn't have any behavioural effect as the WASAPI resources are
reference counted internally.
2022-12-08 09:24:26 +13:00
Paul Adenot cfc5692bf7 Account for the fact that some OSes have longer callback duration and async logging is batched 2022-12-05 17:27:36 +01:00
Paul Adenot b8765e132d Inline values for stream params in test_logging.cpp, undef defines in test to avoid breaking unified builds when building tests in Firefox. 2022-12-02 15:40:20 +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
Ty Lamontagne 27d2a102b0 Properly compare against current log level 2022-10-19 09:53:31 +13:00
Matthew Gregan 6b474ee404 Clarify `cubeb_log_get_{log,callback}()` declaration. 2022-09-29 17:06:04 -10:00
Paul Adenot 93d1fa3fcc Register threads explicitely created by cubeb
This covers some callbacks, but not all of them: the APIs that don't
require explicitely creating the thread will see their thread registered
separately.
2022-09-22 23:52:54 +02:00
Paul Adenot e9abb07824 Make the log callback and level atomic
It's useful to be able to enable logging dynamically while the program
is running, and this can now be done on any thread.

Various threads are logging (directly or asynchronously via the ring
buffer), it's better to have those atomic.

Both values are always checked before logging, and both must be non-null
to log.
2022-09-22 23:36:04 +02:00
Paul Adenot bc0450628e Simplify initialization of opensl backend 2022-09-22 08:32:32 +12:00
Matthew Gregan 28c8aa4a9c
Null check `context` in cubeb_enumerate_devices. 2022-09-21 19:27:36 +12: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
ivan-matveev 4783607ecc Remove comments after #endif to fix clang-format errors. 2022-09-06 14:38:56 +02:00
ivan-matveev d93c82fdd2 Add #ifndef around dlclose() to allow build with "LAZY_LOAD_LIBS=OFF" cmake argument. 2022-09-06 14:38:56 +02:00
Paul Adenot dc511c6b35 Add logging statement when input audio dropping happens 2022-07-21 18:34:39 +02:00
Paul Adenot 015f3c632a Add a header to be able to use a frame profiler in cubeb
The purpose of this header is to be swapped by cubeb users to use any
number of frame profiler (tracy/Gecko Profiler/trace_event.h, etc.).
2022-07-21 16:53:19 +02:00
Paul Adenot 190652b71f
Don't print the file name and \n twice when logging asynchronously (#715)
Not the prettiest but it does the job. Thanks to @ashleyz we don't really care about checking the log level here, it's checked ahead of time, which is nice because we don't want to carry it in the async log payload.
2022-07-19 08:53:29 -07:00
az c2243e891b
Check log level in asynchronous logging macros before printing (#714)
Added `ALOG` macro and updated `ALOGV` for use with asynchronous logging. Both macros should now verify log level.
2022-07-18 09:45:39 -07:00