Bug 1874909 - Update all cubeb libraries to include input processing. r=cubeb-reviewers,supply-chain-reviewers,padenot

This patch updates
media/libcubeb to dd8a91f98260d2c6171a7cf8a73f8fd4bdbb5337 which includes an ABI change, thus also
cubeb-rs to 0.12.0
audioipc to 8b391135f9421dc5ab0c45f646c21651a906ce7f
cubeb-coreaudio-rs to a0534f6e910213fd4f7387a9ed03c980ff20da1d
cubeb-pulse-rs to 8ff972c8e2ec1782ff262ac4071c0415e69b1367

Depends on D198762

Differential Revision: https://phabricator.services.mozilla.com/D198933
This commit is contained in:
Andreas Pehrson 2024-01-24 10:51:27 +00:00
Родитель 0b17172731
Коммит 91e4965cfd
71 изменённых файлов: 688 добавлений и 122 удалений

Просмотреть файл

@ -60,19 +60,19 @@ git = "https://github.com/mozilla/application-services"
rev = "63a6260c14847c21c5a1fa3003efaf0114a3e4e5"
replace-with = "vendored-sources"
[source."git+https://github.com/mozilla/audioipc?rev=44fbcd2b5417f8b5ff4907eec17b32a0fb633e03"]
[source."git+https://github.com/mozilla/audioipc?rev=8b391135f9421dc5ab0c45f646c21651a906ce7f"]
git = "https://github.com/mozilla/audioipc"
rev = "44fbcd2b5417f8b5ff4907eec17b32a0fb633e03"
rev = "8b391135f9421dc5ab0c45f646c21651a906ce7f"
replace-with = "vendored-sources"
[source."git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=89abc256a2eab3398f880e114b2d8308f5bc1d1a"]
[source."git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=a0534f6e910213fd4f7387a9ed03c980ff20da1d"]
git = "https://github.com/mozilla/cubeb-coreaudio-rs"
rev = "89abc256a2eab3398f880e114b2d8308f5bc1d1a"
rev = "a0534f6e910213fd4f7387a9ed03c980ff20da1d"
replace-with = "vendored-sources"
[source."git+https://github.com/mozilla/cubeb-pulse-rs?rev=c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8"]
[source."git+https://github.com/mozilla/cubeb-pulse-rs?rev=8ff972c8e2ec1782ff262ac4071c0415e69b1367"]
git = "https://github.com/mozilla/cubeb-pulse-rs"
rev = "c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8"
rev = "8ff972c8e2ec1782ff262ac4071c0415e69b1367"
replace-with = "vendored-sources"
[source."git+https://github.com/mozilla/midir.git?rev=85156e360a37d851734118104619f86bd18e94c6"]

40
Cargo.lock сгенерированный
Просмотреть файл

@ -249,8 +249,8 @@ dependencies = [
[[package]]
name = "audioipc2"
version = "0.5.0"
source = "git+https://github.com/mozilla/audioipc?rev=44fbcd2b5417f8b5ff4907eec17b32a0fb633e03#44fbcd2b5417f8b5ff4907eec17b32a0fb633e03"
version = "0.6.0"
source = "git+https://github.com/mozilla/audioipc?rev=8b391135f9421dc5ab0c45f646c21651a906ce7f#8b391135f9421dc5ab0c45f646c21651a906ce7f"
dependencies = [
"arrayvec",
"ashmem",
@ -277,8 +277,8 @@ dependencies = [
[[package]]
name = "audioipc2-client"
version = "0.5.0"
source = "git+https://github.com/mozilla/audioipc?rev=44fbcd2b5417f8b5ff4907eec17b32a0fb633e03#44fbcd2b5417f8b5ff4907eec17b32a0fb633e03"
version = "0.6.0"
source = "git+https://github.com/mozilla/audioipc?rev=8b391135f9421dc5ab0c45f646c21651a906ce7f#8b391135f9421dc5ab0c45f646c21651a906ce7f"
dependencies = [
"audio_thread_priority",
"audioipc2",
@ -288,8 +288,8 @@ dependencies = [
[[package]]
name = "audioipc2-server"
version = "0.5.0"
source = "git+https://github.com/mozilla/audioipc?rev=44fbcd2b5417f8b5ff4907eec17b32a0fb633e03#44fbcd2b5417f8b5ff4907eec17b32a0fb633e03"
version = "0.6.0"
source = "git+https://github.com/mozilla/audioipc?rev=8b391135f9421dc5ab0c45f646c21651a906ce7f#8b391135f9421dc5ab0c45f646c21651a906ce7f"
dependencies = [
"audio_thread_priority",
"audioipc2",
@ -906,7 +906,7 @@ dependencies = [
[[package]]
name = "coreaudio-sys-utils"
version = "0.1.0"
source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=89abc256a2eab3398f880e114b2d8308f5bc1d1a#89abc256a2eab3398f880e114b2d8308f5bc1d1a"
source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=a0534f6e910213fd4f7387a9ed03c980ff20da1d#a0534f6e910213fd4f7387a9ed03c980ff20da1d"
dependencies = [
"core-foundation-sys",
"coreaudio-sys",
@ -1088,27 +1088,27 @@ dependencies = [
[[package]]
name = "cubeb"
version = "0.10.3"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7725c00f234bd83ebd8a5c0165a0856bb6414d9161b86cbb559250c94d8a4285"
checksum = "6db57570f2617f0214c11721e8d2325816d9dc936c2c472661ac5d90a30fba98"
dependencies = [
"cubeb-core",
]
[[package]]
name = "cubeb-backend"
version = "0.10.7"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3154aa90b995f098f7fade918a903c13e2c6acb96da7afed160c537f8ed29611"
checksum = "b00b0f3b84e315571bd8c4e18794180633066267a413f2f05bca65001adc8410"
dependencies = [
"cubeb-core",
]
[[package]]
name = "cubeb-core"
version = "0.10.7"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da324c1b1487b3fe7b4048b2c797ddde9375e6cf72fb8b15ccdaf598182415b5"
checksum = "2380c03a7df0ea3744f6a210d6340f423935e53cbf2fd68ada84b5e808e46ac7"
dependencies = [
"bitflags 1.999.999",
"cubeb-sys",
@ -1117,7 +1117,7 @@ dependencies = [
[[package]]
name = "cubeb-coreaudio"
version = "0.1.0"
source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=89abc256a2eab3398f880e114b2d8308f5bc1d1a#89abc256a2eab3398f880e114b2d8308f5bc1d1a"
source = "git+https://github.com/mozilla/cubeb-coreaudio-rs?rev=a0534f6e910213fd4f7387a9ed03c980ff20da1d#a0534f6e910213fd4f7387a9ed03c980ff20da1d"
dependencies = [
"atomic",
"audio-mixer",
@ -1134,8 +1134,8 @@ dependencies = [
[[package]]
name = "cubeb-pulse"
version = "0.4.2"
source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8#c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8"
version = "0.5.0"
source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=8ff972c8e2ec1782ff262ac4071c0415e69b1367#8ff972c8e2ec1782ff262ac4071c0415e69b1367"
dependencies = [
"cubeb-backend",
"pulse",
@ -1146,9 +1146,9 @@ dependencies = [
[[package]]
name = "cubeb-sys"
version = "0.10.7"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d028653f6b56c3b4af6dcc9adc35941e7433494bf29d1f69518a247db5a1cc8f"
checksum = "3c20c457d7b34dad6e0c1a9c759c96b4420b9e9917a572998b81835799a07e1d"
dependencies = [
"cmake",
"pkg-config",
@ -4486,7 +4486,7 @@ dependencies = [
[[package]]
name = "pulse"
version = "0.3.0"
source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8#c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8"
source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=8ff972c8e2ec1782ff262ac4071c0415e69b1367#8ff972c8e2ec1782ff262ac4071c0415e69b1367"
dependencies = [
"bitflags 2.4.0",
"pulse-ffi",
@ -4495,7 +4495,7 @@ dependencies = [
[[package]]
name = "pulse-ffi"
version = "0.1.0"
source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8#c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8"
source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=8ff972c8e2ec1782ff262ac4071c0415e69b1367#8ff972c8e2ec1782ff262ac4071c0415e69b1367"
dependencies = [
"libc",
]

Просмотреть файл

@ -258,6 +258,18 @@ typedef enum {
the jack backend. */
} cubeb_stream_prefs;
/**
* Input stream audio processing parameters. Only applicable with
* CUBEB_STREAM_PREF_VOICE.
*/
typedef enum {
CUBEB_INPUT_PROCESSING_PARAM_NONE = 0x00,
CUBEB_INPUT_PROCESSING_PARAM_ECHO_CANCELLATION = 0x01,
CUBEB_INPUT_PROCESSING_PARAM_NOISE_SUPPRESSION = 0x02,
CUBEB_INPUT_PROCESSING_PARAM_AUTOMATIC_GAIN_CONTROL = 0x04,
CUBEB_INPUT_PROCESSING_PARAM_VOICE_ISOLATION = 0x08,
} cubeb_input_processing_params;
/** Stream format initialization parameters. */
typedef struct {
cubeb_sample_format format; /**< Requested sample format. One of
@ -514,6 +526,18 @@ cubeb_get_min_latency(cubeb * context, cubeb_stream_params * params,
CUBEB_EXPORT int
cubeb_get_preferred_sample_rate(cubeb * context, uint32_t * rate);
/** Get the supported input processing features for this backend. See
cubeb_stream_set_input_processing for how to set them for a particular input
stream.
@param context A pointer to the cubeb context.
@param params Out parameter for the input processing params supported by
this backend.
@retval CUBEB_OK
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_get_supported_input_processing_params(
cubeb * context, cubeb_input_processing_params * params);
/** Destroy an application context. This must be called after all stream have
* been destroyed.
@param context A pointer to the cubeb context.*/
@ -641,6 +665,30 @@ CUBEB_EXPORT int
cubeb_stream_get_current_device(cubeb_stream * stm,
cubeb_device ** const device);
/** Set input mute state for this stream. Some platforms notify the user when an
application is accessing audio input. When all inputs are muted they can
prove to the user that the application is not actively capturing any input.
@param stream the stream for which to set input mute state
@param muted whether the input should mute or not
@retval CUBEB_OK
@retval CUBEB_ERROR_INVALID_PARAMETER if this stream does not have an input
device
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_set_input_mute(cubeb_stream * stream, int mute);
/** Set what input processing features to enable for this stream.
@param stream the stream for which to set input processing features.
@param params what input processing features to use
@retval CUBEB_OK
@retval CUBEB_ERROR if params could not be applied
@retval CUBEB_ERROR_INVALID_PARAMETER if a given param is not supported by
this backend, or if this stream does not have an input device
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_set_input_processing_params(cubeb_stream * stream,
cubeb_input_processing_params params);
/** Destroy a cubeb_device structure.
@param stream the stream passed in cubeb_stream_get_current_device
@param devices the devices to destroy

Просмотреть файл

@ -9,8 +9,8 @@ origin:
description: "Cross platform audio library"
url: https://github.com/mozilla/cubeb
license: ISC
release: 54217bca3f3e0cd53c073690a23dd25d83557909 (2023-11-21T10:08:34Z).
revision: 54217bca3f3e0cd53c073690a23dd25d83557909
release: dd8a91f98260d2c6171a7cf8a73f8fd4bdbb5337 (2024-01-15T14:25:40Z).
revision: dd8a91f98260d2c6171a7cf8a73f8fd4bdbb5337
vendoring:
url: https://github.com/mozilla/cubeb

Просмотреть файл

@ -40,6 +40,8 @@ struct cubeb_ops {
int (*get_min_latency)(cubeb * context, cubeb_stream_params params,
uint32_t * latency_ms);
int (*get_preferred_sample_rate)(cubeb * context, uint32_t * rate);
int (*get_supported_input_processing_params)(
cubeb * context, cubeb_input_processing_params * params);
int (*enumerate_devices)(cubeb * context, cubeb_device_type type,
cubeb_device_collection * collection);
int (*device_collection_destroy)(cubeb * context,
@ -62,6 +64,9 @@ struct cubeb_ops {
int (*stream_set_name)(cubeb_stream * stream, char const * stream_name);
int (*stream_get_current_device)(cubeb_stream * stream,
cubeb_device ** const device);
int (*stream_set_input_mute)(cubeb_stream * stream, int mute);
int (*stream_set_input_processing_params)(
cubeb_stream * stream, cubeb_input_processing_params params);
int (*stream_device_destroy)(cubeb_stream * stream, cubeb_device * device);
int (*stream_register_device_changed_callback)(
cubeb_stream * stream,

Просмотреть файл

@ -341,6 +341,21 @@ cubeb_get_preferred_sample_rate(cubeb * context, uint32_t * rate)
return context->ops->get_preferred_sample_rate(context, rate);
}
int
cubeb_get_supported_input_processing_params(
cubeb * context, cubeb_input_processing_params * params)
{
if (!context || !params) {
return CUBEB_ERROR_INVALID_PARAMETER;
}
if (!context->ops->get_supported_input_processing_params) {
return CUBEB_ERROR_NOT_SUPPORTED;
}
return context->ops->get_supported_input_processing_params(context, params);
}
void
cubeb_destroy(cubeb * context)
{
@ -500,6 +515,36 @@ cubeb_stream_get_current_device(cubeb_stream * stream,
return stream->context->ops->stream_get_current_device(stream, device);
}
int
cubeb_stream_set_input_mute(cubeb_stream * stream, int mute)
{
if (!stream) {
return CUBEB_ERROR_INVALID_PARAMETER;
}
if (!stream->context->ops->stream_set_input_mute) {
return CUBEB_ERROR_NOT_SUPPORTED;
}
return stream->context->ops->stream_set_input_mute(stream, mute);
}
int
cubeb_stream_set_input_processing_params(cubeb_stream * stream,
cubeb_input_processing_params params)
{
if (!stream || !params) {
return CUBEB_ERROR_INVALID_PARAMETER;
}
if (!stream->context->ops->stream_set_input_processing_params) {
return CUBEB_ERROR_NOT_SUPPORTED;
}
return stream->context->ops->stream_set_input_processing_params(stream,
params);
}
int
cubeb_stream_device_destroy(cubeb_stream * stream, cubeb_device * device)
{

Просмотреть файл

@ -1737,6 +1737,7 @@ const static struct cubeb_ops aaudio_ops = {
/*.get_max_channel_count =*/aaudio_get_max_channel_count,
/* .get_min_latency =*/aaudio_get_min_latency,
/*.get_preferred_sample_rate =*/aaudio_get_preferred_sample_rate,
/*.get_supported_input_processing_params =*/nullptr,
/*.enumerate_devices =*/nullptr,
/*.device_collection_destroy =*/nullptr,
/*.destroy =*/aaudio_destroy,
@ -1750,6 +1751,8 @@ const static struct cubeb_ops aaudio_ops = {
/*.stream_set_volume =*/aaudio_stream_set_volume,
/*.stream_set_name =*/nullptr,
/*.stream_get_current_device =*/nullptr,
/*.stream_set_input_mute =*/nullptr,
/*.stream_set_input_processing_params =*/nullptr,
/*.stream_device_destroy =*/nullptr,
/*.stream_register_device_changed_callback =*/nullptr,
/*.register_device_collection_changed =*/nullptr};

Просмотреть файл

@ -1472,6 +1472,7 @@ static struct cubeb_ops const alsa_ops = {
.get_max_channel_count = alsa_get_max_channel_count,
.get_min_latency = alsa_get_min_latency,
.get_preferred_sample_rate = alsa_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = alsa_enumerate_devices,
.device_collection_destroy = alsa_device_collection_destroy,
.destroy = alsa_destroy,
@ -1485,6 +1486,8 @@ static struct cubeb_ops const alsa_ops = {
.stream_set_volume = alsa_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = NULL,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = NULL,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};

Просмотреть файл

@ -3665,6 +3665,7 @@ cubeb_ops const audiounit_ops = {
/*.get_max_channel_count =*/audiounit_get_max_channel_count,
/*.get_min_latency =*/audiounit_get_min_latency,
/*.get_preferred_sample_rate =*/audiounit_get_preferred_sample_rate,
/*.get_supported_input_processing_params =*/NULL,
/*.enumerate_devices =*/audiounit_enumerate_devices,
/*.device_collection_destroy =*/audiounit_device_collection_destroy,
/*.destroy =*/audiounit_destroy,
@ -3678,6 +3679,8 @@ cubeb_ops const audiounit_ops = {
/*.stream_set_volume =*/audiounit_stream_set_volume,
/*.stream_set_name =*/NULL,
/*.stream_get_current_device =*/audiounit_stream_get_current_device,
/*.stream_set_input_mute =*/NULL,
/*.stream_set_input_processing_params =*/NULL,
/*.stream_device_destroy =*/audiounit_stream_device_destroy,
/*.stream_register_device_changed_callback =*/
audiounit_stream_register_device_changed_callback,

Просмотреть файл

@ -160,6 +160,7 @@ static struct cubeb_ops const cbjack_ops = {
.get_max_channel_count = cbjack_get_max_channel_count,
.get_min_latency = cbjack_get_min_latency,
.get_preferred_sample_rate = cbjack_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = cbjack_enumerate_devices,
.device_collection_destroy = cbjack_device_collection_destroy,
.destroy = cbjack_destroy,
@ -173,6 +174,8 @@ static struct cubeb_ops const cbjack_ops = {
.stream_set_volume = cbjack_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = cbjack_stream_get_current_device,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = cbjack_stream_device_destroy,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};
@ -431,8 +434,10 @@ cbjack_process(jack_nframes_t nframes, void * arg)
if (stm->devs & OUT_ONLY) {
for (unsigned int c = 0; c < stm->out_params.channels; c++) {
float * buffer_out = bufs_out[c];
for (long f = 0; f < nframes; f++) {
buffer_out[f] = 0.f;
if (buffer_out) {
for (long f = 0; f < nframes; f++) {
buffer_out[f] = 0.f;
}
}
}
}
@ -440,8 +445,10 @@ cbjack_process(jack_nframes_t nframes, void * arg)
// paused, capture silence
for (unsigned int c = 0; c < stm->in_params.channels; c++) {
float * buffer_in = bufs_in[c];
for (long f = 0; f < nframes; f++) {
buffer_in[f] = 0.f;
if (buffer_in) {
for (long f = 0; f < nframes; f++) {
buffer_in[f] = 0.f;
}
}
}
}
@ -493,8 +500,10 @@ cbjack_process(jack_nframes_t nframes, void * arg)
if (stm->devs & OUT_ONLY) {
for (unsigned int c = 0; c < stm->out_params.channels; c++) {
float * buffer_out = bufs_out[c];
for (long f = 0; f < nframes; f++) {
buffer_out[f] = 0.f;
if (buffer_out) {
for (long f = 0; f < nframes; f++) {
buffer_out[f] = 0.f;
}
}
}
}
@ -502,8 +511,10 @@ cbjack_process(jack_nframes_t nframes, void * arg)
// capture silence
for (unsigned int c = 0; c < stm->in_params.channels; c++) {
float * buffer_in = bufs_in[c];
for (long f = 0; f < nframes; f++) {
buffer_in[f] = 0.f;
if (buffer_in) {
for (long f = 0; f < nframes; f++) {
buffer_in[f] = 0.f;
}
}
}
}
@ -542,20 +553,26 @@ cbjack_deinterleave_playback_refill_float(cubeb_stream * stream, float ** in,
for (unsigned int c = 0; c < stream->out_params.channels; c++) {
float * buffer = bufs_out[c];
for (long f = 0; f < done_frames; f++) {
buffer[f] =
out_interleaved_buffer[(f * stream->out_params.channels) + c] *
stream->volume;
if (buffer) {
buffer[f] =
out_interleaved_buffer[(f * stream->out_params.channels) + c] *
stream->volume;
}
}
if (done_frames < needed_frames) {
// draining
for (long f = done_frames; f < needed_frames; f++) {
buffer[f] = 0.f;
if (buffer) {
buffer[f] = 0.f;
}
}
}
if (done_frames == 0) {
// stop, but first zero out the existing buffer
for (long f = 0; f < needed_frames; f++) {
buffer[f] = 0.f;
if (buffer) {
buffer[f] = 0.f;
}
}
}
}

Просмотреть файл

@ -1934,6 +1934,7 @@ struct cubeb_ops const opensl_ops = {
.get_max_channel_count = opensl_get_max_channel_count,
.get_min_latency = nullptr,
.get_preferred_sample_rate = nullptr,
.get_supported_input_processing_params = nullptr,
.enumerate_devices = nullptr,
.device_collection_destroy = nullptr,
.destroy = opensl_destroy,
@ -1947,6 +1948,8 @@ struct cubeb_ops const opensl_ops = {
.stream_set_volume = opensl_stream_set_volume,
.stream_set_name = nullptr,
.stream_get_current_device = nullptr,
.stream_set_input_mute = nullptr,
.stream_set_input_processing_params = nullptr,
.stream_device_destroy = nullptr,
.stream_register_device_changed_callback = nullptr,
.register_device_collection_changed = nullptr};

Просмотреть файл

@ -1335,6 +1335,7 @@ static struct cubeb_ops const oss_ops = {
.get_max_channel_count = oss_get_max_channel_count,
.get_min_latency = oss_get_min_latency,
.get_preferred_sample_rate = oss_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = oss_enumerate_devices,
.device_collection_destroy = oss_device_collection_destroy,
.destroy = oss_destroy,
@ -1348,6 +1349,8 @@ static struct cubeb_ops const oss_ops = {
.stream_set_volume = oss_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = oss_get_current_device,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = oss_stream_device_destroy,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};

Просмотреть файл

@ -667,6 +667,7 @@ static struct cubeb_ops const sndio_ops = {
.get_max_channel_count = sndio_get_max_channel_count,
.get_min_latency = sndio_get_min_latency,
.get_preferred_sample_rate = sndio_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = sndio_enumerate_devices,
.device_collection_destroy = sndio_device_collection_destroy,
.destroy = sndio_destroy,
@ -679,6 +680,8 @@ static struct cubeb_ops const sndio_ops = {
.stream_set_volume = sndio_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = NULL,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = NULL,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};

Просмотреть файл

@ -719,6 +719,7 @@ static struct cubeb_ops const sun_ops = {
.get_max_channel_count = sun_get_max_channel_count,
.get_min_latency = sun_get_min_latency,
.get_preferred_sample_rate = sun_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = sun_enumerate_devices,
.device_collection_destroy = sun_device_collection_destroy,
.destroy = sun_destroy,
@ -732,6 +733,8 @@ static struct cubeb_ops const sun_ops = {
.stream_set_volume = sun_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = sun_get_current_device,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = sun_stream_device_destroy,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};

Просмотреть файл

@ -182,7 +182,9 @@ public:
if (length_ + length > capacity_) {
reserve(length_ + length);
}
PodCopy(data_ + length_, elements, length);
if (data_) {
PodCopy(data_ + length_, elements, length);
}
length_ += length;
}
@ -195,12 +197,14 @@ public:
if (length_ + length > capacity_) {
reserve(length + length_);
}
PodZero(data_ + length_, length);
if (data_) {
PodZero(data_ + length_, length);
}
length_ += length;
}
/** Prepend `length` zero-ed elements to the end of the array, resizing the
* array if needed.
/** Prepend `length` zero-ed elements to the front of the array, resizing and
* shifting the array if needed.
* @parameter length the number of elements to prepend to the array.
*/
void push_front_silence(size_t length)
@ -208,8 +212,10 @@ public:
if (length_ + length > capacity_) {
reserve(length + length_);
}
PodMove(data_ + length, data_, length_);
PodZero(data_, length);
if (data_) {
PodMove(data_ + length, data_, length_);
PodZero(data_, length);
}
length_ += length;
}
@ -227,6 +233,9 @@ public:
if (length > length_) {
return false;
}
if (!data_) {
return true;
}
if (elements) {
PodCopy(elements, data_, length);
}

Просмотреть файл

@ -3561,6 +3561,7 @@ cubeb_ops const wasapi_ops = {
/*.get_max_channel_count =*/wasapi_get_max_channel_count,
/*.get_min_latency =*/wasapi_get_min_latency,
/*.get_preferred_sample_rate =*/wasapi_get_preferred_sample_rate,
/*.get_supported_input_processing_params =*/NULL,
/*.enumerate_devices =*/wasapi_enumerate_devices,
/*.device_collection_destroy =*/wasapi_device_collection_destroy,
/*.destroy =*/wasapi_destroy,
@ -3574,6 +3575,8 @@ cubeb_ops const wasapi_ops = {
/*.stream_set_volume =*/wasapi_stream_set_volume,
/*.stream_set_name =*/NULL,
/*.stream_get_current_device =*/NULL,
/*.stream_set_input_mute =*/NULL,
/*.stream_set_input_processing_params =*/NULL,
/*.stream_device_destroy =*/NULL,
/*.stream_register_device_changed_callback =*/NULL,
/*.register_device_collection_changed =*/

Просмотреть файл

@ -1192,6 +1192,7 @@ static struct cubeb_ops const winmm_ops = {
/*.get_max_channel_count=*/winmm_get_max_channel_count,
/*.get_min_latency=*/winmm_get_min_latency,
/*.get_preferred_sample_rate =*/winmm_get_preferred_sample_rate,
/*.get_supported_input_processing_params =*/NULL,
/*.enumerate_devices =*/winmm_enumerate_devices,
/*.device_collection_destroy =*/winmm_device_collection_destroy,
/*.destroy =*/winmm_destroy,
@ -1205,6 +1206,8 @@ static struct cubeb_ops const winmm_ops = {
/*.stream_set_volume =*/winmm_stream_set_volume,
/*.stream_set_name =*/NULL,
/*.stream_get_current_device =*/NULL,
/*.stream_set_input_mute =*/NULL,
/*.stream_set_input_processing_params =*/NULL,
/*.stream_device_destroy =*/NULL,
/*.stream_register_device_changed_callback=*/NULL,
/*.register_device_collection_changed =*/NULL};

Просмотреть файл

@ -1182,6 +1182,11 @@ who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy"
delta = "0.10.2 -> 0.10.3"
[[audits.cubeb]]
who = "Andreas Pehrson <apehrson@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.10.3 -> 0.12.0"
[[audits.cubeb-backend]]
who = "Matthew Gregan <kinetik@flim.org>"
criteria = "safe-to-deploy"
@ -1208,6 +1213,11 @@ who = "Andreas Pehrson <apehrson@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.10.3 -> 0.10.7"
[[audits.cubeb-backend]]
who = "Andreas Pehrson <apehrson@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.10.7 -> 0.12.0"
[[audits.cubeb-core]]
who = "Matthew Gregan <kinetik@flim.org>"
criteria = "safe-to-deploy"
@ -1239,6 +1249,11 @@ who = "Andreas Pehrson <apehrson@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.10.4 -> 0.10.7"
[[audits.cubeb-core]]
who = "Andreas Pehrson <apehrson@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.10.7 -> 0.12.0"
[[audits.cubeb-sys]]
who = "Matthew Gregan <kinetik@flim.org>"
criteria = "safe-to-deploy"
@ -1265,6 +1280,11 @@ who = "Andreas Pehrson <apehrson@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.10.3 -> 0.10.7"
[[audits.cubeb-sys]]
who = "Andreas Pehrson <apehrson@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.10.7 -> 0.12.0"
[[audits.d3d12]]
who = "Jim Blandy <jimb@red-bean.com>"
criteria = "safe-to-deploy"

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"d7cfe88a0f0086d4216e3f4ad3de0620417fcbda61c9852476459a9249131996","cbindgen.toml":"fb6abe1671497f432a06e40b1db7ed7cd2cceecbd9a2382193ad7534e8855e34","src/context.rs":"86d31460a48a9bdc0ac4fbef522d267c26f68dd79a12e0cbc35b3a4b6f6449dc","src/lib.rs":"c4a6797734489280f6b97dd72c9e51a7bd7be4104592eece3929e29d45cbca4a","src/send_recv.rs":"859abe75b521eb4297c84b30423814b5b87f3c7741ad16fe72189212e123e1ac","src/stream.rs":"3101f4052e35c1600adafedc67aed92d7d5531ff0ff4845de0a5ea3cedef872d"},"package":null}
{"files":{"Cargo.toml":"fc0b1fc4c29531e85b34632db363c04d519b326396f8bd52ca89d4000a7914da","cbindgen.toml":"fb6abe1671497f432a06e40b1db7ed7cd2cceecbd9a2382193ad7534e8855e34","src/context.rs":"a0559e92b554ef3156ab2bf2f1424555c8ef4a7977b9f43ac8500a9f399f8d99","src/lib.rs":"c87d9d57a16a9286cde730978db692df0fbc70cc69dd4f4677198d6843031fd8","src/send_recv.rs":"859abe75b521eb4297c84b30423814b5b87f3c7741ad16fe72189212e123e1ac","src/stream.rs":"90dc6a85552f3569ab1847de4247a46bcff2f5aef0c4d43fa2376589df015b25"},"package":null}

Просмотреть файл

@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "audioipc2-client"
version = "0.5.0"
version = "0.6.0"
authors = [
"Matthew Gregan <kinetik@flim.org>",
"Dan Glastonbury <dan.glastonbury@gmail.com>",
@ -21,7 +21,7 @@ description = "Cubeb Backend for talking to remote cubeb server."
license = "ISC"
[dependencies]
cubeb-backend = "0.10"
cubeb-backend = "0.12"
log = "0.4"
[dependencies.audio_thread_priority]

Просмотреть файл

@ -17,8 +17,8 @@ use audioipc::{
ServerMessage,
};
use cubeb_backend::{
capi_new, ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceType, Error, Ops,
Result, Stream, StreamParams, StreamParamsRef,
capi_new, ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceType, Error,
InputProcessingParams, Ops, Result, Stream, StreamParams, StreamParamsRef,
};
use std::ffi::{CStr, CString};
use std::os::raw::c_void;
@ -239,6 +239,14 @@ impl ContextOps for ClientContext {
send_recv!(self.rpc(), ContextGetPreferredSampleRate => ContextPreferredSampleRate())
}
fn supported_input_processing_params(&mut self) -> Result<InputProcessingParams> {
assert_not_in_callback();
send_recv!(self.rpc(),
ContextGetSupportedInputProcessingParams =>
ContextSupportedInputProcessingParams())
.map(InputProcessingParams::from_bits_truncate)
}
fn enumerate_devices(
&mut self,
devtype: DeviceType,

Просмотреть файл

@ -18,8 +18,8 @@ use audioipc::PlatformHandleType;
use cubeb_backend::{capi, ffi};
use std::os::raw::{c_char, c_int};
thread_local!(static IN_CALLBACK: std::cell::RefCell<bool> = std::cell::RefCell::new(false));
thread_local!(static AUDIOIPC_INIT_PARAMS: std::cell::RefCell<Option<AudioIpcInitParams>> = std::cell::RefCell::new(None));
thread_local!(static IN_CALLBACK: std::cell::RefCell<bool> = const { std::cell::RefCell::new(false) });
thread_local!(static AUDIOIPC_INIT_PARAMS: std::cell::RefCell<Option<AudioIpcInitParams>> = const { std::cell::RefCell::new(None) });
#[repr(C)]
#[derive(Clone, Copy, Debug)]

Просмотреть файл

@ -9,7 +9,7 @@ use audioipc::messages::StreamCreateParams;
use audioipc::messages::{self, CallbackReq, CallbackResp, ClientMessage, ServerMessage};
use audioipc::shm::SharedMem;
use audioipc::{rpccore, sys};
use cubeb_backend::{ffi, DeviceRef, Error, Result, Stream, StreamOps};
use cubeb_backend::{ffi, DeviceRef, Error, InputProcessingParams, Result, Stream, StreamOps};
use std::ffi::{CStr, CString};
use std::os::raw::c_void;
use std::ptr;
@ -302,6 +302,18 @@ impl StreamOps for ClientStream<'_> {
}
}
fn set_input_mute(&mut self, mute: bool) -> Result<()> {
assert_not_in_callback();
let rpc = self.context.rpc();
send_recv!(rpc, StreamSetInputMute(self.token, mute) => StreamInputMuteSet)
}
fn set_input_processing_params(&mut self, params: InputProcessingParams) -> Result<()> {
assert_not_in_callback();
let rpc = self.context.rpc();
send_recv!(rpc, StreamSetInputProcessingParams(self.token, params.bits()) => StreamInputProcessingParamsSet)
}
fn device_destroy(&mut self, device: &DeviceRef) -> Result<()> {
assert_not_in_callback();
if device.as_ptr().is_null() {

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"4e66d9ec1e8baa7ad01ace373a921bc019e38bcb23f782be1daa8578f40b6086","cbindgen.toml":"fb6abe1671497f432a06e40b1db7ed7cd2cceecbd9a2382193ad7534e8855e34","src/lib.rs":"06aff4fd1326aeabb16b01f81a6f3c59c1717ebe96285a063724830cdf30303a","src/server.rs":"ea839fe4607ba6b70a1ef5dfb2305eb668b148820c5590b87192609fbe3c9edd"},"package":null}
{"files":{"Cargo.toml":"2e3be27edd7f547f229ba22ab0690bf341681f4e397e784de667118188037abf","cbindgen.toml":"fb6abe1671497f432a06e40b1db7ed7cd2cceecbd9a2382193ad7534e8855e34","src/lib.rs":"06aff4fd1326aeabb16b01f81a6f3c59c1717ebe96285a063724830cdf30303a","src/server.rs":"31e0c763527a16dfc281399e8a6c9eb8c1bac71ab9d7866288ec87297f4316e0"},"package":null}

Просмотреть файл

@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "audioipc2-server"
version = "0.5.0"
version = "0.6.0"
authors = [
"Matthew Gregan <kinetik@flim.org>",
"Dan Glastonbury <dan.glastonbury@gmail.com>",
@ -21,7 +21,7 @@ description = "Remote cubeb server"
license = "ISC"
[dependencies]
cubeb-core = "0.10.0"
cubeb-core = "0.12.0"
log = "0.4"
once_cell = "1.2.0"
slab = "0.4"

Просмотреть файл

@ -13,6 +13,7 @@ use audioipc::messages::{
};
use audioipc::shm::SharedMem;
use audioipc::{ipccore, rpccore, sys, PlatformHandle};
use cubeb::InputProcessingParams;
use cubeb_core as cubeb;
use cubeb_core::ffi;
use std::convert::{From, TryInto};
@ -154,7 +155,7 @@ struct CubebContextState {
context: cubeb::Result<cubeb::Context>,
}
thread_local!(static CONTEXT_KEY: RefCell<Option<CubebContextState>> = RefCell::new(None));
thread_local!(static CONTEXT_KEY: RefCell<Option<CubebContextState>> = const { RefCell::new(None) });
fn cubeb_init_from_context_params() -> cubeb::Result<cubeb::Context> {
let params = super::G_CUBEB_CONTEXT_PARAMS.lock().unwrap();
@ -509,6 +510,11 @@ impl CubebServer {
.map(ClientMessage::ContextPreferredSampleRate)
.unwrap_or_else(error),
ServerMessage::ContextGetSupportedInputProcessingParams => context
.supported_input_processing_params()
.map(|params| ClientMessage::ContextSupportedInputProcessingParams(params.bits()))
.unwrap_or_else(error),
ServerMessage::ContextGetDeviceEnumeration(device_type) => context
.enumerate_devices(cubeb::DeviceType::from_bits_truncate(device_type))
.map(|devices| {
@ -585,6 +591,18 @@ impl CubebServer {
.map(|device| ClientMessage::StreamCurrentDevice(Device::from(device)))
.unwrap_or_else(error),
ServerMessage::StreamSetInputMute(stm_tok, mute) => try_stream!(self, stm_tok)
.set_input_mute(mute)
.map(|_| ClientMessage::StreamInputMuteSet)
.unwrap_or_else(error),
ServerMessage::StreamSetInputProcessingParams(stm_tok, params) => {
try_stream!(self, stm_tok)
.set_input_processing_params(InputProcessingParams::from_bits_truncate(params))
.map(|_| ClientMessage::StreamInputProcessingParamsSet)
.unwrap_or_else(error)
}
ServerMessage::StreamRegisterDeviceChangeCallback(stm_tok, enable) => {
try_stream!(self, stm_tok)
.register_device_changed_callback(if enable {

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"a3b42c62aaab67e846239b3fb5a6b9d722d0faca944d4e654f58ccf2db6f79dc","benches/serialization.rs":"d56855d868dab6aa22c8b03a61084535351b76c94b68d8b1d20764e352fe473f","build.rs":"65df9a97c6cdaa3faf72581f04ac289197b0b1797d69d22c1796e957ff1089e2","src/codec.rs":"38408b512d935cd7889a03b25dd14b36083ec4e6d2fcabd636182cf45e3d50bc","src/errors.rs":"67a4a994d0724397657581cde153bdfc05ce86e7efc467f23fafc8f64df80fa4","src/ipccore.rs":"ba339eebdc2d8a6d0cb9b294344809e63e404e220fda643b63a8a3ff63a755e8","src/lib.rs":"a6fcac8b44318435db60313d3ef32ff3fada390bea8978c8414c40744998b98b","src/messages.rs":"452362da2cace9a0f2e3134c190ecb6a9997f8be4036cde06643e17c6c238240","src/rpccore.rs":"025b6614f1c42b96b0a8e74fd7881032d338c66e0d67ec0af70f910a9e30ebe1","src/shm.rs":"c00d16f4af510d12e704ae865f7348ad64ddef180e42b18e7dd95c4be35a9c80","src/sys/mod.rs":"e6fa1d260abf093e1f7b50185195e2d3aee0eb8c9774c6f253953b5896d838f3","src/sys/unix/cmsg.rs":"6f0236bf6cd66ccd237b268348a826ae1d266073c2adadcfaae703c556230065","src/sys/unix/cmsghdr.c":"d7344b3dc15cdce410c68669b848bb81f7fe36362cd3699668cb613fa05180f8","src/sys/unix/mod.rs":"59835f0d5509940078b1820a54f49fc5514adeb3e45e7d21e3ab917431da2e74","src/sys/unix/msg.rs":"0e297d73bae9414184f85c2209cca0a3fde6d999a3f1d3f42faa3f56b6d57233","src/sys/windows/mod.rs":"7eaabb76e62c6962b636320e2bbf79a78fce61659c799a798f7dd6d56b0be8a1"},"package":null}
{"files":{"Cargo.toml":"49dd46634797dc3bd8cbb9cd0892ae1cccbde573423d753a1dbbdefed239f92e","benches/serialization.rs":"d56855d868dab6aa22c8b03a61084535351b76c94b68d8b1d20764e352fe473f","build.rs":"65df9a97c6cdaa3faf72581f04ac289197b0b1797d69d22c1796e957ff1089e2","src/codec.rs":"38408b512d935cd7889a03b25dd14b36083ec4e6d2fcabd636182cf45e3d50bc","src/errors.rs":"67a4a994d0724397657581cde153bdfc05ce86e7efc467f23fafc8f64df80fa4","src/ipccore.rs":"db73e916468c54d3497d75ffcab3bf23067771ed7b2e1a23c714429f56f59ec3","src/lib.rs":"a6fcac8b44318435db60313d3ef32ff3fada390bea8978c8414c40744998b98b","src/messages.rs":"f1d5568c3095ee9f557412c2f4c217abfa5696a5035e4f7cb2dbc8cce700f1c4","src/rpccore.rs":"025b6614f1c42b96b0a8e74fd7881032d338c66e0d67ec0af70f910a9e30ebe1","src/shm.rs":"c00d16f4af510d12e704ae865f7348ad64ddef180e42b18e7dd95c4be35a9c80","src/sys/mod.rs":"e6fa1d260abf093e1f7b50185195e2d3aee0eb8c9774c6f253953b5896d838f3","src/sys/unix/cmsg.rs":"6f0236bf6cd66ccd237b268348a826ae1d266073c2adadcfaae703c556230065","src/sys/unix/cmsghdr.c":"d7344b3dc15cdce410c68669b848bb81f7fe36362cd3699668cb613fa05180f8","src/sys/unix/mod.rs":"59835f0d5509940078b1820a54f49fc5514adeb3e45e7d21e3ab917431da2e74","src/sys/unix/msg.rs":"0e297d73bae9414184f85c2209cca0a3fde6d999a3f1d3f42faa3f56b6d57233","src/sys/windows/mod.rs":"7eaabb76e62c6962b636320e2bbf79a78fce61659c799a798f7dd6d56b0be8a1"},"package":null}

4
third_party/rust/audioipc2/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "audioipc2"
version = "0.5.0"
version = "0.6.0"
authors = [
"Matthew Gregan <kinetik@flim.org>",
"Dan Glastonbury <dan.glastonbury@gmail.com>",
@ -29,7 +29,7 @@ bincode = "1.3"
byteorder = "1"
bytes = "1"
crossbeam-queue = "0.3"
cubeb = "0.10"
cubeb = "0.12"
log = "0.4"
scopeguard = "1.1.0"
serde = "1"

2
third_party/rust/audioipc2/src/ipccore.rs поставляемый
Просмотреть файл

@ -25,7 +25,7 @@ use std::fmt::Debug;
const WAKE_TOKEN: Token = Token(!0);
thread_local!(static IN_EVENTLOOP: std::cell::RefCell<Option<thread::ThreadId>> = std::cell::RefCell::new(None));
thread_local!(static IN_EVENTLOOP: std::cell::RefCell<Option<thread::ThreadId>> = const { std::cell::RefCell::new(None) });
fn assert_not_in_event_loop_thread() {
IN_EVENTLOOP.with(|b| {

6
third_party/rust/audioipc2/src/messages.rs поставляемый
Просмотреть файл

@ -209,6 +209,7 @@ pub enum ServerMessage {
ContextGetMaxChannelCount,
ContextGetMinLatency(StreamParams),
ContextGetPreferredSampleRate,
ContextGetSupportedInputProcessingParams,
ContextGetDeviceEnumeration(ffi::cubeb_device_type),
ContextSetupDeviceCollectionCallback,
ContextRegisterDeviceCollectionChanged(ffi::cubeb_device_type, bool),
@ -225,6 +226,8 @@ pub enum ServerMessage {
StreamSetVolume(usize, f32),
StreamSetName(usize, CString),
StreamGetCurrentDevice(usize),
StreamSetInputMute(usize, bool),
StreamSetInputProcessingParams(usize, ffi::cubeb_input_processing_params),
StreamRegisterDeviceChangeCallback(usize, bool),
#[cfg(target_os = "linux")]
@ -242,6 +245,7 @@ pub enum ClientMessage {
ContextMaxChannelCount(u32),
ContextMinLatency(u32),
ContextPreferredSampleRate(u32),
ContextSupportedInputProcessingParams(ffi::cubeb_input_processing_params),
ContextEnumeratedDevices(Vec<DeviceInfo>),
ContextSetupDeviceCollectionCallback(RegisterDeviceCollectionChanged),
ContextRegisteredDeviceCollectionChanged,
@ -258,6 +262,8 @@ pub enum ClientMessage {
StreamVolumeSet,
StreamNameSet,
StreamCurrentDevice(Device),
StreamInputMuteSet,
StreamInputProcessingParamsSet,
StreamRegisterDeviceChangeCallback,
#[cfg(target_os = "linux")]

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"16cd41733a8181d8a840b3996c9cfefa74df298f5feba352be019cdfa3921f32","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","src/capi.rs":"edf8a65022d393d0214897986ca49428438b0b32f84e1380c962ecc835290e54","src/lib.rs":"4ce6db20f88487e99057ebeae0615fa1c99e82cfee0ab0825936da2e108fc73e","src/log.rs":"968b839a8a5a56fe42e372678fdd580e2777e1dba8c4f0bee6fbfe5e3f03b860","src/ops.rs":"981866ad12bf07e2f2b887ef9b5810364d2c48101d513879a06a8bf76984dc50","src/traits.rs":"ac35b2124876865b427f0e91026bb1102aadc96f1b763a639c495640cbd92650","tests/test_capi.rs":"27093e582f540c5baf50af5d1e5008c46573792853927b9ecfe62c117bfac303"},"package":"3154aa90b995f098f7fade918a903c13e2c6acb96da7afed160c537f8ed29611"}
{"files":{"Cargo.toml":"b3a6e03dbc48515bbca791eba64096ab43dddafa6c60eec2b824369e2afb31b8","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","src/capi.rs":"d9bc993ea8bb51220c5cdc54488bc795f74411fe688332bd80dbb062c41342bb","src/lib.rs":"4ce6db20f88487e99057ebeae0615fa1c99e82cfee0ab0825936da2e108fc73e","src/log.rs":"968b839a8a5a56fe42e372678fdd580e2777e1dba8c4f0bee6fbfe5e3f03b860","src/ops.rs":"e631eba0d1ef8c13287361be32c0806d7869f598f58266bab0a45642521fa07e","src/traits.rs":"45e3e58772dd0ff40bf36d56dd9f1fc682cc08cea570022fa50eae1c34d43a3a","tests/test_capi.rs":"783c8321dceb33a414168ae64e162f934015144f49118d868557009819a20e06"},"package":"b00b0f3b84e315571bd8c4e18794180633066267a413f2f05bca65001adc8410"}

4
third_party/rust/cubeb-backend/Cargo.toml поставляемый
Просмотреть файл

@ -11,7 +11,7 @@
[package]
name = "cubeb-backend"
version = "0.10.7"
version = "0.12.0"
authors = ["Dan Glastonbury <dglastonbury@mozilla.com>"]
description = """
Bindings to libcubeb internals to facilitate implementing cubeb backends in rust.
@ -23,7 +23,7 @@ license = "ISC"
repository = "https://github.com/mozilla/cubeb-rs"
[dependencies.cubeb-core]
version = "0.10.7"
version = "0.12.0"
[features]
gecko-in-tree = ["cubeb-core/gecko-in-tree"]

55
third_party/rust/cubeb-backend/src/capi.rs поставляемый
Просмотреть файл

@ -3,7 +3,10 @@
// This program is made available under an ISC-style license. See the
// accompanying file LICENSE for details
use cubeb_core::{ffi, DeviceCollectionRef, DeviceRef, DeviceType, StreamParams, StreamParamsRef};
use cubeb_core::{
ffi, DeviceCollectionRef, DeviceRef, DeviceType, InputProcessingParams, StreamParams,
StreamParamsRef,
};
use std::ffi::CStr;
use std::mem;
use std::os::raw::{c_char, c_int, c_void};
@ -38,6 +41,8 @@ macro_rules! capi_new(
get_max_channel_count: Some($crate::capi::capi_get_max_channel_count::<$ctx>),
get_min_latency: Some($crate::capi::capi_get_min_latency::<$ctx>),
get_preferred_sample_rate: Some($crate::capi::capi_get_preferred_sample_rate::<$ctx>),
get_supported_input_processing_params:
Some($crate::capi::capi_get_supported_input_processing_params::<$ctx>),
enumerate_devices: Some($crate::capi::capi_enumerate_devices::<$ctx>),
device_collection_destroy: Some($crate::capi::capi_device_collection_destroy::<$ctx>),
destroy: Some($crate::capi::capi_destroy::<$ctx>),
@ -51,6 +56,9 @@ macro_rules! capi_new(
stream_set_volume: Some($crate::capi::capi_stream_set_volume::<$stm>),
stream_set_name: Some($crate::capi::capi_stream_set_name::<$stm>),
stream_get_current_device: Some($crate::capi::capi_stream_get_current_device::<$stm>),
stream_set_input_mute: Some($crate::capi::capi_stream_set_input_mute::<$stm>),
stream_set_input_processing_params:
Some($crate::capi::capi_stream_set_input_processing_params::<$stm>),
stream_device_destroy: Some($crate::capi::capi_stream_device_destroy::<$stm>),
stream_register_device_changed_callback:
Some($crate::capi::capi_stream_register_device_changed_callback::<$stm>),
@ -137,6 +145,21 @@ pub unsafe extern "C" fn capi_get_preferred_sample_rate<CTX: ContextOps>(
ffi::CUBEB_OK
}
/// # Safety
///
/// Entry point from C code.
///
/// This function is unsafe because it dereferences the given `c` and `params` pointers.
/// The caller should ensure those pointers are valid.
pub unsafe extern "C" fn capi_get_supported_input_processing_params<CTX: ContextOps>(
c: *mut ffi::cubeb,
params: *mut ffi::cubeb_input_processing_params,
) -> c_int {
let ctx = &mut *(c as *mut CTX);
*params = _try!(ctx.supported_input_processing_params()).bits();
ffi::CUBEB_OK
}
/// # Safety
///
/// Entry point from C code.
@ -360,6 +383,36 @@ pub unsafe extern "C" fn capi_stream_get_current_device<STM: StreamOps>(
ffi::CUBEB_OK
}
/// # Safety
///
/// Entry point from C code.
///
/// This function is unsafe because it dereferences the given `s` pointer.
/// The caller should ensure those pointers are valid.
pub unsafe extern "C" fn capi_stream_set_input_mute<STM: StreamOps>(
s: *mut ffi::cubeb_stream,
mute: c_int,
) -> c_int {
let stm = &mut *(s as *mut STM);
_try!(stm.set_input_mute(mute != 0));
ffi::CUBEB_OK
}
/// # Safety
///
/// Entry point from C code.
///
/// This function is unsafe because it dereferences the given `s` pointer.
/// The caller should ensure those pointers are valid.
pub unsafe extern "C" fn capi_stream_set_input_processing_params<STM: StreamOps>(
s: *mut ffi::cubeb_stream,
params: ffi::cubeb_input_processing_params,
) -> c_int {
let stm = &mut *(s as *mut STM);
_try!(stm.set_input_processing_params(InputProcessingParams::from_bits_truncate(params)));
ffi::CUBEB_OK
}
/// # Safety
///
/// Entry point from C code.

14
third_party/rust/cubeb-backend/src/ops.rs поставляемый
Просмотреть файл

@ -25,6 +25,12 @@ pub struct Ops {
>,
pub get_preferred_sample_rate:
Option<unsafe extern "C" fn(context: *mut ffi::cubeb, rate: *mut u32) -> c_int>,
pub get_supported_input_processing_params: Option<
unsafe extern "C" fn(
c: *mut ffi::cubeb,
params: *mut ffi::cubeb_input_processing_params,
) -> c_int,
>,
pub enumerate_devices: Option<
unsafe extern "C" fn(
context: *mut ffi::cubeb,
@ -74,6 +80,14 @@ pub struct Ops {
device: *mut *mut ffi::cubeb_device,
) -> c_int,
>,
pub stream_set_input_mute:
Option<unsafe extern "C" fn(stream: *mut ffi::cubeb_stream, mute: c_int) -> c_int>,
pub stream_set_input_processing_params: Option<
unsafe extern "C" fn(
stream: *mut ffi::cubeb_stream,
params: ffi::cubeb_input_processing_params,
) -> c_int,
>,
pub stream_device_destroy: Option<
unsafe extern "C" fn(
stream: *mut ffi::cubeb_stream,

Просмотреть файл

@ -4,8 +4,8 @@
// accompanying file LICENSE for details.
use cubeb_core::{
Context, DeviceCollectionRef, DeviceId, DeviceRef, DeviceType, Result, Stream, StreamParams,
StreamParamsRef,
Context, DeviceCollectionRef, DeviceId, DeviceRef, DeviceType, InputProcessingParams, Result,
Stream, StreamParams, StreamParamsRef,
};
use ffi;
use std::ffi::CStr;
@ -17,6 +17,7 @@ pub trait ContextOps {
fn max_channel_count(&mut self) -> Result<u32>;
fn min_latency(&mut self, params: StreamParams) -> Result<u32>;
fn preferred_sample_rate(&mut self) -> Result<u32>;
fn supported_input_processing_params(&mut self) -> Result<InputProcessingParams>;
fn enumerate_devices(
&mut self,
devtype: DeviceType,
@ -53,6 +54,8 @@ pub trait StreamOps {
fn set_volume(&mut self, volume: f32) -> Result<()>;
fn set_name(&mut self, name: &CStr) -> Result<()>;
fn current_device(&mut self) -> Result<&DeviceRef>;
fn set_input_mute(&mut self, mute: bool) -> Result<()>;
fn set_input_processing_params(&mut self, params: InputProcessingParams) -> Result<()>;
fn device_destroy(&mut self, device: &DeviceRef) -> Result<()>;
fn register_device_changed_callback(
&mut self,

Просмотреть файл

@ -9,8 +9,8 @@
extern crate cubeb_backend;
use cubeb_backend::{
ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceRef, DeviceType, Ops, Result,
Stream, StreamOps, StreamParams, StreamParamsRef,
ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceRef, DeviceType,
InputProcessingParams, Ops, Result, Stream, StreamOps, StreamParams, StreamParamsRef,
};
use std::ffi::CStr;
use std::os::raw::c_void;
@ -43,6 +43,9 @@ impl ContextOps for TestContext {
fn preferred_sample_rate(&mut self) -> Result<u32> {
Ok(0u32)
}
fn supported_input_processing_params(&mut self) -> Result<InputProcessingParams> {
Ok(InputProcessingParams::NONE)
}
fn enumerate_devices(
&mut self,
_devtype: DeviceType,
@ -114,6 +117,14 @@ impl StreamOps for TestStream {
fn current_device(&mut self) -> Result<&DeviceRef> {
Ok(unsafe { DeviceRef::from_ptr(0xDEAD_BEEF as *mut _) })
}
fn set_input_mute(&mut self, mute: bool) -> Result<()> {
assert_eq!(mute, true);
Ok(())
}
fn set_input_processing_params(&mut self, params: InputProcessingParams) -> Result<()> {
assert_eq!(params, InputProcessingParams::ECHO_CANCELLATION);
Ok(())
}
fn device_destroy(&mut self, device: &DeviceRef) -> Result<()> {
assert_eq!(device.as_ptr(), 0xDEAD_BEEF as *mut _);
Ok(())
@ -170,6 +181,17 @@ fn test_ops_context_preferred_sample_rate() {
assert_eq!(rate, 0);
}
#[test]
fn test_ops_context_supported_input_processing_params() {
let c: *mut ffi::cubeb = ptr::null_mut();
let mut params: ffi::cubeb_input_processing_params = InputProcessingParams::all().bits();
assert_eq!(
unsafe { OPS.get_supported_input_processing_params.unwrap()(c, &mut params) },
ffi::CUBEB_OK
);
assert_eq!(params, ffi::CUBEB_INPUT_PROCESSING_PARAM_NONE);
}
#[test]
fn test_ops_context_enumerate_devices() {
let c: *mut ffi::cubeb = ptr::null_mut();
@ -244,6 +266,29 @@ fn test_ops_stream_current_device() {
assert_eq!(device, 0xDEAD_BEEF as *mut _);
}
#[test]
fn test_ops_stream_set_input_mute() {
let s: *mut ffi::cubeb_stream = ptr::null_mut();
assert_eq!(
unsafe { OPS.stream_set_input_mute.unwrap()(s, 1) },
ffi::CUBEB_OK
);
}
#[test]
fn test_ops_stream_set_input_processing_params() {
let s: *mut ffi::cubeb_stream = ptr::null_mut();
assert_eq!(
unsafe {
OPS.stream_set_input_processing_params.unwrap()(
s,
ffi::CUBEB_INPUT_PROCESSING_PARAM_ECHO_CANCELLATION,
)
},
ffi::CUBEB_OK
);
}
#[test]
fn test_ops_stream_device_destroy() {
let s: *mut ffi::cubeb_stream = ptr::null_mut();

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"cb350a521e95bbfd314a7fe47365df142a345d7f89bf3d741924866b0ff2a2ae","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","src/builders.rs":"87adbbdd63fde848eeaae4a79a04859ed02ca982fb644f6b8b5fe7c158a8944c","src/call.rs":"cf8949c2cf53f5418d8e5222f570b9301a98a476a18c734fc2ebbc8b53ac0165","src/channel.rs":"c88b8846e53bbec6b125a4fa6a3787c48312be958bd08cc5ee773b218d93d683","src/context.rs":"9d7fd770511910e8c416ff47354863f547915ff94fb19ef2dd6796a70c2658cd","src/device.rs":"86fd507bf1cd97b13b8cf3e92519b3be11904be68d4997658b276d5054162cd7","src/device_collection.rs":"f86535ffeee73b889bdbac1c5a3432b01cca86df819a7cc26eaa0c983d30cbbe","src/error.rs":"3693bf575e9504b9b1ab114de3e2ce7132039acf27ec68967dae66c2ce1581aa","src/ffi_types.rs":"71948d0949675df876e18c4340f4e693fc6a14c4de9d63a3885450c95577596b","src/format.rs":"7162c1550be53f5fe94b0bba4c71fea2f0304462108657c62a20ea47207ca413","src/lib.rs":"57ecf793ab1cc052c021ccbf9ad011ea52d1303e2dbc54adea90a95b5d7a36cf","src/log.rs":"4bef74d7a7fd9ffdf249be5ef95781969f00a7ecff2d3a190d5b1536d1635a73","src/stream.rs":"8ac3c8ae4620dd040c479db13e34f953281c8a24187cab7cc7865dfce3e4231e","src/util.rs":"308cfbaacd615ff600e74415c52daeef007fff34a4a0648a73c0042f6067f84f"},"package":"da324c1b1487b3fe7b4048b2c797ddde9375e6cf72fb8b15ccdaf598182415b5"}
{"files":{"Cargo.toml":"9f1c5d546cc66c991eafd6369bb8799f6021e677217b86f092d08c6a1e6fee6a","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","src/builders.rs":"87adbbdd63fde848eeaae4a79a04859ed02ca982fb644f6b8b5fe7c158a8944c","src/call.rs":"cf8949c2cf53f5418d8e5222f570b9301a98a476a18c734fc2ebbc8b53ac0165","src/channel.rs":"c88b8846e53bbec6b125a4fa6a3787c48312be958bd08cc5ee773b218d93d683","src/context.rs":"ac5937037e69f32bb3ef5985d1921f53a2651d0068c12f90762eb0e18489e93e","src/device.rs":"86fd507bf1cd97b13b8cf3e92519b3be11904be68d4997658b276d5054162cd7","src/device_collection.rs":"f86535ffeee73b889bdbac1c5a3432b01cca86df819a7cc26eaa0c983d30cbbe","src/error.rs":"3693bf575e9504b9b1ab114de3e2ce7132039acf27ec68967dae66c2ce1581aa","src/ffi_types.rs":"71948d0949675df876e18c4340f4e693fc6a14c4de9d63a3885450c95577596b","src/format.rs":"7162c1550be53f5fe94b0bba4c71fea2f0304462108657c62a20ea47207ca413","src/lib.rs":"57ecf793ab1cc052c021ccbf9ad011ea52d1303e2dbc54adea90a95b5d7a36cf","src/log.rs":"4bef74d7a7fd9ffdf249be5ef95781969f00a7ecff2d3a190d5b1536d1635a73","src/stream.rs":"9fbfc65f77fb1009f8578c530744276828a6d6778f53b96decb698d937c2b098","src/util.rs":"308cfbaacd615ff600e74415c52daeef007fff34a4a0648a73c0042f6067f84f"},"package":"2380c03a7df0ea3744f6a210d6340f423935e53cbf2fd68ada84b5e808e46ac7"}

4
third_party/rust/cubeb-core/Cargo.toml поставляемый
Просмотреть файл

@ -11,7 +11,7 @@
[package]
name = "cubeb-core"
version = "0.10.7"
version = "0.12.0"
authors = ["Dan Glastonbury <dglastonbury@mozilla.com>"]
description = """
Common types and definitions for cubeb rust and C bindings. Not intended for direct use.
@ -26,7 +26,7 @@ repository = "https://github.com/mozilla/cubeb-rs"
version = "1.2.0"
[dependencies.cubeb-sys]
version = "0.10.7"
version = "0.12.0"
[features]
gecko-in-tree = ["cubeb-sys/gecko-in-tree"]

15
third_party/rust/cubeb-core/src/context.rs поставляемый
Просмотреть файл

@ -8,7 +8,9 @@ use std::ffi::CStr;
use std::os::raw::c_void;
use std::{ptr, str};
use util::opt_bytes;
use {DeviceCollection, DeviceId, DeviceType, Result, Stream, StreamParamsRef};
use {
DeviceCollection, DeviceId, DeviceType, InputProcessingParams, Result, Stream, StreamParamsRef,
};
macro_rules! as_ptr {
($e:expr) => {
@ -78,6 +80,17 @@ impl ContextRef {
Ok(rate)
}
pub fn supported_input_processing_params(&self) -> Result<InputProcessingParams> {
let mut params = ffi::CUBEB_INPUT_PROCESSING_PARAM_NONE;
unsafe {
call!(ffi::cubeb_get_supported_input_processing_params(
self.as_ptr(),
&mut params
))?;
};
Ok(InputProcessingParams::from_bits_truncate(params))
}
/// # Safety
///
/// This function is unsafe because it dereferences the given `data_callback`, `state_callback`, and `user_ptr` pointers.

32
third_party/rust/cubeb-core/src/stream.rs поставляемый
Просмотреть файл

@ -5,7 +5,7 @@
use ffi;
use std::ffi::CStr;
use std::os::raw::c_void;
use std::os::raw::{c_int, c_void};
use std::ptr;
use {ChannelLayout, DeviceRef, Result, SampleFormat};
@ -59,6 +59,20 @@ impl StreamPrefs {
pub const NONE: Self = Self::empty();
}
bitflags! {
/// Input stream processing parameters.
pub struct InputProcessingParams: ffi::cubeb_input_processing_params {
const ECHO_CANCELLATION = ffi::CUBEB_INPUT_PROCESSING_PARAM_ECHO_CANCELLATION;
const NOISE_SUPPRESSION = ffi::CUBEB_INPUT_PROCESSING_PARAM_NOISE_SUPPRESSION;
const AUTOMATIC_GAIN_CONTROL = ffi::CUBEB_INPUT_PROCESSING_PARAM_AUTOMATIC_GAIN_CONTROL;
const VOICE_ISOLATION = ffi::CUBEB_INPUT_PROCESSING_PARAM_VOICE_ISOLATION;
}
}
impl InputProcessingParams {
pub const NONE: Self = Self::empty();
}
ffi_type_stack! {
/// Stream format initialization parameters.
type CType = ffi::cubeb_stream_params;
@ -178,6 +192,22 @@ impl StreamRef {
}
}
/// Set the mute state for an input stream.
pub fn set_input_mute(&self, mute: bool) -> Result<()> {
let mute: c_int = if mute { 1 } else { 0 };
unsafe { call!(ffi::cubeb_stream_set_input_mute(self.as_ptr(), mute)) }
}
/// Set the processing parameters for an input stream.
pub fn set_input_processing_params(&self, params: InputProcessingParams) -> Result<()> {
unsafe {
call!(ffi::cubeb_stream_set_input_processing_params(
self.as_ptr(),
params.bits()
))
}
}
/// Destroy a cubeb_device structure.
pub fn device_destroy(&self, device: DeviceRef) -> Result<()> {
unsafe {

Просмотреть файл

@ -1 +1 @@
{"files":{".circleci/config.yml":"7f3dc865105ca8f33965a7958b1fe2e627ae2d5a703f3b2a4ab6e2e796018597",".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".githooks/pre-push":"8b8b26544cd56f54c0c33812551f786bb25cb08c86dbfeb6bf3daad881c826a1",".github/workflows/test.yml":"aa1998a3b104ad131805ca3513832cef3f65300192824f8b1efc9a5a0cc108f6",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"2df232bade3f776dd1aa0287b4bb8ce1a8845fd8b896e29fcf22b60e9bf994d0","LICENSE":"6e6f56aff5bbf3cbc60747e152fb1a719bd0716aaf6d711c554f57d92e96297c","README.md":"0007782a05a5330f739ad789c19c82562c82e32386b0447000fc72c0d48405bc","build-audiounit-rust-in-cubeb.sh":"d228a05985dcd02ec1ecac66a2b64dae5a530804a25a7054ccc95905aedfb7ef","install_git_hook.sh":"d38c8e51e636f6b90b489621ac34ccd1d1b1f40dccce3d178ed1da1c5068f16d","install_rustfmt_clippy.sh":"4ae90d8dcb9757cb3ae4ae142ef80e5377c0dde61c63f4a3c32418646e80ca7b","run_device_tests.sh":"d717e598c96e4911d9494b18382d6bd3a8d5038b7d68d3166ad4336e237a97d8","run_sanitizers.sh":"84e93a0da137803018f37403511e8c92760be730426bf6cea34419d93d1a7ff8","run_tests.sh":"916a7ae4a406d2274417d6eca939a878db5adcb6144e5680d9d148bf90178f1c","src/backend/aggregate_device.rs":"43511107ba2a75a19340ac663c981362ca1b75b679b6c295d88b5035bd7e3619","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/buffer_manager.rs":"e9bcf964347daa8952f98caa2746e34a31ea8908375204896593f56e4b6147ca","src/backend/device_property.rs":"a7622feaa41db1cd76fd35a85a022e44f4894e396a104a59008d5b8757d2ab4e","src/backend/mixer.rs":"ed299d3954e2a823060c870a8244673a7d4bca530830cb66b964d047a80ee3af","src/backend/mod.rs":"9343ab74ab1a7e8812aa5b7d03db061e66d39611aadc02c1eed95f714f15d3b0","src/backend/resampler.rs":"48bf8f56ae8d60dbabca6417b768000619abee8731ac3902164b45651ac08a4d","src/backend/tests/aggregate_device.rs":"e3f94e118e1dd47941fbba4417de40bddc4254d9f06b1e938f58d8f1aa566a5c","src/backend/tests/api.rs":"cd7e7551e2e82b19da883621a494d2a6779c373f3ff2d12ee52fae8efec1e7b8","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"f68c2eaa55c3ec2a58894832fbca1e2a2e79e740b145f76a0f45452af465a934","src/backend/tests/device_property.rs":"ea0be5f8834be494cb33f854ce9d334b5763dc5287f949bcb4bd025d8a8b2d3b","src/backend/tests/interfaces.rs":"20deac649297367da5dbe267847266d36680c5e3bd7ac3bf82776122d10b83e4","src/backend/tests/manual.rs":"8d485a6666a3f4518b03e39dab80bf2acfd760af2d2f43bad99023cb135b38ca","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"59632744e70616ab7037facb0787db339b96800c8cc397d203241548c5cfb7f5","src/backend/tests/tone.rs":"779cc14fc2a362bf7f26ce66ad70c0639501176175655a99b7fefb3c59d56c7a","src/backend/tests/utils.rs":"efb8b3709aff7ed5e2923566084de3e0709f3bd9c18a04f3310d7a3b86fa4b71","src/backend/utils.rs":"6c3ffbcd602e6cc9f56deb9ecb07b2eef2e6f074ef924178e466f380aae5c595","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"efc1f012eb9a331a040cad4ac03aa79307f25885f71b6fb38f3ad7af8d7d515c"},"package":null}
{"files":{".circleci/config.yml":"7f3dc865105ca8f33965a7958b1fe2e627ae2d5a703f3b2a4ab6e2e796018597",".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".githooks/pre-push":"8b8b26544cd56f54c0c33812551f786bb25cb08c86dbfeb6bf3daad881c826a1",".github/workflows/test.yml":"aa1998a3b104ad131805ca3513832cef3f65300192824f8b1efc9a5a0cc108f6",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"d7e757e664c23fae52028f1dfc5917f92523c08702e3a1f95e1fd38ed714416c","LICENSE":"6e6f56aff5bbf3cbc60747e152fb1a719bd0716aaf6d711c554f57d92e96297c","README.md":"0007782a05a5330f739ad789c19c82562c82e32386b0447000fc72c0d48405bc","build-audiounit-rust-in-cubeb.sh":"d228a05985dcd02ec1ecac66a2b64dae5a530804a25a7054ccc95905aedfb7ef","install_git_hook.sh":"d38c8e51e636f6b90b489621ac34ccd1d1b1f40dccce3d178ed1da1c5068f16d","install_rustfmt_clippy.sh":"4ae90d8dcb9757cb3ae4ae142ef80e5377c0dde61c63f4a3c32418646e80ca7b","run_device_tests.sh":"d717e598c96e4911d9494b18382d6bd3a8d5038b7d68d3166ad4336e237a97d8","run_sanitizers.sh":"84e93a0da137803018f37403511e8c92760be730426bf6cea34419d93d1a7ff8","run_tests.sh":"916a7ae4a406d2274417d6eca939a878db5adcb6144e5680d9d148bf90178f1c","src/backend/aggregate_device.rs":"43511107ba2a75a19340ac663c981362ca1b75b679b6c295d88b5035bd7e3619","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/buffer_manager.rs":"e9bcf964347daa8952f98caa2746e34a31ea8908375204896593f56e4b6147ca","src/backend/device_property.rs":"a7622feaa41db1cd76fd35a85a022e44f4894e396a104a59008d5b8757d2ab4e","src/backend/mixer.rs":"ed299d3954e2a823060c870a8244673a7d4bca530830cb66b964d047a80ee3af","src/backend/mod.rs":"001af0a7f5bff53462ad1ca136fecf8f36449da1bcf96c26365dfdfd3476551d","src/backend/resampler.rs":"48bf8f56ae8d60dbabca6417b768000619abee8731ac3902164b45651ac08a4d","src/backend/tests/aggregate_device.rs":"e3f94e118e1dd47941fbba4417de40bddc4254d9f06b1e938f58d8f1aa566a5c","src/backend/tests/api.rs":"cd7e7551e2e82b19da883621a494d2a6779c373f3ff2d12ee52fae8efec1e7b8","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"f68c2eaa55c3ec2a58894832fbca1e2a2e79e740b145f76a0f45452af465a934","src/backend/tests/device_property.rs":"ea0be5f8834be494cb33f854ce9d334b5763dc5287f949bcb4bd025d8a8b2d3b","src/backend/tests/interfaces.rs":"20deac649297367da5dbe267847266d36680c5e3bd7ac3bf82776122d10b83e4","src/backend/tests/manual.rs":"8d485a6666a3f4518b03e39dab80bf2acfd760af2d2f43bad99023cb135b38ca","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"59632744e70616ab7037facb0787db339b96800c8cc397d203241548c5cfb7f5","src/backend/tests/tone.rs":"779cc14fc2a362bf7f26ce66ad70c0639501176175655a99b7fefb3c59d56c7a","src/backend/tests/utils.rs":"efb8b3709aff7ed5e2923566084de3e0709f3bd9c18a04f3310d7a3b86fa4b71","src/backend/utils.rs":"6c3ffbcd602e6cc9f56deb9ecb07b2eef2e6f074ef924178e466f380aae5c595","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"efc1f012eb9a331a040cad4ac03aa79307f25885f71b6fb38f3ad7af8d7d515c"},"package":null}

2
third_party/rust/cubeb-coreaudio/Cargo.toml поставляемый
Просмотреть файл

@ -29,7 +29,7 @@ crate-type = [
atomic = "0.4"
audio-mixer = "0.1"
bitflags = "2"
cubeb-backend = "0.10.7"
cubeb-backend = "0.12.0"
float-cmp = "0.6"
lazy_static = "1.2"
libc = "0.2"

Просмотреть файл

@ -35,8 +35,9 @@ use self::utils::*;
use atomic;
use backend::ringbuf::RingBuffer;
use cubeb_backend::{
ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceRef, DeviceType, Error, Ops,
Result, SampleFormat, State, Stream, StreamOps, StreamParams, StreamParamsRef, StreamPrefs,
ffi, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceRef, DeviceType, Error,
InputProcessingParams, Ops, Result, SampleFormat, State, Stream, StreamOps, StreamParams,
StreamParamsRef, StreamPrefs,
};
use mach::mach_time::{mach_absolute_time, mach_timebase_info};
use std::cmp;
@ -2169,6 +2170,9 @@ impl ContextOps for AudioUnitContext {
})?;
Ok(rate as u32)
}
fn supported_input_processing_params(&mut self) -> Result<InputProcessingParams> {
Ok(InputProcessingParams::NONE)
}
fn enumerate_devices(
&mut self,
devtype: DeviceType,
@ -4107,6 +4111,12 @@ impl<'ctx> StreamOps for AudioUnitStream<'ctx> {
fn current_device(&mut self) -> Result<&DeviceRef> {
Err(Error::not_supported())
}
fn set_input_mute(&mut self, _mute: bool) -> Result<()> {
Err(Error::not_supported())
}
fn set_input_processing_params(&mut self, _params: InputProcessingParams) -> Result<()> {
Err(Error::not_supported())
}
#[cfg(target_os = "ios")]
fn device_destroy(&mut self, device: &DeviceRef) -> Result<()> {
Err(not_supported())

Просмотреть файл

@ -1 +1 @@
{"files":{".editorconfig":"bf047bd1da10cabb99eea666d1e57c321eba4716dccb3e4ed0e2c5fe3ca53858",".github/workflows/build.yml":"477366d58c9dc059dbe4a158a6e910f23a3e9ecac7411f73616e06375583b764","AUTHORS":"0e0ac930a68ce2f6b876126b195add177f0d3886facb9260f4d9b69f1988f0cc","Cargo.toml":"4d1c9a6c9f887c37431c25da714206f9299ce5d13116ec3dbd9403abb2ed247c","LICENSE":"44c6b5ae5ec3fe2fbc608b00e6f4896f4d2d5c7e525fcbaa3eaa3cf2f3d5a983","README.md":"0079450bb4b013bac065ed1750851e461a3710ebad1f323817da1cb82db0bc4f","src/backend/context.rs":"d497b350ebde42287069232041680189338f8d003895aabb53b8b5055f1d4bbf","src/backend/cork_state.rs":"4a0f1afc7d9f333dac89218cc56d7d32fbffb487cd48c1c9a4e03d79cb3b5e28","src/backend/intern.rs":"11ca424e4eb77f8eb9fd5a6717d1e791facf9743156a8534f0016fcf64d57b0f","src/backend/mod.rs":"dfb30ec497d6215e4535e936fea8fe3a407ef24dc1cec43b52c0ffa923d9229c","src/backend/stream.rs":"7205d7a32773f4dae9142720a16281c5359901e237dc2f94cc6649e4daa7ae77","src/capi.rs":"fa0fa020f0d0efe55aa0fc3596405e8407bbe2cbe6c7a558345304e6da87994e","src/lib.rs":"b41bbdc562cbfb130ed7c1e53fe69944774f515705341d8ce48a2f82c8c0c2c5"},"package":null}
{"files":{".editorconfig":"bf047bd1da10cabb99eea666d1e57c321eba4716dccb3e4ed0e2c5fe3ca53858",".github/workflows/build.yml":"477366d58c9dc059dbe4a158a6e910f23a3e9ecac7411f73616e06375583b764","AUTHORS":"0e0ac930a68ce2f6b876126b195add177f0d3886facb9260f4d9b69f1988f0cc","Cargo.toml":"4bdd3962429c676eda59de96cad567478bb20b01c785c9ce3ba03b2e7837dd67","LICENSE":"44c6b5ae5ec3fe2fbc608b00e6f4896f4d2d5c7e525fcbaa3eaa3cf2f3d5a983","README.md":"0079450bb4b013bac065ed1750851e461a3710ebad1f323817da1cb82db0bc4f","src/backend/context.rs":"51dbf887e78aed5cd5e2255ac98f50c287960d8949ea3f66f2b05214b76800d8","src/backend/cork_state.rs":"4a0f1afc7d9f333dac89218cc56d7d32fbffb487cd48c1c9a4e03d79cb3b5e28","src/backend/intern.rs":"11ca424e4eb77f8eb9fd5a6717d1e791facf9743156a8534f0016fcf64d57b0f","src/backend/mod.rs":"dfb30ec497d6215e4535e936fea8fe3a407ef24dc1cec43b52c0ffa923d9229c","src/backend/stream.rs":"b3dcaa382981cbaa3af3c445b0ed6b5012b61d420d2e52a5ebd3cb0dd09a917c","src/capi.rs":"fa0fa020f0d0efe55aa0fc3596405e8407bbe2cbe6c7a558345304e6da87994e","src/lib.rs":"b41bbdc562cbfb130ed7c1e53fe69944774f515705341d8ce48a2f82c8c0c2c5"},"package":null}

4
third_party/rust/cubeb-pulse/Cargo.toml поставляемый
Просмотреть файл

@ -11,7 +11,7 @@
[package]
name = "cubeb-pulse"
version = "0.4.2"
version = "0.5.0"
authors = ["Dan Glastonbury <dglastonbury@mozilla.com>"]
description = "Cubeb backed for PulseAudio written in Rust"
readme = "README.md"
@ -24,7 +24,7 @@ crate-type = [
]
[dependencies]
cubeb-backend = "0.10.3"
cubeb-backend = "0.12.0"
ringbuf = "0.2"
semver = "1.0"

Просмотреть файл

@ -5,8 +5,8 @@
use backend::*;
use cubeb_backend::{
ffi, log_enabled, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceType, Error, Ops,
Result, Stream, StreamParams, StreamParamsRef,
ffi, log_enabled, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceType, Error,
InputProcessingParams, Ops, Result, Stream, StreamParams, StreamParamsRef,
};
use pulse::{self, ProplistExt};
use pulse_ffi::*;
@ -298,6 +298,10 @@ impl ContextOps for PulseContext {
}
}
fn supported_input_processing_params(&mut self) -> Result<InputProcessingParams> {
Ok(InputProcessingParams::NONE)
}
fn enumerate_devices(
&mut self,
devtype: DeviceType,

Просмотреть файл

@ -6,8 +6,8 @@
use backend::cork_state::CorkState;
use backend::*;
use cubeb_backend::{
ffi, log_enabled, ChannelLayout, DeviceId, DeviceRef, Error, Result, SampleFormat, StreamOps,
StreamParamsRef, StreamPrefs,
ffi, log_enabled, ChannelLayout, DeviceId, DeviceRef, Error, InputProcessingParams, Result,
SampleFormat, StreamOps, StreamParamsRef, StreamPrefs,
};
use pulse::{self, CVolumeExt, ChannelMapExt, SampleSpecExt, StreamLatency, USecExt};
use pulse_ffi::*;
@ -839,6 +839,14 @@ impl<'ctx> StreamOps for PulseStream<'ctx> {
}
}
fn set_input_mute(&mut self, _mute: bool) -> Result<()> {
Err(not_supported())
}
fn set_input_processing_params(&mut self, _params: InputProcessingParams) -> Result<()> {
Err(not_supported())
}
fn device_destroy(&mut self, device: &DeviceRef) -> Result<()> {
if device.as_ptr().is_null() {
cubeb_log!("Error: can't destroy null device");

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

3
third_party/rust/cubeb-sys/Cargo.toml поставляемый
Просмотреть файл

@ -11,10 +11,11 @@
[package]
name = "cubeb-sys"
version = "0.10.7"
version = "0.12.0"
authors = ["Dan Glastonbury <dglastonbury@mozilla.com>"]
build = "build.rs"
links = "cubeb"
exclude = ["libcubeb/googletest/"]
description = "Native bindings to the cubeb library"
license = "ISC"
repository = "https://github.com/mozilla/cubeb-rs"

Просмотреть файл

@ -258,6 +258,18 @@ typedef enum {
the jack backend. */
} cubeb_stream_prefs;
/**
* Input stream audio processing parameters. Only applicable with
* CUBEB_STREAM_PREF_VOICE.
*/
typedef enum {
CUBEB_INPUT_PROCESSING_PARAM_NONE = 0x00,
CUBEB_INPUT_PROCESSING_PARAM_ECHO_CANCELLATION = 0x01,
CUBEB_INPUT_PROCESSING_PARAM_NOISE_SUPPRESSION = 0x02,
CUBEB_INPUT_PROCESSING_PARAM_AUTOMATIC_GAIN_CONTROL = 0x04,
CUBEB_INPUT_PROCESSING_PARAM_VOICE_ISOLATION = 0x08,
} cubeb_input_processing_params;
/** Stream format initialization parameters. */
typedef struct {
cubeb_sample_format format; /**< Requested sample format. One of
@ -514,6 +526,18 @@ cubeb_get_min_latency(cubeb * context, cubeb_stream_params * params,
CUBEB_EXPORT int
cubeb_get_preferred_sample_rate(cubeb * context, uint32_t * rate);
/** Get the supported input processing features for this backend. See
cubeb_stream_set_input_processing for how to set them for a particular input
stream.
@param context A pointer to the cubeb context.
@param params Out parameter for the input processing params supported by
this backend.
@retval CUBEB_OK
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_get_supported_input_processing_params(
cubeb * context, cubeb_input_processing_params * params);
/** Destroy an application context. This must be called after all stream have
* been destroyed.
@param context A pointer to the cubeb context.*/
@ -641,6 +665,30 @@ CUBEB_EXPORT int
cubeb_stream_get_current_device(cubeb_stream * stm,
cubeb_device ** const device);
/** Set input mute state for this stream. Some platforms notify the user when an
application is accessing audio input. When all inputs are muted they can
prove to the user that the application is not actively capturing any input.
@param stream the stream for which to set input mute state
@param muted whether the input should mute or not
@retval CUBEB_OK
@retval CUBEB_ERROR_INVALID_PARAMETER if this stream does not have an input
device
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_set_input_mute(cubeb_stream * stream, int mute);
/** Set what input processing features to enable for this stream.
@param stream the stream for which to set input processing features.
@param params what input processing features to use
@retval CUBEB_OK
@retval CUBEB_ERROR if params could not be applied
@retval CUBEB_ERROR_INVALID_PARAMETER if a given param is not supported by
this backend, or if this stream does not have an input device
@retval CUBEB_ERROR_NOT_SUPPORTED */
CUBEB_EXPORT int
cubeb_stream_set_input_processing_params(cubeb_stream * stream,
cubeb_input_processing_params params);
/** Destroy a cubeb_device structure.
@param stream the stream passed in cubeb_stream_get_current_device
@param devices the devices to destroy

Просмотреть файл

@ -40,6 +40,8 @@ struct cubeb_ops {
int (*get_min_latency)(cubeb * context, cubeb_stream_params params,
uint32_t * latency_ms);
int (*get_preferred_sample_rate)(cubeb * context, uint32_t * rate);
int (*get_supported_input_processing_params)(
cubeb * context, cubeb_input_processing_params * params);
int (*enumerate_devices)(cubeb * context, cubeb_device_type type,
cubeb_device_collection * collection);
int (*device_collection_destroy)(cubeb * context,
@ -62,6 +64,9 @@ struct cubeb_ops {
int (*stream_set_name)(cubeb_stream * stream, char const * stream_name);
int (*stream_get_current_device)(cubeb_stream * stream,
cubeb_device ** const device);
int (*stream_set_input_mute)(cubeb_stream * stream, int mute);
int (*stream_set_input_processing_params)(
cubeb_stream * stream, cubeb_input_processing_params params);
int (*stream_device_destroy)(cubeb_stream * stream, cubeb_device * device);
int (*stream_register_device_changed_callback)(
cubeb_stream * stream,

Просмотреть файл

@ -341,6 +341,21 @@ cubeb_get_preferred_sample_rate(cubeb * context, uint32_t * rate)
return context->ops->get_preferred_sample_rate(context, rate);
}
int
cubeb_get_supported_input_processing_params(
cubeb * context, cubeb_input_processing_params * params)
{
if (!context || !params) {
return CUBEB_ERROR_INVALID_PARAMETER;
}
if (!context->ops->get_supported_input_processing_params) {
return CUBEB_ERROR_NOT_SUPPORTED;
}
return context->ops->get_supported_input_processing_params(context, params);
}
void
cubeb_destroy(cubeb * context)
{
@ -500,6 +515,36 @@ cubeb_stream_get_current_device(cubeb_stream * stream,
return stream->context->ops->stream_get_current_device(stream, device);
}
int
cubeb_stream_set_input_mute(cubeb_stream * stream, int mute)
{
if (!stream) {
return CUBEB_ERROR_INVALID_PARAMETER;
}
if (!stream->context->ops->stream_set_input_mute) {
return CUBEB_ERROR_NOT_SUPPORTED;
}
return stream->context->ops->stream_set_input_mute(stream, mute);
}
int
cubeb_stream_set_input_processing_params(cubeb_stream * stream,
cubeb_input_processing_params params)
{
if (!stream || !params) {
return CUBEB_ERROR_INVALID_PARAMETER;
}
if (!stream->context->ops->stream_set_input_processing_params) {
return CUBEB_ERROR_NOT_SUPPORTED;
}
return stream->context->ops->stream_set_input_processing_params(stream,
params);
}
int
cubeb_stream_device_destroy(cubeb_stream * stream, cubeb_device * device)
{

Просмотреть файл

@ -1736,6 +1736,7 @@ const static struct cubeb_ops aaudio_ops = {
/*.get_max_channel_count =*/aaudio_get_max_channel_count,
/* .get_min_latency =*/aaudio_get_min_latency,
/*.get_preferred_sample_rate =*/aaudio_get_preferred_sample_rate,
/*.get_supported_input_processing_params =*/nullptr,
/*.enumerate_devices =*/nullptr,
/*.device_collection_destroy =*/nullptr,
/*.destroy =*/aaudio_destroy,
@ -1749,6 +1750,8 @@ const static struct cubeb_ops aaudio_ops = {
/*.stream_set_volume =*/aaudio_stream_set_volume,
/*.stream_set_name =*/nullptr,
/*.stream_get_current_device =*/nullptr,
/*.stream_set_input_mute =*/nullptr,
/*.stream_set_input_processing_params =*/nullptr,
/*.stream_device_destroy =*/nullptr,
/*.stream_register_device_changed_callback =*/nullptr,
/*.register_device_collection_changed =*/nullptr};

Просмотреть файл

@ -1472,6 +1472,7 @@ static struct cubeb_ops const alsa_ops = {
.get_max_channel_count = alsa_get_max_channel_count,
.get_min_latency = alsa_get_min_latency,
.get_preferred_sample_rate = alsa_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = alsa_enumerate_devices,
.device_collection_destroy = alsa_device_collection_destroy,
.destroy = alsa_destroy,
@ -1485,6 +1486,8 @@ static struct cubeb_ops const alsa_ops = {
.stream_set_volume = alsa_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = NULL,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = NULL,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};

Просмотреть файл

@ -454,6 +454,7 @@ static struct cubeb_ops const audiotrack_ops = {
.get_max_channel_count = audiotrack_get_max_channel_count,
.get_min_latency = audiotrack_get_min_latency,
.get_preferred_sample_rate = audiotrack_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = NULL,
.device_collection_destroy = NULL,
.destroy = audiotrack_destroy,
@ -467,6 +468,8 @@ static struct cubeb_ops const audiotrack_ops = {
.stream_set_volume = audiotrack_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = NULL,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = NULL,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};

Просмотреть файл

@ -3665,6 +3665,7 @@ cubeb_ops const audiounit_ops = {
/*.get_max_channel_count =*/audiounit_get_max_channel_count,
/*.get_min_latency =*/audiounit_get_min_latency,
/*.get_preferred_sample_rate =*/audiounit_get_preferred_sample_rate,
/*.get_supported_input_processing_params =*/NULL,
/*.enumerate_devices =*/audiounit_enumerate_devices,
/*.device_collection_destroy =*/audiounit_device_collection_destroy,
/*.destroy =*/audiounit_destroy,
@ -3678,6 +3679,8 @@ cubeb_ops const audiounit_ops = {
/*.stream_set_volume =*/audiounit_stream_set_volume,
/*.stream_set_name =*/NULL,
/*.stream_get_current_device =*/audiounit_stream_get_current_device,
/*.stream_set_input_mute =*/NULL,
/*.stream_set_input_processing_params =*/NULL,
/*.stream_device_destroy =*/audiounit_stream_device_destroy,
/*.stream_register_device_changed_callback =*/
audiounit_stream_register_device_changed_callback,

Просмотреть файл

@ -160,6 +160,7 @@ static struct cubeb_ops const cbjack_ops = {
.get_max_channel_count = cbjack_get_max_channel_count,
.get_min_latency = cbjack_get_min_latency,
.get_preferred_sample_rate = cbjack_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = cbjack_enumerate_devices,
.device_collection_destroy = cbjack_device_collection_destroy,
.destroy = cbjack_destroy,
@ -173,6 +174,8 @@ static struct cubeb_ops const cbjack_ops = {
.stream_set_volume = cbjack_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = cbjack_stream_get_current_device,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = cbjack_stream_device_destroy,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};
@ -431,8 +434,10 @@ cbjack_process(jack_nframes_t nframes, void * arg)
if (stm->devs & OUT_ONLY) {
for (unsigned int c = 0; c < stm->out_params.channels; c++) {
float * buffer_out = bufs_out[c];
for (long f = 0; f < nframes; f++) {
buffer_out[f] = 0.f;
if (buffer_out) {
for (long f = 0; f < nframes; f++) {
buffer_out[f] = 0.f;
}
}
}
}
@ -440,8 +445,10 @@ cbjack_process(jack_nframes_t nframes, void * arg)
// paused, capture silence
for (unsigned int c = 0; c < stm->in_params.channels; c++) {
float * buffer_in = bufs_in[c];
for (long f = 0; f < nframes; f++) {
buffer_in[f] = 0.f;
if (buffer_in) {
for (long f = 0; f < nframes; f++) {
buffer_in[f] = 0.f;
}
}
}
}
@ -493,8 +500,10 @@ cbjack_process(jack_nframes_t nframes, void * arg)
if (stm->devs & OUT_ONLY) {
for (unsigned int c = 0; c < stm->out_params.channels; c++) {
float * buffer_out = bufs_out[c];
for (long f = 0; f < nframes; f++) {
buffer_out[f] = 0.f;
if (buffer_out) {
for (long f = 0; f < nframes; f++) {
buffer_out[f] = 0.f;
}
}
}
}
@ -502,8 +511,10 @@ cbjack_process(jack_nframes_t nframes, void * arg)
// capture silence
for (unsigned int c = 0; c < stm->in_params.channels; c++) {
float * buffer_in = bufs_in[c];
for (long f = 0; f < nframes; f++) {
buffer_in[f] = 0.f;
if (buffer_in) {
for (long f = 0; f < nframes; f++) {
buffer_in[f] = 0.f;
}
}
}
}
@ -542,20 +553,26 @@ cbjack_deinterleave_playback_refill_float(cubeb_stream * stream, float ** in,
for (unsigned int c = 0; c < stream->out_params.channels; c++) {
float * buffer = bufs_out[c];
for (long f = 0; f < done_frames; f++) {
buffer[f] =
out_interleaved_buffer[(f * stream->out_params.channels) + c] *
stream->volume;
if (buffer) {
buffer[f] =
out_interleaved_buffer[(f * stream->out_params.channels) + c] *
stream->volume;
}
}
if (done_frames < needed_frames) {
// draining
for (long f = done_frames; f < needed_frames; f++) {
buffer[f] = 0.f;
if (buffer) {
buffer[f] = 0.f;
}
}
}
if (done_frames == 0) {
// stop, but first zero out the existing buffer
for (long f = 0; f < needed_frames; f++) {
buffer[f] = 0.f;
if (buffer) {
buffer[f] = 0.f;
}
}
}
}

Просмотреть файл

@ -351,6 +351,7 @@ static struct cubeb_ops const kai_ops = {
/*.get_min_latency=*/kai_get_min_latency,
/*.get_preferred_sample_rate =*/kai_get_preferred_sample_rate,
/*.get_preferred_channel_layout =*/NULL,
/*.get_supported_input_processing_params =*/NULL,
/*.enumerate_devices =*/NULL,
/*.device_collection_destroy =*/NULL,
/*.destroy =*/kai_destroy,
@ -364,6 +365,8 @@ static struct cubeb_ops const kai_ops = {
/*.stream_set_volume =*/kai_stream_set_volume,
/*.stream_set_name =*/NULL,
/*.stream_get_current_device =*/NULL,
/*.stream_set_input_mute =*/NULL,
/*.stream_set_input_processing_params =*/NULL,
/*.stream_device_destroy =*/NULL,
/*.stream_register_device_changed_callback=*/NULL,
/*.register_device_collection_changed=*/NULL};

Просмотреть файл

@ -1934,6 +1934,7 @@ struct cubeb_ops const opensl_ops = {
.get_max_channel_count = opensl_get_max_channel_count,
.get_min_latency = nullptr,
.get_preferred_sample_rate = nullptr,
.get_supported_input_processing_params = nullptr,
.enumerate_devices = nullptr,
.device_collection_destroy = nullptr,
.destroy = opensl_destroy,
@ -1947,6 +1948,8 @@ struct cubeb_ops const opensl_ops = {
.stream_set_volume = opensl_stream_set_volume,
.stream_set_name = nullptr,
.stream_get_current_device = nullptr,
.stream_set_input_mute = nullptr,
.stream_set_input_processing_params = nullptr,
.stream_device_destroy = nullptr,
.stream_register_device_changed_callback = nullptr,
.register_device_collection_changed = nullptr};

Просмотреть файл

@ -1335,6 +1335,7 @@ static struct cubeb_ops const oss_ops = {
.get_max_channel_count = oss_get_max_channel_count,
.get_min_latency = oss_get_min_latency,
.get_preferred_sample_rate = oss_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = oss_enumerate_devices,
.device_collection_destroy = oss_device_collection_destroy,
.destroy = oss_destroy,
@ -1348,6 +1349,8 @@ static struct cubeb_ops const oss_ops = {
.stream_set_volume = oss_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = oss_get_current_device,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = oss_stream_device_destroy,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};

Просмотреть файл

@ -1690,6 +1690,7 @@ static struct cubeb_ops const pulse_ops = {
.get_max_channel_count = pulse_get_max_channel_count,
.get_min_latency = pulse_get_min_latency,
.get_preferred_sample_rate = pulse_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = pulse_enumerate_devices,
.device_collection_destroy = pulse_device_collection_destroy,
.destroy = pulse_destroy,
@ -1703,6 +1704,8 @@ static struct cubeb_ops const pulse_ops = {
.stream_set_volume = pulse_stream_set_volume,
.stream_set_name = pulse_stream_set_name,
.stream_get_current_device = pulse_stream_get_current_device,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = pulse_stream_device_destroy,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed =

Просмотреть файл

@ -667,6 +667,7 @@ static struct cubeb_ops const sndio_ops = {
.get_max_channel_count = sndio_get_max_channel_count,
.get_min_latency = sndio_get_min_latency,
.get_preferred_sample_rate = sndio_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = sndio_enumerate_devices,
.device_collection_destroy = sndio_device_collection_destroy,
.destroy = sndio_destroy,
@ -679,6 +680,8 @@ static struct cubeb_ops const sndio_ops = {
.stream_set_volume = sndio_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = NULL,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = NULL,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};

Просмотреть файл

@ -719,6 +719,7 @@ static struct cubeb_ops const sun_ops = {
.get_max_channel_count = sun_get_max_channel_count,
.get_min_latency = sun_get_min_latency,
.get_preferred_sample_rate = sun_get_preferred_sample_rate,
.get_supported_input_processing_params = NULL,
.enumerate_devices = sun_enumerate_devices,
.device_collection_destroy = sun_device_collection_destroy,
.destroy = sun_destroy,
@ -732,6 +733,8 @@ static struct cubeb_ops const sun_ops = {
.stream_set_volume = sun_stream_set_volume,
.stream_set_name = NULL,
.stream_get_current_device = sun_get_current_device,
.stream_set_input_mute = NULL,
.stream_set_input_processing_params = NULL,
.stream_device_destroy = sun_stream_device_destroy,
.stream_register_device_changed_callback = NULL,
.register_device_collection_changed = NULL};

Просмотреть файл

@ -3561,6 +3561,7 @@ cubeb_ops const wasapi_ops = {
/*.get_max_channel_count =*/wasapi_get_max_channel_count,
/*.get_min_latency =*/wasapi_get_min_latency,
/*.get_preferred_sample_rate =*/wasapi_get_preferred_sample_rate,
/*.get_supported_input_processing_params =*/NULL,
/*.enumerate_devices =*/wasapi_enumerate_devices,
/*.device_collection_destroy =*/wasapi_device_collection_destroy,
/*.destroy =*/wasapi_destroy,
@ -3574,6 +3575,8 @@ cubeb_ops const wasapi_ops = {
/*.stream_set_volume =*/wasapi_stream_set_volume,
/*.stream_set_name =*/NULL,
/*.stream_get_current_device =*/NULL,
/*.stream_set_input_mute =*/NULL,
/*.stream_set_input_processing_params =*/NULL,
/*.stream_device_destroy =*/NULL,
/*.stream_register_device_changed_callback =*/NULL,
/*.register_device_collection_changed =*/

Просмотреть файл

@ -1192,6 +1192,7 @@ static struct cubeb_ops const winmm_ops = {
/*.get_max_channel_count=*/winmm_get_max_channel_count,
/*.get_min_latency=*/winmm_get_min_latency,
/*.get_preferred_sample_rate =*/winmm_get_preferred_sample_rate,
/*.get_supported_input_processing_params =*/NULL,
/*.enumerate_devices =*/winmm_enumerate_devices,
/*.device_collection_destroy =*/winmm_device_collection_destroy,
/*.destroy =*/winmm_destroy,
@ -1205,6 +1206,8 @@ static struct cubeb_ops const winmm_ops = {
/*.stream_set_volume =*/winmm_stream_set_volume,
/*.stream_set_name =*/NULL,
/*.stream_get_current_device =*/NULL,
/*.stream_set_input_mute =*/NULL,
/*.stream_set_input_processing_params =*/NULL,
/*.stream_device_destroy =*/NULL,
/*.stream_register_device_changed_callback=*/NULL,
/*.register_device_collection_changed =*/NULL};

6
third_party/rust/cubeb-sys/src/context.rs поставляемый
Просмотреть файл

@ -6,7 +6,7 @@
use callbacks::{cubeb_data_callback, cubeb_state_callback};
use device::cubeb_devid;
use std::os::raw::{c_char, c_int, c_uint, c_void};
use stream::{cubeb_stream, cubeb_stream_params};
use stream::{cubeb_input_processing_params, cubeb_stream, cubeb_stream_params};
pub enum cubeb {}
@ -24,6 +24,10 @@ extern "C" {
latency_frames: *mut c_uint,
) -> c_int;
pub fn cubeb_get_preferred_sample_rate(context: *mut cubeb, rate: *mut c_uint) -> c_int;
pub fn cubeb_get_supported_input_processing_params(
context: *mut cubeb,
params: *mut cubeb_input_processing_params,
) -> c_int;
pub fn cubeb_destroy(context: *mut cubeb);
pub fn cubeb_stream_init(
context: *mut cubeb,

15
third_party/rust/cubeb-sys/src/stream.rs поставляемый
Просмотреть файл

@ -10,6 +10,16 @@ use format::cubeb_sample_format;
use std::os::raw::{c_char, c_float, c_int, c_uint, c_void};
use std::{fmt, mem};
cubeb_enum! {
pub enum cubeb_input_processing_params {
CUBEB_INPUT_PROCESSING_PARAM_NONE = 0x00,
CUBEB_INPUT_PROCESSING_PARAM_ECHO_CANCELLATION = 0x01,
CUBEB_INPUT_PROCESSING_PARAM_NOISE_SUPPRESSION = 0x02,
CUBEB_INPUT_PROCESSING_PARAM_AUTOMATIC_GAIN_CONTROL = 0x04,
CUBEB_INPUT_PROCESSING_PARAM_VOICE_ISOLATION = 0x08,
}
}
cubeb_enum! {
pub enum cubeb_stream_prefs {
CUBEB_STREAM_PREF_NONE = 0x00,
@ -73,6 +83,11 @@ extern "C" {
stream: *mut cubeb_stream,
device: *mut *mut cubeb_device,
) -> c_int;
pub fn cubeb_stream_set_input_mute(stream: *mut cubeb_stream, mute: c_int) -> c_int;
pub fn cubeb_stream_set_input_processing_params(
stream: *mut cubeb_stream,
params: cubeb_input_processing_params,
) -> c_int;
pub fn cubeb_stream_device_destroy(
stream: *mut cubeb_stream,
devices: *mut cubeb_device,

2
third_party/rust/cubeb/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.lock":"dda5df00fe4118364b4a7c3e970183189abee70830953a4067b0536b299bcaf0","Cargo.toml":"3b43b2da9fc4a66d148abf38b64f881e212ed4e6f419ad2bacf7ddb1e927e1b9","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","README.md":"408c573ec240927cf5b9c036098e94e374ec41f71991415422586f450586b214","examples/common/mod.rs":"3363405f3d21ad120617473a0288c337a7b15eb79f5bb1035cfd258bd9bedf2b","examples/devices.rs":"ff5dcd588e7036165c4b4c20ec355d036e0ae90cf88b3b0f5cd86621fe2ce61d","examples/tone.rs":"8f5f9851b6d99f6f16c597fcb9312e3ef81769cbfb89341d2ea2522ca2e2214e","src/context.rs":"176f0923c13245acdc3934f649608fea1c17ad254daa3396d8929f38374e932e","src/frame.rs":"649cedaa2e9e1c5d2c3146bd0d66fd28bb230e68142493a9ea7dbab4a15f5adc","src/lib.rs":"58c78cad9541ebaef0ea96c67bc1db7d25e68e4e3d2f9a90f371c473e25c181f","src/sample.rs":"0d4645cc1d6ac26f198f6f59a44e193422e5646ecef0de46224653bef79d1a10","src/stream.rs":"0f51eab71d08685afdd0e748b85513541b9a612da1cad329c8c897dc0f79607c"},"package":"7725c00f234bd83ebd8a5c0165a0856bb6414d9161b86cbb559250c94d8a4285"}
{"files":{"Cargo.lock":"d3b573eee37b0b0f709f168d4026071803c499f8c0d3efb830367d762c40754f","Cargo.toml":"8b0bd9b5b8f74492a893f3281dd14ca6ebd0f47ce3368c9927f16b76498fc340","LICENSE":"8c044baa5d883274736eeece0b955249076c2697b826e576fce59496235b2cf5","README.md":"408c573ec240927cf5b9c036098e94e374ec41f71991415422586f450586b214","examples/common/mod.rs":"3363405f3d21ad120617473a0288c337a7b15eb79f5bb1035cfd258bd9bedf2b","examples/devices.rs":"ff5dcd588e7036165c4b4c20ec355d036e0ae90cf88b3b0f5cd86621fe2ce61d","examples/tone.rs":"8f5f9851b6d99f6f16c597fcb9312e3ef81769cbfb89341d2ea2522ca2e2214e","src/context.rs":"176f0923c13245acdc3934f649608fea1c17ad254daa3396d8929f38374e932e","src/frame.rs":"649cedaa2e9e1c5d2c3146bd0d66fd28bb230e68142493a9ea7dbab4a15f5adc","src/lib.rs":"58c78cad9541ebaef0ea96c67bc1db7d25e68e4e3d2f9a90f371c473e25c181f","src/sample.rs":"0d4645cc1d6ac26f198f6f59a44e193422e5646ecef0de46224653bef79d1a10","src/stream.rs":"0f51eab71d08685afdd0e748b85513541b9a612da1cad329c8c897dc0f79607c"},"package":"6db57570f2617f0214c11721e8d2325816d9dc936c2c472661ac5d90a30fba98"}

22
third_party/rust/cubeb/Cargo.lock сгенерированный поставляемый
Просмотреть файл

@ -10,31 +10,31 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.73"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cmake"
version = "0.1.48"
version = "0.1.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a"
checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130"
dependencies = [
"cc",
]
[[package]]
name = "cubeb"
version = "0.10.3"
version = "0.12.0"
dependencies = [
"cubeb-core",
]
[[package]]
name = "cubeb-core"
version = "0.10.3"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6203cd567a2ae4382077cc2160738517462c93cf77f3910fa18b2a74549abc84"
checksum = "2380c03a7df0ea3744f6a210d6340f423935e53cbf2fd68ada84b5e808e46ac7"
dependencies = [
"bitflags",
"cubeb-sys",
@ -42,9 +42,9 @@ dependencies = [
[[package]]
name = "cubeb-sys"
version = "0.10.3"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d39f7f33260c72c5cbf5c59b294ae779f23569b6625bc5dea87ae254b2e949b6"
checksum = "3c20c457d7b34dad6e0c1a9c759c96b4420b9e9917a572998b81835799a07e1d"
dependencies = [
"cmake",
"pkg-config",
@ -52,6 +52,6 @@ dependencies = [
[[package]]
name = "pkg-config"
version = "0.3.25"
version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"

4
third_party/rust/cubeb/Cargo.toml поставляемый
Просмотреть файл

@ -11,7 +11,7 @@
[package]
name = "cubeb"
version = "0.10.3"
version = "0.12.0"
authors = ["Dan Glastonbury <dglastonbury@mozilla.com>"]
description = """
Bindings to libcubeb for interacting with system audio from rust.
@ -24,7 +24,7 @@ license = "ISC"
repository = "https://github.com/mozilla/cubeb-rs"
[dependencies.cubeb-core]
version = "0.10.3"
version = "0.12.0"
[features]
gecko-in-tree = ["cubeb-core/gecko-in-tree"]

Просмотреть файл

@ -22,11 +22,11 @@ static_prefs = { path = "../../../../modules/libpref/init/static_prefs" }
profiler_helper = { path = "../../../../tools/profiler/rust-helper", optional = true }
mozurl = { path = "../../../../netwerk/base/mozurl" }
webrender_bindings = { path = "../../../../gfx/webrender_bindings" }
cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev = "89abc256a2eab3398f880e114b2d8308f5bc1d1a", optional = true }
cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="c04c4d2c7f2291cb81a1c48f5a8c425748f18cd8", optional = true, features=["pulse-dlopen"] }
cubeb-sys = { version = "0.10.7", optional = true, features=["gecko-in-tree"] }
audioipc2-client = { git = "https://github.com/mozilla/audioipc", rev = "44fbcd2b5417f8b5ff4907eec17b32a0fb633e03", optional = true }
audioipc2-server = { git = "https://github.com/mozilla/audioipc", rev = "44fbcd2b5417f8b5ff4907eec17b32a0fb633e03", optional = true }
cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev = "a0534f6e910213fd4f7387a9ed03c980ff20da1d", optional = true }
cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="8ff972c8e2ec1782ff262ac4071c0415e69b1367", optional = true, features=["pulse-dlopen"] }
cubeb-sys = { version = "0.12.0", optional = true, features=["gecko-in-tree"] }
audioipc2-client = { git = "https://github.com/mozilla/audioipc", rev = "8b391135f9421dc5ab0c45f646c21651a906ce7f", optional = true }
audioipc2-server = { git = "https://github.com/mozilla/audioipc", rev = "8b391135f9421dc5ab0c45f646c21651a906ce7f", optional = true }
encoding_glue = { path = "../../../../intl/encoding_glue" }
authrs_bridge = { path = "../../../../dom/webauthn/authrs_bridge" }
gkrust_utils = { path = "../../../../xpcom/rust/gkrust_utils" }