* Don't change `output_device_id` once it's set
* Fallback to use default device only when not specifying a device
We should only fallback to use default device if the user doesn't
ask to use a particular device.
* Follow default device changes only when using default device explicitly
We should get the default device change notifications only when users
ask to follow the default devices.
* Don't reinit stream when user-selected device is unplugged
If the user specifies a device explicitly, don't switch device for
the stream when the selected device is gone. We should fire an error
callback instead.
* Rename `picked_output_device_id` to `selected_output_device_id`
* Rename fallbackable to allow_fallback
* Correct the comments
* Fix double free problem
unique_ptr can not be initialized from another unique_ptr's raw pointer,
otherwise we will free the pointee twice!
* Add an util to copy wide-char string
* Prefer move
This might be overkilled, but it expresses the intention clearly
We should not always reset the device when the current device is unplugged.
The device reset or not should follow the
CUBEB_STREAM_PREF_DISABLE_DEVICE_SWITCHING pref.
Instead of changing `stm->output_device_id` in the `wasapi_find_bt_handsfree_output_device`,
setting it in `setup_wasapi_stream` makes all `stm->output_device_id` updates in the same place
Some systems offer OSS v4 but do not have BSD-only functions like
strlcpy, used in cubeb_oss.c. An example is Debian GNU/kFreeBSD, that
uses a FreeBSD kernel with GNU userspace utilities, like glibc.
With this patch cubeb will be able to build on these systems thanks to
the help of libbsd, that privides most libc functions that you would
expect on BSD.
Also when the latency is specified to be very big.
This might be a bug in some upper layer, although I see
other cubeb audio drivers doing the same.
This "fixes" audio sync with youtube videos.
When computing the maximum buffer size the "fragstotal" field should be
used instead of "fragments" field. For recording the "fragments" field
usually returns zero, so then no recorded audio may be received.
While at it remove the not used "nfr" and "nfrags" fields from the
oss_stream structure and use "bufframes" instead.
The hardware buffer is typically bigger than the software buffer.
Make sure to properly limit the available buffer size values
obtained from the DSP device.
While at it ensure to retry-polling in case either recording or
playback cannot move any data.
The change is to reduce the number of dropped frames when playing
YouTube videos. The most significant part is to set trigger threshold
to be low enough, such that as long as the audio hardware's DMA engine
moves data the callback is triggered without waiting longer. Besides
that, unify oss_wait_*fd_for_space() for both directions into a single
function. Buffer size is also not required to match the other
direction.
Sponsored by: The FreeBSD Foundation
These are minor cleanups that do not affect the behaviour of the script.
In particular, I removed most `DESTINATION` arguments from `install()`,
since they are automatically deduced based on the type of file to be
installed.
In #662 I also added doxygen_add_docs and gtest_discover_tests, but they
require CMake version 3.9 and 3.10 respectively, and I think that the
advantages they provide are not worth dropping support for older versions
Following
https://github.com/mozilla/cubeb/issues/658#issuecomment-955998734, the
speex library is now handled like a normal dependency: cubeb will link
against the system version if available, and fall back to the bundled
one if not.
I've also added a BUNDLE_SPEEX option, so that you can force the use of
the bundled library if needed (e.g. creating a standalone libcubeb on a
system where libspeex is available).
I also had to move the bundled library to a separate folder. As `src` is
always added as an include path, the headers in `src/speex` would
conflict with system headers. And it also clears the relationship
between cubeb and speex. I choose the "subprojects" name to follow the
Meson convention, since CMake does not have one. A bit OT, but if you're
curious you can see their rationale here:
https://mesonbuild.com/Subprojects.html#why-must-all-subprojects-be-inside-a-single-directory
Lastly, I added cubeb_log.cpp to the list of sources of test_resampler,
as I was getting linking errors when building with BUILD_SHARED_LIBS=true
Fixes#658
This is useful to users who can't recursively clone the repo or that
simply want to build the project from the downloadable tarball (like
Linux distributions, for example)
Users can now disable the lazy loading of libraries, and use classic
linkage instead.
Previously, cubeb would link with threads only if using some backends.
This caused linking issues when no backends were active, because cubeb
wasn't linked against pthread or similar, while the library is needed by
src/cubeb_log.cpp, as it uses std::thread.
#cleanup