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

1677 Коммитов

Автор SHA1 Сообщение Дата
Andreas Pehrson eb8fb7e87d In resampler's input_needed_for_output do not mix rates 2024-08-07 12:00:17 +02:00
John Lin bbbe5bb0b2 [AAudio] offset position by number of written frames.
When reinitializating, `cubeb_stream::previous_clock` isn't reset
properly but stream gets reset and restarts `AAudioTimingInfo::output_frame_index`
from zero. Therefore, `aaudio_stream_get_position()` always reports
previous clock rather than actual position until it is surpassed later.

To estimate the position correctly, Save the number of frames sent
to stream before it's reset, and use the value as the basis for
future position estimation.
2024-07-10 11:10:17 +02:00
John Lin 063a090221 [AAudio] request pause rather than stop.
According to the document,

 AAudioStream_requestStop():
 "The stream will stop after all of the data currently buffered has been played."

 AAudioStream_requestPause():
 "Pausing a stream will freeze the data flow but not flush any buffers."
2024-07-08 18:08:38 +02:00
John Lin 0adfabf98d [AAudio] track stopped time.
aaudio_stream_get_position() calculates position using elapsed time
since last callback, including the time during stream is stopped.

To interpolate correctly, record the stop time and use it in calculation.
2024-07-08 18:08:38 +02:00
Andreas Pehrson 89573c99c7 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-05 11:02:26 +12:00
Andreas Pehrson 5d5008d25c Set buffer capacity to allow for buffering 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
Paul Adenot eb1293382e Add and modify a few logging statements 2023-11-10 11:31:35 +01:00
Paul Adenot b040f89681 AAudio: when finding that an input device has been disconnected, reinitialize the duplex stream 2023-11-10 11:31:35 +01:00