Bug 1693186 - Update cubeb to 9beb8ed0. r=cubeb-reviewers,chunmin

Differential Revision: https://phabricator.services.mozilla.com/D105374
This commit is contained in:
Matthew Gregan 2021-02-16 23:15:47 +00:00
Родитель 8f2e19e4c5
Коммит e7c3c62dc1
3 изменённых файлов: 28 добавлений и 23 удалений

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

@ -19,5 +19,5 @@ origin:
license: "ISC"
# update.sh will update this value
release: "4a83932caee16c9ee404b39144620fcbcc7a842f (2021-01-19 16:05:14 +0100)"
release: "9beb8ed0c91f1b6ed7769d2c28c94a1d78b6c6f1 (2021-02-17 10:22:19 +1300)"

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

@ -64,6 +64,12 @@ enum devstream {
DUPLEX,
};
enum cbjack_connect_ports_options {
CBJACK_CP_OPTIONS_NONE = 0x0,
CBJACK_CP_OPTIONS_SKIP_OUTPUT = 0x1,
CBJACK_CP_OPTIONS_SKIP_INPUT = 0x2,
};
static void
s16ne_to_float(float * dst, const int16_t * src, size_t n)
{
@ -256,7 +262,7 @@ cbjack_connect_port_in (cubeb_stream * stream, const char * const phys_out_port,
}
static int
cbjack_connect_ports (cubeb_stream * stream)
cbjack_connect_ports (cubeb_stream * stream, enum cbjack_connect_ports_options options)
{
int r = CUBEB_ERROR;
const char ** phys_in_ports = api_jack_get_ports (stream->context->jack_client,
@ -268,7 +274,7 @@ cbjack_connect_ports (cubeb_stream * stream)
JackPortIsOutput
| JackPortIsPhysical);
if (phys_in_ports == NULL || *phys_in_ports == NULL) {
if (phys_in_ports == NULL || *phys_in_ports == NULL || options & CBJACK_CP_OPTIONS_SKIP_OUTPUT) {
goto skipplayback;
}
@ -285,7 +291,7 @@ cbjack_connect_ports (cubeb_stream * stream)
r = CUBEB_OK;
skipplayback:
if (phys_out_ports == NULL || *phys_out_ports == NULL) {
if (phys_out_ports == NULL || *phys_out_ports == NULL || options & CBJACK_CP_OPTIONS_SKIP_INPUT) {
goto end;
}
// Connect inputs to capture
@ -892,6 +898,13 @@ cbjack_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput,
0);
if (!(output_stream_params->prefs & CUBEB_STREAM_PREF_JACK_NO_AUTO_CONNECT)) {
if (cbjack_connect_ports(stm, CBJACK_CP_OPTIONS_SKIP_INPUT) != CUBEB_OK) {
pthread_mutex_unlock(&stm->mutex);
cbjack_stream_destroy(stm);
return CUBEB_ERROR;
}
}
}
}
@ -904,14 +917,13 @@ cbjack_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsInput,
0);
}
}
if (!input_stream_params->prefs & CUBEB_STREAM_PREF_JACK_NO_AUTO_CONNECT) {
if (cbjack_connect_ports(stm) != CUBEB_OK) {
pthread_mutex_unlock(&stm->mutex);
cbjack_stream_destroy(stm);
return CUBEB_ERROR;
if (!(input_stream_params->prefs & CUBEB_STREAM_PREF_JACK_NO_AUTO_CONNECT)) {
if (cbjack_connect_ports(stm, CBJACK_CP_OPTIONS_SKIP_OUTPUT) != CUBEB_OK) {
pthread_mutex_unlock(&stm->mutex);
cbjack_stream_destroy(stm);
return CUBEB_ERROR;
}
}
}
}

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

@ -1340,7 +1340,7 @@ void wasapi_destroy(cubeb * context);
HRESULT register_notification_client(cubeb_stream * stm)
{
assert(stm->device_enumerator);
XASSERT(stm->device_enumerator);
stm->notification_client.reset(new wasapi_endpoint_notification_client(stm->reconfigure_event, stm->role));
@ -1348,7 +1348,6 @@ HRESULT register_notification_client(cubeb_stream * stm)
if (FAILED(hr)) {
LOG("Could not register endpoint notification callback: %lx", hr);
stm->notification_client = nullptr;
stm->device_enumerator = nullptr;
}
return hr;
@ -1356,18 +1355,12 @@ HRESULT register_notification_client(cubeb_stream * stm)
HRESULT unregister_notification_client(cubeb_stream * stm)
{
XASSERT(stm);
HRESULT hr;
XASSERT(stm->device_enumerator);
if (!stm->device_enumerator) {
return S_OK;
}
hr = stm->device_enumerator->UnregisterEndpointNotificationCallback(stm->notification_client.get());
HRESULT hr = stm->device_enumerator->UnregisterEndpointNotificationCallback(stm->notification_client.get());
if (FAILED(hr)) {
// We can't really do anything here, we'll probably leak the
// notification client, but we can at least release the enumerator.
stm->device_enumerator = nullptr;
// notification client.
return S_OK;
}