Commit graph

1679 commits

Author SHA1 Message Date
Andreas Pehrson
4bae2267f8 Don't print cubeb result codes as if they're from AAudio
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
2024-07-04 22:41:26 +02:00
Andreas Pehrson
4f72bb725e Allocate and share session ID for input streams
A session ID is required for audiofx, even through presets.
The latter is not clear in the documentation, but see
https://android.googlesource.com/platform/frameworks/av/+/master/services/audioflinger/AudioFlinger.cpp#1035

There's a single system-wide audio route for input. Only a single input
preset at a time seems to be usable. This commit makes us reject the
init of a stream that doesn't match a preset that has already been
acquired in the context.
2024-07-04 22:41:26 +02:00
Andreas Pehrson
5b1ec90ed4 Implement aaudio_set_input_processing_params 2024-07-04 22:40:41 +02:00
Andreas Pehrson
2fbece9ec6 Split up reinitialize_stream 2024-07-04 22:16:18 +02:00
Andreas Pehrson
3910d5d4ad Implement aaudio_get_supported_input_processing_params
This also sets up the AAudio backend with JNI if available from the
client. Input processing params are only supported if JNI is available
and it reports that AEC is available on the system.
2024-07-04 22:16:18 +02:00
Andreas Pehrson
4f27c5c382 Mark functions in android headers inline
Also add an include to not depend on it being included externally.
2024-07-04 22:16:18 +02:00
Andreas Pehrson
714ab57f8f Reset stream params on init
Without a reset, a duplex stream being reused as an output stream will
open an input stream and provide an input buffer, which is not expected.
2024-07-04 22:16:18 +02:00
Andreas Pehrson
5d5008d25c Set buffer capacity to allow for buffering
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
2024-07-01 12:18:39 +02:00
Chris Peterson
42cf7061fc Include <memory> for std::unique_ptr
LLVM's libc++ is removing transitive inclusions among std header files in newer C++ versions, so user code must explicitly include needed std header files. In this case, cubeb_opensl.cpp must explicitly include <memory> for `std::unique_ptr` because, starting in C++23, <vector> no longers includes <memory>.

https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html

```
libcubeb/src/cubeb_opensl.cpp:140:8: error: no template named 'unique_ptr' in namespace 'std'
  140 |   std::unique_ptr<cubeb_stream_params> input_params;
      |   ~~~~~^
```
2024-06-04 17:45:46 +02:00
Paul Adenot
dabff209dd Build Android in cubeb's CI on the 3 main arch Gecko supports 2024-05-24 15:53:45 +02:00
Paul Adenot
cb2e32e3e5 Cast to int64_t to fix the build on 64-bits Android 2024-05-24 15:53:45 +02:00
Paul Adenot
b735de2cee Build on aarch64 by default on Android 2024-05-24 15:53:45 +02:00
Paul Adenot
16a5edb677 Build on Android on an Ubuntu 22.04 2024-05-24 15:53:45 +02:00
Paul Adenot
d60b441123 Clamp to positive value when computing latency for an output stream
Diagnosed by jolin@mozilla.com, the same code is also found in Chromium.
2024-05-24 15:53:45 +02:00
Paul Adenot
b692d65069 Clamp to positive value when computing latency for an output stream
Diagnosed by jolin@mozilla.com, the same code is also found in Chromium.
2024-05-24 15:53:45 +02:00
Paul Adenot
6c1a6e151c Revert "Fetch avrt.dll functions dynamically again."
This reverts commit aaffe75c25.
2024-05-21 18:11:12 +02:00
John Lin
19fcbefe1a Invalidate timing info buffers when destorying AAudio stream.
aaudio_stream_get_position() returns incorrect result because
aaudio_stream_init() recycled destroyed stream where the
timing_info buffers contain stale data.
2024-04-30 10:52:29 +12:00
Andreas Pehrson
b82e270abf Account for enqueues while in cubeb_audio_dump_stream::write_all 2024-04-16 16:31:18 +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
529c3d2644 Attempt to reinitialize the stream when the error callback is called with AAUDIO_ERROR_TIMEOUT
This can happen when the client side of the AAudio API fails to write
all the data to the server side, after the user callback has returned.
According to the reporter, this can be hit when a debugger is attached.

This fixes #767.
2024-04-16 16:30:46 +02:00
Paul Adenot
f42ca23add Log a message when waiting for AAUDIO_STREAM_STATE_STOP when shutting down a stream in error fails 2024-04-16 16:30:46 +02:00
Paul Adenot
67db4cbc18 Some DACs can go up to 768kHz 2024-04-03 15:15:53 +02:00
aeiouaeiouaeiouaeiouaeiouaeiou
1572ea3e8d CI: use macos-13 environment and add macos-14 (arm64 M1)
Add a workaround for microphone permission: https://github.com/actions/runner-images/issues/9330

Co-authored-by: Andreas Pehrson <apehrson@mozilla.com>
2024-03-25 11:10:50 +01:00
Paul Adenot
1eb7e6824f Fix mistake in first parameter type in function pointer 2024-03-20 12:51:34 +01: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
Mike Hommey
5491fc8b27
Only build duplex_collection_change_no_unregister when death tests are supported (#780) 2024-03-06 20:45:53 -08:00
Andreas Pehrson
74d6b05465 Allow setting CUBEB_INPUT_PROCESSING_PARAM_NONE
Clients may want to disable processing...
2024-02-15 13:42:53 +01:00
Paul Adenot
46906c7bba 384kHz ought to be enough for anybody 2024-02-07 17:57:06 +01:00
Paul Adenot
799e775484 Format new changes 2024-01-31 10:51:22 +01:00
Steveice10
d0ffc6d302 audiounit: Resample to match output device hardware sample rate in uncommon cases.
In some cases, weird sample rates can cause AudioUnit output
units to misbehave. Instead, use resampling for non-native rates
to make sure this does not happen.
2024-01-31 10:51:22 +01:00
Andreas Pehrson
dd8a91f982 Add an API for muting the input side of a stream 2024-01-15 15:25:40 +01:00
Andreas Pehrson
5a2df9b0aa Add APIs for input processing 2024-01-15 15:25:40 +01:00
Nikolay Borodin
ffec8ede4c Checking buffer, buffer_in, buffer_out pointers for non NULL values 2024-01-08 11:31:04 +01:00
Andreas Pehrson
ed2efe22cb auto_array: protect from various calls when length_ is 0
cubeb-coreaudio-rs has hit a case when running its tests on MacOS 12
where it fails the `assert(destination && source);` in `PodCopy` because
it tried to push 0 samples to an auto_array of length 0, as the internal
auto_array buffer had not been allocated yet.
2023-12-12 10:56:31 +01:00
Paul Adenot
54217bca3f Relax a single test_sanity.cpp assertion when using OpenSL 2023-11-21 11:08:34 +01:00
Paul Adenot
33531e337a Allow not being able to get the minimum latency in test_callback_ret.cpp and test_logging.cpp, as it's not essential for the test 2023-11-21 11:08:34 +01:00
Paul Adenot
699c44180e Add static keyword to fix build of tests in unified builds 2023-11-21 11:08:34 +01:00
Paul Adenot
5707d0e447 Fix latency reporting on OpenSL 2023-11-21 11:08:34 +01:00
Paul Adenot
30efcd1cdf Remove test_deadlock.cpp file, hasn't been compiled since March 2018
Removed in 789eaa.
2023-11-10 17:00:19 +01:00
Paul Adenot
2f01da4a8a Include gtest.h in test/common.h 2023-11-10 15:52:55 +01:00
Paul Adenot
63f69b9986 Include the header directly to use AudioBuffer on macOS in cubeb_ring_array.h 2023-11-10 15:48:07 +01:00
Paul Adenot
001b904409 Non-functional change: Directly include string.h in test/common.h 2023-11-10 15:37:57 +01:00
Paul Adenot
47f9a4733b Consistently use double in the mixer
This fixes a warning: INT32_MAX cannot be represented as a float.
2023-11-10 15:32:03 +01:00
Paul Adenot
28eed05dd5 Non functional change: Fix missing documentation in cubeb.h 2023-11-10 15:32:00 +01:00
Paul Adenot
625213fd9f Non-functional change: Check tests when checking format 2023-11-10 15:31:57 +01:00
Paul Adenot
687b1e3446 Non-functional change: clang-format tests 2023-11-10 15:31:52 +01:00
Paul Adenot
8b4721e51e Non functional change: fix unified compilation issue -- make callbacks static 2023-11-10 15:31:45 +01:00
Paul Adenot
6f0f147148 clang-format 2023-11-10 11:31:35 +01:00
Paul Adenot
b32ab34399 Reset logging thread ID when starting a new stream to allow debugging comfortably 2023-11-10 11:31:35 +01:00
Paul Adenot
2dedf7b191 AAudio: set the callback size to the latency passed in, increase internal buffer size to be 3 times the burst size 2023-11-10 11:31:35 +01:00