Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit e7c3c62

Browse files
committed
Bug 1693186 - Update cubeb to 9beb8ed0. r=cubeb-reviewers,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D105374
1 parent 8f2e19e commit e7c3c62

3 files changed

Lines changed: 28 additions & 23 deletions

File tree

media/libcubeb/moz.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ origin:
1919
license: "ISC"
2020

2121
# update.sh will update this value
22-
release: "4a83932caee16c9ee404b39144620fcbcc7a842f (2021-01-19 16:05:14 +0100)"
22+
release: "9beb8ed0c91f1b6ed7769d2c28c94a1d78b6c6f1 (2021-02-17 10:22:19 +1300)"
2323

media/libcubeb/src/cubeb_jack.cpp

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ enum devstream {
6464
DUPLEX,
6565
};
6666

67+
enum cbjack_connect_ports_options {
68+
CBJACK_CP_OPTIONS_NONE = 0x0,
69+
CBJACK_CP_OPTIONS_SKIP_OUTPUT = 0x1,
70+
CBJACK_CP_OPTIONS_SKIP_INPUT = 0x2,
71+
};
72+
6773
static void
6874
s16ne_to_float(float * dst, const int16_t * src, size_t n)
6975
{
@@ -256,7 +262,7 @@ cbjack_connect_port_in (cubeb_stream * stream, const char * const phys_out_port,
256262
}
257263

258264
static int
259-
cbjack_connect_ports (cubeb_stream * stream)
265+
cbjack_connect_ports (cubeb_stream * stream, enum cbjack_connect_ports_options options)
260266
{
261267
int r = CUBEB_ERROR;
262268
const char ** phys_in_ports = api_jack_get_ports (stream->context->jack_client,
@@ -268,7 +274,7 @@ cbjack_connect_ports (cubeb_stream * stream)
268274
JackPortIsOutput
269275
| JackPortIsPhysical);
270276

271-
if (phys_in_ports == NULL || *phys_in_ports == NULL) {
277+
if (phys_in_ports == NULL || *phys_in_ports == NULL || options & CBJACK_CP_OPTIONS_SKIP_OUTPUT) {
272278
goto skipplayback;
273279
}
274280

@@ -285,7 +291,7 @@ cbjack_connect_ports (cubeb_stream * stream)
285291
r = CUBEB_OK;
286292

287293
skipplayback:
288-
if (phys_out_ports == NULL || *phys_out_ports == NULL) {
294+
if (phys_out_ports == NULL || *phys_out_ports == NULL || options & CBJACK_CP_OPTIONS_SKIP_INPUT) {
289295
goto end;
290296
}
291297
// Connect inputs to capture
@@ -892,6 +898,13 @@ cbjack_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_
892898
JACK_DEFAULT_AUDIO_TYPE,
893899
JackPortIsOutput,
894900
0);
901+
if (!(output_stream_params->prefs & CUBEB_STREAM_PREF_JACK_NO_AUTO_CONNECT)) {
902+
if (cbjack_connect_ports(stm, CBJACK_CP_OPTIONS_SKIP_INPUT) != CUBEB_OK) {
903+
pthread_mutex_unlock(&stm->mutex);
904+
cbjack_stream_destroy(stm);
905+
return CUBEB_ERROR;
906+
}
907+
}
895908
}
896909
}
897910

@@ -904,14 +917,13 @@ cbjack_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_
904917
JACK_DEFAULT_AUDIO_TYPE,
905918
JackPortIsInput,
906919
0);
907-
}
908-
}
909-
910-
if (!input_stream_params->prefs & CUBEB_STREAM_PREF_JACK_NO_AUTO_CONNECT) {
911-
if (cbjack_connect_ports(stm) != CUBEB_OK) {
912-
pthread_mutex_unlock(&stm->mutex);
913-
cbjack_stream_destroy(stm);
914-
return CUBEB_ERROR;
920+
if (!(input_stream_params->prefs & CUBEB_STREAM_PREF_JACK_NO_AUTO_CONNECT)) {
921+
if (cbjack_connect_ports(stm, CBJACK_CP_OPTIONS_SKIP_OUTPUT) != CUBEB_OK) {
922+
pthread_mutex_unlock(&stm->mutex);
923+
cbjack_stream_destroy(stm);
924+
return CUBEB_ERROR;
925+
}
926+
}
915927
}
916928
}
917929

media/libcubeb/src/cubeb_wasapi.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,34 +1340,27 @@ void wasapi_destroy(cubeb * context);
13401340

13411341
HRESULT register_notification_client(cubeb_stream * stm)
13421342
{
1343-
assert(stm->device_enumerator);
1343+
XASSERT(stm->device_enumerator);
13441344

13451345
stm->notification_client.reset(new wasapi_endpoint_notification_client(stm->reconfigure_event, stm->role));
13461346

13471347
HRESULT hr = stm->device_enumerator->RegisterEndpointNotificationCallback(stm->notification_client.get());
13481348
if (FAILED(hr)) {
13491349
LOG("Could not register endpoint notification callback: %lx", hr);
13501350
stm->notification_client = nullptr;
1351-
stm->device_enumerator = nullptr;
13521351
}
13531352

13541353
return hr;
13551354
}
13561355

13571356
HRESULT unregister_notification_client(cubeb_stream * stm)
13581357
{
1359-
XASSERT(stm);
1360-
HRESULT hr;
1361-
1362-
if (!stm->device_enumerator) {
1363-
return S_OK;
1364-
}
1358+
XASSERT(stm->device_enumerator);
13651359

1366-
hr = stm->device_enumerator->UnregisterEndpointNotificationCallback(stm->notification_client.get());
1360+
HRESULT hr = stm->device_enumerator->UnregisterEndpointNotificationCallback(stm->notification_client.get());
13671361
if (FAILED(hr)) {
13681362
// We can't really do anything here, we'll probably leak the
1369-
// notification client, but we can at least release the enumerator.
1370-
stm->device_enumerator = nullptr;
1363+
// notification client.
13711364
return S_OK;
13721365
}
13731366

0 commit comments

Comments
 (0)