summaryrefslogtreecommitdiffstats
path: root/src/modules/jack/module-jack-source.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/jack/module-jack-source.c')
-rw-r--r--src/modules/jack/module-jack-source.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/modules/jack/module-jack-source.c b/src/modules/jack/module-jack-source.c
index ef89a98e..13109f3e 100644
--- a/src/modules/jack/module-jack-source.c
+++ b/src/modules/jack/module-jack-source.c
@@ -24,19 +24,15 @@
#endif
#include <stdlib.h>
-#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
-#include <fcntl.h>
#include <unistd.h>
-#include <limits.h>
#include <jack/jack.h>
#include <pulse/xmalloc.h>
-#include <pulsecore/core-error.h>
#include <pulsecore/source.h>
#include <pulsecore/module.h>
#include <pulsecore/core-util.h>
@@ -196,7 +192,6 @@ static void thread_func(void *userdata) {
pa_make_realtime(u->core->realtime_priority);
pa_thread_mq_install(&u->thread_mq);
- pa_rtpoll_install(u->rtpoll);
for (;;) {
int ret;
@@ -287,11 +282,12 @@ int pa__init(pa_module*m) {
goto fail;
}
- ports = jack_get_ports(u->client, NULL, NULL, JackPortIsPhysical|JackPortIsOutput);
+ ports = jack_get_ports(u->client, NULL, JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical|JackPortIsOutput);
channels = 0;
- for (p = ports; *p; p++)
- channels++;
+ if (ports)
+ for (p = ports; *p; p++)
+ channels++;
if (!channels)
channels = m->core->default_sample_spec.channels;
@@ -364,7 +360,7 @@ int pa__init(pa_module*m) {
jack_on_shutdown(u->client, jack_shutdown, u);
jack_set_thread_init_callback(u->client, jack_init, u);
- if (!(u->thread = pa_thread_new(thread_func, u))) {
+ if (!(u->thread = pa_thread_new("jack-source", thread_func, u))) {
pa_log("Failed to create thread.");
goto fail;
}
@@ -377,7 +373,7 @@ int pa__init(pa_module*m) {
if (do_connect) {
for (i = 0, p = ports; i < ss.channels; i++, p++) {
- if (!*p) {
+ if (!p || !*p) {
pa_log("Not enough physical output ports, leaving unconnected.");
break;
}
@@ -394,7 +390,8 @@ int pa__init(pa_module*m) {
pa_source_put(u->source);
- free(ports);
+ if (ports)
+ jack_free(ports);
pa_modargs_free(ma);
return 0;
@@ -403,7 +400,8 @@ fail:
if (ma)
pa_modargs_free(ma);
- free(ports);
+ if (ports)
+ jack_free(ports);
pa__done(m);
@@ -426,12 +424,12 @@ void pa__done(pa_module*m) {
if (!(u = m->userdata))
return;
- if (u->client)
- jack_client_close(u->client);
-
if (u->source)
pa_source_unlink(u->source);
+ if (u->client)
+ jack_client_close(u->client);
+
if (u->thread) {
pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0, NULL);
pa_thread_free(u->thread);