aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_pulse.c
diff options
context:
space:
mode:
authorDan Glastonbury <[email protected]>2017-09-26 12:15:05 +1000
committerMatthew Gregan <[email protected]>2017-09-26 15:30:58 +1300
commit69b9bc88246d4d5280f9ec702e4f5150c06eb358 (patch)
tree5e7e7b836107b1630b9547fb17e1c1c6a24cd774 /src/cubeb_pulse.c
parent7e39a922ad6c66f35649614f8fdff0e47675bf56 (diff)
downloadcubeb-69b9bc88246d4d5280f9ec702e4f5150c06eb358.tar.gz
cubeb-69b9bc88246d4d5280f9ec702e4f5150c06eb358.zip
pulse: Wake up waiting operation once on EOL.
When enumerating devices, the main thread was being unnecessarily woken up for each sink/source. Change to just signal when the end-of-list (EOL) is reached. Also removes use of goto which is, in my book, a win.
Diffstat (limited to 'src/cubeb_pulse.c')
-rw-r--r--src/cubeb_pulse.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/cubeb_pulse.c b/src/cubeb_pulse.c
index 153ae82..07a1717 100644
--- a/src/cubeb_pulse.c
+++ b/src/cubeb_pulse.c
@@ -1246,13 +1246,18 @@ pulse_sink_info_cb(pa_context * context, const pa_sink_info * info,
(void)context;
- if (eol || info == NULL)
- goto exit;
+ if (eol) {
+ WRAP(pa_threaded_mainloop_signal)(list_data->context->mainloop, 0);
+ return;
+ }
+
+ if (info == NULL)
+ return;
device_id = info->name;
if (intern_device_id(list_data->context, &device_id) != CUBEB_OK) {
assert(false);
- goto exit;
+ return;
}
pulse_ensure_dev_list_data_list_size(list_data);
@@ -1285,9 +1290,6 @@ pulse_sink_info_cb(pa_context * context, const pa_sink_info * info,
devinfo->latency_hi = 0;
list_data->count += 1;
-
-exit:
- WRAP(pa_threaded_mainloop_signal)(list_data->context->mainloop, 0);
}
static cubeb_device_state
@@ -1316,13 +1318,15 @@ pulse_source_info_cb(pa_context * context, const pa_source_info * info,
(void)context;
- if (eol)
- goto exit;
+ if (eol) {
+ WRAP(pa_threaded_mainloop_signal)(list_data->context->mainloop, 0);
+ return;
+ }
device_id = info->name;
if (intern_device_id(list_data->context, &device_id) != CUBEB_OK) {
assert(false);
- goto exit;
+ return;
}
pulse_ensure_dev_list_data_list_size(list_data);
@@ -1355,9 +1359,6 @@ pulse_source_info_cb(pa_context * context, const pa_source_info * info,
devinfo->latency_hi = 0;
list_data->count += 1;
-
-exit:
- WRAP(pa_threaded_mainloop_signal)(list_data->context->mainloop, 0);
}
static void