mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
loopback: pass all latency to the other stream
Latency configured on one streams needs to be passed directly to the other stream.
This commit is contained in:
parent
f71529cbaf
commit
7d9dde0a1d
1 changed files with 17 additions and 10 deletions
|
|
@ -165,7 +165,8 @@ static void capture_process(void *d)
|
|||
pw_stream_queue_buffer(impl->playback, out);
|
||||
}
|
||||
|
||||
static void param_latency_changed(struct impl *impl, const struct spa_pod *param)
|
||||
static void param_latency_changed(struct impl *impl, const struct spa_pod *param,
|
||||
struct pw_stream *other)
|
||||
{
|
||||
struct spa_latency_info latency;
|
||||
uint8_t buffer[1024];
|
||||
|
|
@ -177,20 +178,16 @@ static void param_latency_changed(struct impl *impl, const struct spa_pod *param
|
|||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
params[0] = spa_latency_build(&b, SPA_PARAM_Latency, &latency);
|
||||
|
||||
if (latency.direction == SPA_DIRECTION_INPUT)
|
||||
pw_stream_update_params(impl->capture, params, 1);
|
||||
else
|
||||
pw_stream_update_params(impl->playback, params, 1);
|
||||
pw_stream_update_params(other, params, 1);
|
||||
}
|
||||
|
||||
static void param_changed(void *data, uint32_t id, const struct spa_pod *param)
|
||||
static void capture_param_changed(void *data, uint32_t id, const struct spa_pod *param)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
|
||||
switch (id) {
|
||||
case SPA_PARAM_Latency:
|
||||
param_latency_changed(impl, param);
|
||||
param_latency_changed(impl, param, impl->playback);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -199,7 +196,7 @@ static const struct pw_stream_events in_stream_events = {
|
|||
PW_VERSION_STREAM_EVENTS,
|
||||
.destroy = capture_destroy,
|
||||
.process = capture_process,
|
||||
.param_changed = param_changed,
|
||||
.param_changed = capture_param_changed,
|
||||
};
|
||||
|
||||
static void playback_destroy(void *d)
|
||||
|
|
@ -209,10 +206,20 @@ static void playback_destroy(void *d)
|
|||
impl->playback = NULL;
|
||||
}
|
||||
|
||||
static void playback_param_changed(void *data, uint32_t id, const struct spa_pod *param)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
|
||||
switch (id) {
|
||||
case SPA_PARAM_Latency:
|
||||
param_latency_changed(impl, param, impl->capture);
|
||||
break;
|
||||
}
|
||||
}
|
||||
static const struct pw_stream_events out_stream_events = {
|
||||
PW_VERSION_STREAM_EVENTS,
|
||||
.destroy = playback_destroy,
|
||||
.param_changed = param_changed,
|
||||
.param_changed = playback_param_changed,
|
||||
};
|
||||
|
||||
static int setup_streams(struct impl *impl)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue