269 Commits

Author SHA1 Message Date
Chris Robinson
af8e756dcb Fix the CoreAudio output element value 2022-05-10 15:36:26 -07:00
Chris Robinson
5c55ec2f9b More agressively hide PipeWire and SDL header warnings 2022-05-09 07:47:43 -07:00
Chris Robinson
96756acc52 Reject older versions of PipeWire than built against
Newer versions of PipeWire may add things to public structures. For example,
pw_buffer::requested added in 0.3.49. Building against 0.3.49 or newer, but
then running with 0.3.48 could result in invalid accesses since the returned
pw_buffer objects are shorter than the definition says to expect, creating
undefined behavior. Even if explicit access to the additional fields is
protected by a runtime check, the language allows the compiler to assume a
pointer to a pw_buffer object contains a complete pw_buffer, allowing the
optimizer to access the field earlier than the check (with the check only
controlling if the value gets used).

Another example is pw_time, which had a few fields added in 0.3.50 along with a
function, pw_stream_get_time_n, that provides the size of the pw_time struct
the application is using (so the library knows what version of the struct it
has to fill in). If a later version adds a new field, running it with an older
version will either fail (due to the library getting a size larger than it
knows about) or silently leave the newer fields as garbage.
2022-05-07 08:49:02 -07:00
Chris Robinson
10e863d1b4 Avoid a deprecated PipeWire function
Building against 0.3.50 or newer will require that version or newer at runtime.
Building against a version before 0.3.50 will work with newer versions.
2022-05-06 12:46:36 -07:00
Chris Robinson
de33f4968c Fix CoreAudio audio unit element values for capture 2022-05-02 05:17:22 -07:00
Chris Robinson
d9fe5a11cd Reset the ringbuffer when stopping OpenSL playback 2022-04-26 23:42:23 -07:00
Chris Robinson
593966c8db Handle 3D7.1 as a separate channel configuration
It's treated as 5.1 + 2 aux channels. This allows AL_DIRECT_CHANNELS_SOFT to
behave better, not forwarding rear left/right channel inputs to lower front and
upper rear, and allows reporting a more appropriate output mode to the app
instead of 7.1.
2022-04-26 23:32:15 -07:00
Chris Robinson
2fb7538f68 Clear capture buffers before enqueueing them with OpenSL 2022-04-08 21:46:30 -07:00
Chris Robinson
a42fe862c5 Keep track of uncaptured samples with the Oboe backend
Stopping Oboe capture drops uncaptured samples, whereas OpenAL keeps them. Also
make sure the reported available count doesn't go backwards without reading.
2022-04-06 21:53:26 -07:00
Chris Robinson
325c992bea Avoid a shadow declaration warning 2022-03-30 01:25:36 -07:00
Chris Robinson
357fb467fe Define the CoreAudio default name only when needed 2022-02-23 02:26:25 -08:00
Chris Robinson
cadf0d1de5 Make some local constexpr variables static 2022-02-23 01:29:28 -08:00
Chris Robinson
d06ed618d3 Avoid using an if_constexpr macro
It doesn't actually use if constexpr, and compilers are smart enough to
optimize. Some functions can use templates instead.
2022-02-22 03:03:44 -08:00
Chris Robinson
6c643e59e9 Make a couple more operator bools explicit 2022-02-20 22:04:19 -08:00
Chris Robinson
a9974d3aa8 Trace the actual device form factor in pipewire 2022-02-16 00:04:11 -08:00
Chris Robinson
fba14feab7 Don't trace ignored pipewire stream nodes 2022-02-15 18:30:42 -08:00
Chris Robinson
ff54ed0fce Reset mIs51Rear only when updating the channel config 2022-02-15 17:30:07 -08:00
Chris Robinson
0493085ea2 Log when a pipewire device is removed 2022-02-15 17:24:20 -08:00
Chris Robinson
30c5c43e56 Mark another operator bool as explicit 2022-02-15 06:27:27 -08:00
Chris Robinson
4c322e186e Add some common wrapper methods to ThreadMainloop 2022-01-26 17:02:33 -08:00
Chris Robinson
0409180bb5 Default the PipeWire lock's operator= instead of using the base 2022-01-26 15:07:54 -08:00
Chris Robinson
537aa2f442 Handle 5.1 using rear channels with PulseAudio and PipeWire 2022-01-25 21:18:39 -08:00
Chris Robinson
4967c7f93c Move some definitions to where they're used 2022-01-24 21:57:08 -08:00
Chris Robinson
3a02ba32e8 Avoid a messy while loop to remove from a vector 2022-01-22 23:18:19 -08:00
Chris Robinson
5d6a2d0433 Restructure the PipeWire backend code a bit
Make some functions into class member functions, and move related declarations
closer together.
2022-01-22 22:27:07 -08:00
Chris Robinson
c28ae87bb4 Avoid holding a pw_proxy, hold the type it represents 2022-01-22 20:08:59 -08:00
Chris Robinson
d48042adea Handle duplex devices with PipeWire 2022-01-22 11:07:38 -08:00
Chris Robinson
561f50b3a3 Load the PipeWire real-time configuration
This is apparently needed to ensure RT threads get RT priority, separately from
requesting RT processing.
2022-01-17 17:16:58 -08:00
Chris Robinson
1337f050dd Avoid a static-sized char array on the stack 2021-12-31 20:23:30 -08:00
Chris Robinson
2750571411 Avoid some unnecessary copying 2021-12-31 13:23:10 -08:00
Chris Robinson
e7d312c404 Some more restructuring of the PipeWire backend 2021-12-30 21:35:55 -08:00
Chris Robinson
7c4d263406 Set the node rate for the pipewire capture stream too 2021-12-29 07:51:15 -08:00
Chris Robinson
5f4690a1b0 Move some constexpr variables to where they're used 2021-12-28 21:12:38 -08:00
Chris Robinson
f484782238 C++-ize the PipeWire backend some more
Use unique_ptrs for a few more types to avoid explicit free calls.

Move ThreadMainloop::wait to the unique_lock wrapper that's holding the lock.
Since the mainloop acts as both a lock and condition_variable, passing the lock
to the wait method makes no sense. Also have it optionally take a predicate
functor to dictate when to stop waiting.
2021-12-28 18:53:46 -08:00
Chris Robinson
305201252e Check for audio devices when initializing PipeWire
This isn't great since it can fail when PipeWire is handling audio but no
devices are available at initialization, causing the Pulseaudio or ALSA backend
to be selected instead. Future versions of PipeWire are expected to have a
better way to detect if it's handling audio, but for now this is better than
nothing.

A config option is available for users to have the PipeWire backend be usable
even with no devices at initialization, just in case.
2021-12-25 19:34:12 -08:00
Chris Robinson
21bdea776a Set the PipeWire stream rate
When requesting a non-default rate, this may allow the hardware to run at the
requested rate.
2021-12-16 13:03:13 -08:00
Chris Robinson
834800c817 Downgrade some ERRs to WARNs 2021-11-21 20:29:20 -08:00
Chris Robinson
0c99a6b316 Make the backend pointer part of ALCdevice instead of DeviceBase 2021-11-19 20:04:10 -08:00
Chris Robinson
7062de0337 Handle SPA_CHOICE_None for sample rates from PipeWire 2021-11-14 12:47:06 -08:00
Chris Robinson
eac427dff7 Report unexpected types for the sample rate from PipeWire 2021-11-14 11:43:33 -08:00
Chris Robinson
cf85ffd22f Support "enum" choices for sample rates with PipeWire 2021-11-14 05:58:39 -08:00
Chris Robinson
b81fa0dc90 Don't trace unused metadata properties and node types
As useful as it may sometimes be to see what's being provided, at least under
kwin_wayland a not-insignificant number of video-related nodes and metadata
properties are sent through normal use of the system (most notably when
hovering over the taskbar to see window thumbnails).
2021-10-26 09:40:10 -07:00
Chris Robinson
4de789ba68 Don't change the requested format when it's usable with WASAPI 2021-10-25 06:37:48 -07:00
Chris Robinson
1a448b2e92 Fix a double-release 2021-10-23 07:57:17 -07:00
Chris Robinson
d0e5e138e2 Use a flag to indicate headphone-like output 2021-10-23 07:51:06 -07:00
Chris Robinson
e70f3e97b3 Remove the last external uses of GetConfigValue 2021-10-21 05:54:03 -07:00
Chris Robinson
e3b8f8fe27 Make a construct_at method amd use it 2021-10-08 11:05:36 -07:00
Chris Robinson
c3e2fbef49 Avoid double indirection to access spa_data::datas 2021-10-07 13:36:33 -07:00
Chris Robinson
86abe8dca2 Fix the render step value for WinMM 2021-10-05 03:02:45 -07:00
Chris Robinson
53d9033ec7 Remove a couple unnecessary variables 2021-10-03 06:48:00 -07:00