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

1606 Коммитов

Автор SHA1 Сообщение Дата
Paul Adenot 7367b48082 Update submodules 2023-07-31 11:39:04 +02:00
Paul Adenot af4769f18a Run clang-format 2023-07-26 14:02:22 +02:00
Paul Adenot cfd7bf22d6 Compile in C++17, like Gecko 2023-07-26 14:02:22 +02:00
Paul Adenot 31d6a2b0f2 AAudio: Fix log level when stopping a stream 2023-07-26 14:02:22 +02:00
Paul Adenot eef055ab21 AAudio: When a device is disconnected, reinitialize the stream with the same parameters 2023-07-26 14:02:22 +02:00
Paul Adenot 29d266e628 AAudio: Split init/destroy/start functions into an internal and external interface
This will allow calling those functions properly from an internal thread, and
simplify lock management. This will happen in a subsequent patch.

The initial parameter passed to cubeb_stream_init are now stored on the
cubeb_stream struct to be able to reinitialized properly (again in a subsequent
patch).

Since all those calls need have a lock held, the lock is passed as argument to
ensure thread safety. This ensures the caller of the internal functions has
taken the lock, and at the same time allows not unlocking/relocking the mutex if
a series of call is performed (that will be the case in a subsequent patch,
during reinitialization).

The boolean that marks that a stream is in use is modified in the external
interface, called by the user. A stream is marked as being in use when the user
initialize it, and is marked as not being in use when the user destroys it.
2023-07-26 14:02:22 +02:00
Paul Adenot 8ee7b799e2 AAudio: switch to using cubeb logging facilities 2023-07-26 14:02:22 +02:00
Paul Adenot c31bcf3159 Fix clang-tidy warnings in cubeb_log.cpp 2023-07-26 14:02:22 +02:00
Paul Adenot dfc128b053 AAudio: fix clang-tidy issues 2023-07-26 14:02:22 +02:00
Matthew Gregan 68084e902e wasapi: Flag cubeb_stream as inactive when stopped, avoid reconfiguring inactive streams from render thread. 2023-07-26 13:57:06 +02:00
Matthew Gregan 779f024958 wasapi: Take stream_reset_lock earlier in render thread reconfig path. 2023-07-26 13:57:06 +02:00
Paul Adenot 48689ae7a7 Remove incorrect code to adjust output queue capacity 2023-05-17 13:38:27 +02:00
Paul Adenot da01c85243 Run clang-format-15 on the codebase -- fix a single difference 2023-05-17 10:57:17 +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
Michael M febf49d089 wasapi: make render thread exist for the lifetime of the stream object
- Converts cubeb_stream into a reference-counted object, and gets rid of
  emergency_bailout logic
- When reconfiguring, only restart a stream if it was already started
- Removes timeout inside the render thread, as we can't guarantee events
  while a stream is stopped

Subsequently rebased by Paul Adenot <padenot@mozilla.com>
2023-05-17 10:57:17 +02:00
Paul Adenot 1ba9237364 Skip a couple more tests when a backend can't use audio input 2023-04-26 14:28:46 +02:00
Paul Adenot 88900545d4 Only run test_overload.cpp when using the WASAPI backend 2023-04-26 14:28:46 +02:00
Paul Adenot 0e7f41d6ef Don't run test_loopback and test_duplex on backends that can't open audio input 2023-04-26 14:28:46 +02:00
Paul Adenot d478bff5fb Don't wait in winmm_stream_destroy when the return value of the data callback is an error. 2023-04-26 14:28:46 +02:00
Paul Adenot 47720cbc03 Don't continue calling the data callback in the winmm backend if the user has returned a negative value 2023-04-26 14:28:46 +02:00
Paul Adenot 2e0fe89106 Prevent running test that make use of audio input streams on backends that don't implement it 2023-04-26 14:28:46 +02:00
Paul Adenot 9517d4e837 Install virtual audio devices on Windows runners, enable microphone permission globally 2023-04-26 14:28:46 +02:00
Paul Adenot d3820eb365 clang-format cubeb_winmm.c 2023-04-26 14:28:46 +02:00
Paul Adenot aa05a1380e Attempt enabling test on gh action windows, also run the winmm backend 2023-04-26 14:28:46 +02:00
Paul Adenot af5e9f1211 Add some logging messages to winmm to ease debugging and make the logging test pass 2023-04-26 14:28:46 +02:00
Paul Adenot 31fb25d7eb Handle a negative return value from the user callback 2023-04-26 14:28:46 +02:00
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