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

1010 Коммитов

Автор SHA1 Сообщение Дата
Paul Adenot 4ca174cf83 Adjust test, make it extra-clear when we're missing something 2024-04-25 17:51:14 +02:00
Paul Adenot ee8a6a2535 Disable dumping by default, gate it behind a feature flag 2024-04-25 17:51:14 +02:00
Paul Adenot 325648d482 kAudioChannelLabel_Unknown maps to mixer::Channel::Discrete 2024-04-25 17:51:14 +02:00
Paul Adenot 1033671268 Reflect audio-mixer changes about the new Discrete channels 2024-04-25 17:51:14 +02:00
Paul Adenot b70ba52655 Use audio-mixer 0.2, necessary for discrete channel handling 2024-04-25 17:51:14 +02:00
Paul Adenot 0440d2a7c5 Fix typo 2024-04-25 17:51:14 +02:00
Andreas Pehrson 857b998961 Teach this backend to dump its audio directly from real-time callbacks
For now this always dumps. This will be fixed later in the series.
2024-04-25 17:51:14 +02:00
Andreas Pehrson cc58f92f28 Adjust test expectations 2024-04-25 10:49:58 +02:00
Andreas Pehrson e84de7e88d Never use VPIO on macOS 12, even when the forcelist tells us to 2024-04-25 10:49:58 +02:00
Andreas Pehrson 7b10217149 Fix a rustc-nightly warning due to a legacy numeric constant
See https://rust-lang.github.io/rust-clippy/master/index.html#/legacy_numeric_constants
2024-04-08 15:45:38 +02:00
Andreas Pehrson 8881a7c1a4 Reduce amplitude of generated tone in test_dial_tone
It has been heard to clip on some device configurations.
2024-04-08 15:45:38 +02:00
Andreas Pehrson 8ce92977e9 Remove cfg_attr private_in_public
It doesn't seem needed, and keeping it results in a warning.
2024-04-08 15:45:38 +02:00
Andreas Pehrson b03ba54538 Fix some panic tests
We want to test the real panic, not a test-specific threading assertion failure.
2024-04-08 15:45:38 +02:00
Andreas Pehrson b99cae416e Tighten up LatencyController 2024-04-08 15:45:38 +02:00
Andreas Pehrson f3464c6ac2 Dispose of shared vpio units once they've not been used for 10 seconds 2024-04-08 15:45:38 +02:00
Andreas Pehrson a31e0ddbf2 Refactor SharedStorage<T> so as to centralize creating and recycling vpio units 2024-04-08 15:45:38 +02:00
Andreas Pehrson 2fac75bc3f Make create_voiceprocessing_audiounit wrap the AudioUnit into VoiceProcessingUnit directly 2024-04-08 15:45:38 +02:00
Andreas Pehrson 344408513e Remove vpio priming
Priming has side effects:
Creating a VoiceProcessingIO unit will automatically configure the
default devices for voice processing, which can have these side effects:
- builtin mic as default input switches from one channel to three
- bluetooth device as input switches its profile to handsfree, making
  output mono
2024-04-08 15:45:38 +02:00
Andreas Pehrson 04f250db66 Implement Queue::run_after for delayed execution of tasks 2024-04-08 15:45:38 +02:00
Andreas Pehrson 361d2bbe65 Add a VoiceProcessingIO force-list
This makes us avoid getting raw (non-vpio) data from devices that may
sound bad when they are hooked up to vpio elsewhere on the system (by us
or other apps). Case in point: 14" M2 Macbook Pro built-in mic exposes
three channels instead of one in the setup described above, all channels
with very low volume compared to a vpio setup, or to a raw setup with no
vpio present elsewhere.
2024-04-02 08:21:30 +02:00
Andreas Pehrson 6aaaf8cd73 Make input and output stream prefs settable in manual stream tester 2024-04-02 08:21:30 +02:00
Andreas Pehrson 24b45fa852 Allow VPIO units with input-only streams 2024-04-02 08:21:30 +02:00
Andreas Pehrson 4c4c0d8d25 Allow two shared VPIO units and any number of standalone ones 2024-04-02 08:21:30 +02:00
Andreas Pehrson f8df86f753 On aggregate devices put the input device first
Otherwise if the output device has input streams, the channels from
those streams will be chosen instead by the input BufferManager.
2024-03-26 10:57:24 +01:00
Andreas Pehrson fa18e40d16 Upgrade checkout action to v4
This avoids some node version warnings in CI.
2024-03-26 10:54:34 +01:00
Andreas Pehrson 81875744c4 Make test_stream_tester able to create multiple streams 2024-03-26 10:54:24 +01:00
Andreas Pehrson 7aebc07abb Run in CI on macOS 12, 13 and 14 with sanitizers on 14 2024-03-20 15:10:44 +01:00
Andreas Pehrson 2e27b80665 Add test coverage for data callback signaling stream to drain and stop 2024-03-18 23:20:24 +01:00
Andreas Pehrson 623913eb3b In terminal type test don't assume all streams have the right direction
For input there could be a an output stream if vpio is present on the
machine.
2024-03-18 23:20:24 +01:00
Andreas Pehrson 2d0ac908fb Add back AGC detection to the manual stream tester 2024-03-18 23:20:24 +01:00
Andreas Pehrson 47344d0143 Prime the shared vpio unit whenever a duplex stream is requested
Creating the vpio unit takes a long time. This commit lets clients
create the shared vpio unit async on a background thread ahead of time,
so that when they need it it is already available for reuse.
2024-03-18 23:20:24 +01:00
Andreas Pehrson 3bc1cd53d4 Use SharedVoiceProcessingUnit for getting a vpio unit
It allows at most one vpio duplex stream per context, which is hopefully
enough for all real-world use cases.

Note that Gecko could create at most one duplex stream per document, and
there could in theory be multiple documents per context, which is a
content process singleton.
2024-03-18 23:20:24 +01:00
Andreas Pehrson 9af2797627 Create a SharedVoiceProcessingUnit helper 2024-03-18 23:20:24 +01:00
Andreas Pehrson 545239d052 Test that voice duplex streams are using vpio 2024-03-18 23:20:24 +01:00
Andreas Pehrson 022c1f1c73 Allow running multiple stream tests on a single context instance 2024-03-18 23:20:24 +01:00
Andreas Pehrson 24afa94d66 Remove some redundant use statements 2024-03-18 23:20:24 +01:00
Andreas Pehrson e29c0953f6 Make tests terminaltype-aware when counting channels
With vpio priming devices may be queried for channel count with a vpio
unit around, where they previously wouldn't. The vpio unit existing
means output devices may list an extra (input) tap stream. This patch
filters out away streams having anything but the most common input
terminal types.
2024-03-18 23:20:24 +01:00
Andreas Pehrson e87b8b793e Fix deadlocks caused by synchronous platform callbacks 2024-03-18 23:20:24 +01:00
Andreas Pehrson edfa3b5507 Don't run tests that don't exist 2024-03-18 23:20:24 +01:00
Andreas Pehrson 111b3d58c5 In test_unplug_a_device_on_an_active_stream assert that stream.start succeeded 2024-03-18 23:20:24 +01:00
Andreas Pehrson 09e1090efe Make dispatch_queue_t wrapper Queue threadsafe
TSAN has complaints otherwise, after running the full suite.
2024-03-18 23:20:24 +01:00
Andreas Pehrson 551502870c Serialize all platform audio interactions in tests process-wide
This is to avoid deadlocks and races when running tests in CI.
2024-03-18 23:20:24 +01:00
Andreas Pehrson 9761c2a893 Shrink lock scope in AudioUnitContext::drop 2024-03-18 23:20:24 +01:00
Andreas Pehrson 2419b928a6 Serialize all context and stream operations process-wide
This is to avoid platform bugs resulting in deadlocks and races.

It tries to serialize all operations on top of a single serial queue,
though probably doesn't cover all. One notable exception is operations
in tests that expect a panic, since panics are not forwarded to the
calling thread.
2024-03-18 23:20:24 +01:00
Andreas Pehrson 67ed35d0f1 Don't require Send for run_sync and run_final
Per the Apple docs:
> As a performance optimization, this function executes blocks on the
> current thread whenever possible, with one exception: Blocks submitted
> to the main dispatch queue always run on the main thread.
2024-03-18 23:20:24 +01:00
Andreas Pehrson 247b568e25 Introduce a process-wide singleton Queue
This will be the root queue for all platform audio operations
2024-03-18 23:20:24 +01:00
Andreas Pehrson 147de1e6c8 Make run_sync and run_final return the operation's return value 2024-03-18 23:20:24 +01:00
Andreas Pehrson a24a0ba074 Make it possible to create a Queue on top of another
This allows nesting serial queues to ensure all operations are
serialized (the top queue) while also ensuring a stream- or
context-specific queue cannot run any tasks once its owner has been
dropped.
2024-03-18 23:20:24 +01:00
Andreas Pehrson f9bb49758e Assert synchronously that run_final hasn't already run 2024-03-18 23:20:24 +01:00
Andreas Pehrson d23ab55eab Remember input mute state after reinit 2024-02-21 14:23:14 +01:00