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

1567 Коммитов

Автор SHA1 Сообщение Дата
Paul Adenot e479f4268d Use a constant instead of a define. 2020-11-02 15:37:29 +00:00
Paul Adenot 2b73ea65a3 Capitalize enums, as it's done elsewhere. 2020-11-02 15:37:29 +00:00
Paul Adenot f61dd1ebea Tell GTest that RTTI is not available for clang (for other compilers it's automatically detected) 2020-10-30 16:38:43 +00:00
Paul Adenot 5a76f201ec Don't use exception in the new cubeb_aaudio.cpp, and don't build with exception or RTTI 2020-10-30 16:38:43 +00:00
nyorain 05e27634df Fix rebase for new latency method 2020-10-28 16:55:14 +00:00
nyorain bb6e83cadb aaudio: Make sure to completely cleanup streams 2020-10-28 16:55:14 +00:00
nyorain 0209aec788 Add minor documentation and logs 2020-10-28 16:55:14 +00:00
nyorain 9183f2e654 Move aaudio backend to C++ & enable low latency 2020-10-28 16:55:14 +00:00
nyorain 9905226379 AAudio: Address first review comments 2020-10-28 16:55:14 +00:00
nyorain 4480be2939 AAudio: destroy pthread_condattr 2020-10-28 16:55:14 +00:00
nyorain 3a5831fac3 AAudio: Fix codestyle 2020-10-28 16:55:14 +00:00
nyorain 706c533829 AAudio: Fix cv clock for android < 21 2020-10-28 16:55:14 +00:00
nyorain 687fa39311 AAudio: Use condition variable instead of sleeping
This removes the constant checking for state changes with
5ms of sleep in between for the state thread.
We need a new thread to wakeup the state thread reliably
without blocking in the audio thread. For a more detailed
and theoretical explanation of the problem and solution (specifically
written for this commit), see:
https://nyorain.github.io/lock-free-wakeup.html

Now, will only do this time-based sleeping when actively waiting
for a state change. We can't implement that with a blocking call to
AAudioStream_waitForStateChange since that can't be woken up
and we furthermore might have to wait for multiple streams at once.
This also fixes some issues and race conditions with stream destruction
and adds some more documentation.
2020-10-28 16:55:14 +00:00
nyorain efae368bcf AAudio: Implement stream_set_volume 2020-10-28 16:55:14 +00:00
nyorain 3c316f4ed2 AAudio: don't send stopped state after draining 2020-10-28 16:55:14 +00:00
nyorain 314a9d3bcb Add android level with aaudio to CI 2020-10-28 16:55:14 +00:00
nyorain 767c2891f1 Remove pthread from libraries on android 2020-10-28 16:55:14 +00:00
nyorain 3ca17774d2 Fix codestyle 2020-10-28 16:55:14 +00:00
nyorain b3e3e2af0a Add first AAudio backend prototype 2020-10-28 16:55:14 +00:00
Paul Adenot 1d66483ad2 Remove add_latency from resampling code, it's not used 2020-10-20 14:23:23 +01:00
Paul Adenot 2c385dc16d Don't add initial delay to resamplers 2020-10-20 14:23:23 +01:00
Vitor Kiguchi 2575d731d2 Revert "Don't account for unresampled data when computing how much input is needed."
This reverts commit d0127cdb66.
From testing this caused the audio to get out of sync(delayed)
in Citra.
2020-10-20 14:23:23 +01:00
Richard Dodd (dodj) c0adf049c2
Add an option to not automatically connect ports on jack. (#613) 2020-10-19 17:49:40 +02:00
khng300 a7e83aa2b1
Add stream_set_name = null to cubeb_ops structs (#617)
This change is for OSS backend.
2020-10-13 12:05:17 +01:00
khng300 7c9a666c8c
oss: Initialize cubeb_stream::state properly (#618) 2020-10-12 09:44:22 +02:00
khng300 226d383c13
OSS (FreeBSD/illumos) backend (#600)
* ossaudio (FreeBSD currently) backend

The ossaudio backend was rewritten from the sunaudio
backend.

* Fix leaking of mixer_fd in oss_enumerate_devices

* Both input/output can be detected at the same DSP

* Update on device detection during enumeration

* Remove spurious calls to SNDCTL_CARDINFO

* Fix string allocation detection in oss_enumerate_devices

* On FreeBSD, try to open and probe the device's capability in oss_enumerate_devices

* Rewrite oss_io_routine() to implement correctly for all stream directions

* Add preferred device detection for FreeBSD

* Emits stable devid from oss_enumerate_devices on FreeBSD

* Fix SNDCTL_DSP_GETI/OSPACE calls in oss_stream_init

* Use /dev/sndstat instead on FreeBSD for oss_enumerate_devices

* Unify both play and record nfr and take the minimum value between them

* Fix allocating both input/output buffers to input/output-only streams

* Fix clipping issue

* Fix misuse of input_device and output_device in oss_stream_init

* Fix builds on Illumos

* Code refactoring on oss_enumerate_devices

* Improve oss_io_routine for the case when the stream is in both direction

* Use fragsize instead of total buffer size for number of frames

* Probe OSS audio availability in cubeb_init when backend is not specified

* Fix scan-build10 report on src/cubeb_oss.c:285

* Add __DragonFly__ pp macro testing along-side __FreeBSD__

* Move oss_init in default_init[] table right below alsa to respect POLA

* Fix use-after-free of s->mutex in oss_stream_destroy

* Fix inconsistent indentation

* Remove blocks_written from cubeb_stream

* Add LL integer suffix to make 0x80000000 more clear

* Add parsing of /dev/sndstat for hw.snd.verbose > 0 in FreeBSD

* Do device setup in the order of channels, format and speed, according to developer/callorder.html of OSS v4.x API reference

* Add proper latency_frame support for oss_stream_init

* Mark close brackets and close braces NUL in oss_sndstat_line_parse

* Search close brackets and close braces from the end of line in oss_sndstat_line_parse

* Use 32 frames for each fragments in oss_calc_frag_params

* Drop unnecessary #include <sys/sysctl.h>

* Add support for cubeb_channel_layout

* Compilation and scan-build fixes:

* Fix warnings in oss_chn_from_cubeb
* Include cubeb_mixer.h to have cubeb_channel_layout_nb_channels
* Fix potential resource leakage in input_stream_layout->layout does not
match input_stream_params->channels. (The same for
		output_stream_layout)
* Classify cubeb_stream_params::layout and cubeb_stream_params::channels
mismatch as CUBEB_ERROR_INVALID_PARAMETER

* AUDIODEVICE can now override /dev/dsp

AUDIODEVICE was chosen to match the sndio backend.

* Change environment variable AUDIODEVICE to AUDIO_DEVICE in oss backend

* Change the format of cubeb_device_info's friendly_name

This avoids name collision when setting media.cubeb.output_device in
about:config of Firefox. However, I think it makes more sense on
Firefox's side to use device_id instead.

* Fix warning of a missing %d in LOG() in oss_io_routine

* Do not enable OSS compilation when SOUND_VERSION < 0x040000

* Add mutex to serialize access to cubeb_strings in cubeb_oss's cubeb_context

* Change the calculation of fragsize/nfr to match stream latency, with 2 fragments available. By HPS

* Now reuse the same thread for audiostream

* Redo the duplex logic

* Restructure the use of buffers

* Fix problems dealing with draining

* Revert "Fix problems dealing with draining"

This reverts commit 30301ba101.

* Revert "Restructure the use of buffers"

This reverts commit 9823ca889c.

* Revert "Revert "Restructure the use of buffers""

This reverts commit 10dc869b85.

* Revert "Revert "Fix problems dealing with draining""

This reverts commit 9d19b10944.

* Make sure there are at least s->nfr available before calling data_cb

* Kill a signed/unsigned comparison

* Add The FreeBSD Foundation copyright line for recent commits

* Fix race condition when restarting a stream by HPS

Originally, when stopping a stream and immediately starting the stream
again, the start call might be lost.

* Do not signal the doorbell_cv again when a stream is already stopped

This is redundant.

* Revert "Do not signal the doorbell_cv again when a stream is already stopped"

This reverts commit fbdf753fc7.

* Make state changes look more similar to pulse backend

This also allows drained/short-input stream to be resumed without
stopping it first.

* Remove a spurious s->running = false
2020-10-09 19:09:39 +02:00
Admiral H. Curtiss dce06b123d Add stream preference to request a persistent stream session and implement this in WASAPI. 2020-10-09 19:03:50 +02:00
Paul Adenot 8d596fee96 Address review comments 2020-10-07 18:11:16 +02:00
Paul Adenot 3fbbc67bb1 Don't use AUDCLNT_STREAMOPTIONS_RAW on MinGW, it's not defined yet.
This is proposed in https://www.mail-archive.com/mingw-w64-public@lists.sourceforge.net/msg17678.html, but not merged yet it seems.
2020-10-07 18:11:16 +02:00
Paul Adenot b33659d9be Make RAW WASAPI streams opt-in 2020-10-07 18:11:16 +02:00
Paul Adenot 2141a1e08b Pass in AUDCLNT_STREAMOPTIONS_RAW when possible when initializing an AudioClient 2020-10-07 18:11:16 +02:00
Paul Adenot 970e118e4b Require at least the windows 8.1 SDK for building cubeb 2020-10-07 18:11:16 +02:00
Brendan Early 01e0997c75 Add stream_set_name = null to cubeb_ops structs 2020-10-07 11:27:54 +13:00
Brendan Early 2e842a01f7 Add method to change stream name 2020-10-07 11:27:54 +13:00
Guillaume Besson 082ba33d12 Fix CMake rust path and only use rust deps if needed 2020-09-28 14:23:32 +02:00
Zoë Sparks 1d480fafaa jack: Add functions to connect a cb+phys port pair
Ameliorates code duplication in cbjack_connect_ports().
2020-09-28 14:19:32 +02:00
Zoë Sparks dafe69a653 jack: Special case playing mono source in stereo 2020-09-28 14:19:32 +02:00
Paul Adenot 1358724f73 Fix wasapi_destroy_device usage, when it fails, in setup_wasapi_stream 2020-09-22 11:09:51 +02:00
Paul Adenot 698665d3ab Clarify and fix expectations around wasapi_create_device 2020-09-22 11:09:51 +02:00
Paul Adenot 660864ede5 Address review comments 2020-09-21 19:36:43 +02:00
Paul Adenot 9820ea03bf Add a test case for WASAPI reconfigure event 2020-09-21 19:36:43 +02:00
Paul Adenot b66d91554b Always return a valid string (possibly empty) for the group_id and the friendly_name in the WASAPI backend 2020-09-17 14:07:31 +02:00
Paul Adenot 61293b23d3 Always brace if statements in wasapi_create_device 2020-09-17 14:07:31 +02:00
Paul Adenot a45f6d072f Reset device when reconfiguring stream 2020-09-15 17:00:40 +02:00
Angelo Haller f4c3197894 Fix integer underflow/unsigned wrapping.
The number of xrun fragments to skip is added once to ctx->jack_xruns but
then subtracted multiple times (once for each stream) from the same variable.
This causes the unsigned int to "underflow" and wrap around.

- Use unsigned int in all calculations instead of mixing un/signed.
- Remove erroneous and useless subtraction logic
- Replace for loop by simple multiplication
- Remove unneeded casts to float
2020-09-14 11:06:11 +02:00
Paul Adenot f39ce8a726 Fix printf format 2020-09-11 15:06:44 +02:00
Paul Adenot d01d6f1149 Consistently use frames for latency requests 2020-09-09 14:30:03 +02:00
Paul Adenot 7965ea3cac Clean up the cubeb_device_info when checking if the device is a bluetooth handsfree device 2020-09-09 14:30:03 +02:00
Paul Adenot c6789286af Assert that the temporary stack buffer used to prefill the resampler are big enough 2020-09-09 14:30:03 +02:00
Paul Adenot c7fe95cca4 Only perform device matching when using a bluetooth handsfree device 2020-09-09 14:30:03 +02:00