@@ -33,6 +33,7 @@ | |||||
#include "internal.h" | #include "internal.h" | ||||
#include "engine.h" | #include "engine.h" | ||||
#include "messagebuffer.h" | #include "messagebuffer.h" | ||||
#include "libjack/local.h" | |||||
#include <sysdeps/time.h> | #include <sysdeps/time.h> | ||||
@@ -1721,6 +1722,33 @@ alsa_driver_run_cycle (alsa_driver_t *driver) | |||||
return engine->run_cycle (engine, nframes, delayed_usecs); | return engine->run_cycle (engine, nframes, delayed_usecs); | ||||
} | } | ||||
static void | |||||
alsa_driver_latency_callback (jack_latency_callback_mode_t mode, void* arg) | |||||
{ | |||||
alsa_driver_t* driver = (alsa_driver_t*) arg; | |||||
jack_client_t* client = driver->client; | |||||
jack_latency_range_t range; | |||||
JSList* node; | |||||
if (mode == JackPlaybackLatency) { | |||||
range.min = range.max = driver->frames_per_cycle + driver->playback_frame_latency; | |||||
} else { | |||||
range.min = range.max = driver->frames_per_cycle + driver->capture_frame_latency; | |||||
} | |||||
for (node = client->ports; node; node = jack_slist_next (node)) { | |||||
jack_port_t *port = node->data; | |||||
if ((jack_port_flags (port) & JackPortIsOutput) && (mode == JackPlaybackLatency)) { | |||||
jack_port_set_latency_range (port, JackPlaybackLatency, &range); | |||||
} | |||||
if ((jack_port_flags (port) & JackPortIsInput) && (mode == JackCaptureLatency)) { | |||||
jack_port_set_latency_range (port, JackCaptureLatency, &range); | |||||
} | |||||
} | |||||
} | |||||
static int | static int | ||||
alsa_driver_attach (alsa_driver_t *driver) | alsa_driver_attach (alsa_driver_t *driver) | ||||
{ | { | ||||
@@ -2367,7 +2395,9 @@ alsa_driver_new (char *name, char *playback_alsa_device, | |||||
driver->capture_and_playback_not_synced = TRUE; | driver->capture_and_playback_not_synced = TRUE; | ||||
} | } | ||||
} | } | ||||
jack_set_latency_callback (client, alsa_driver_latency_callback, driver); | |||||
driver->client = client; | driver->client = client; | ||||
return (jack_driver_t *) driver; | return (jack_driver_t *) driver; | ||||
@@ -1 +1 @@ | |||||
Subproject commit 66b41b24b448053a73aebc383745b0f4549eb5bd | |||||
Subproject commit 433a4ab01fa84ff04e7753e80f5bfce04ad38810 |
@@ -1385,7 +1385,10 @@ do_request (jack_engine_t *engine, jack_request_t *req, int *reply_fd) | |||||
case SetBufferSize: | case SetBufferSize: | ||||
req->status = jack_set_buffer_size_request (engine, | req->status = jack_set_buffer_size_request (engine, | ||||
req->x.nframes); | |||||
req->x.nframes); | |||||
jack_lock_graph (engine); | |||||
jack_compute_new_latency (engine); | |||||
jack_unlock_graph (engine); | |||||
break; | break; | ||||
case IntClientHandle: | case IntClientHandle: | ||||
@@ -2959,7 +2962,7 @@ jack_deliver_event (jack_engine_t *engine, jack_client_internal_t *client, | |||||
/* caller must hold the graph lock */ | /* caller must hold the graph lock */ | ||||
DEBUG ("delivering event (type %d)", event->type); | |||||
DEBUG ("delivering event (type %s)", jack_event_type_name (event->type)); | |||||
/* we are not RT-constrained here, so use kill(2) to beef up | /* we are not RT-constrained here, so use kill(2) to beef up | ||||
our check on a client's continued well-being | our check on a client's continued well-being | ||||
@@ -589,13 +589,14 @@ jack_client_handle_latency_callback (jack_client_t *client, jack_event_t *event, | |||||
} | } | ||||
} | } | ||||
/* for a driver invocation, this is enough. | |||||
/* for a driver invocation without its own latency callback, this is enough. | |||||
* input and output ports do not depend on each other. | * input and output ports do not depend on each other. | ||||
*/ | */ | ||||
if (is_driver) | |||||
if (is_driver && !client->control->latency_cbset) { | |||||
return 0; | return 0; | ||||
if (! client->control->latency_cbset) { | |||||
} | |||||
if (!client->control->latency_cbset) { | |||||
/* | /* | ||||
* default action is to assume all ports depend on each other. | * default action is to assume all ports depend on each other. | ||||
* then always take the maximum latency. | * then always take the maximum latency. | ||||
@@ -1 +1 @@ | |||||
Subproject commit c6b4b572f543ce25588eec4d471905dffe52d196 | |||||
Subproject commit 840bbbf8cfe33a59a5b1b4a33e72f2aa6221d0b7 |