mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
modules: update Props and ProcessLatency
When setting Props or ProcessLatency on a stream, it doesn't actually remember the values that were set so we need to manually update them. See #4731
This commit is contained in:
parent
3d8a19af33
commit
3d1c9f1cce
2 changed files with 18 additions and 12 deletions
|
|
@ -1198,26 +1198,32 @@ static int reset_graph(struct impl *impl)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_latency(struct impl *impl, enum spa_direction direction)
|
static void update_latency(struct impl *impl, enum spa_direction direction, bool process)
|
||||||
{
|
{
|
||||||
struct spa_latency_info latency;
|
struct spa_latency_info latency;
|
||||||
uint8_t buffer[1024];
|
uint8_t buffer[1024];
|
||||||
struct spa_pod_builder b;
|
struct spa_pod_builder b;
|
||||||
const struct spa_pod *params[1];
|
const struct spa_pod *params[2];
|
||||||
|
uint32_t n_params = 0;
|
||||||
struct pw_stream *s = direction == SPA_DIRECTION_OUTPUT ?
|
struct pw_stream *s = direction == SPA_DIRECTION_OUTPUT ?
|
||||||
impl->playback : impl->capture;
|
impl->playback : impl->capture;
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
latency = impl->latency[direction];
|
latency = impl->latency[direction];
|
||||||
spa_process_latency_info_add(&impl->process_latency, &latency);
|
spa_process_latency_info_add(&impl->process_latency, &latency);
|
||||||
params[0] = spa_latency_build(&b, SPA_PARAM_Latency, &latency);
|
params[n_params++] = spa_latency_build(&b, SPA_PARAM_Latency, &latency);
|
||||||
pw_stream_update_params(s, params, 1);
|
|
||||||
|
if (process) {
|
||||||
|
params[n_params++] = spa_process_latency_build(&b,
|
||||||
|
SPA_PARAM_ProcessLatency, &impl->process_latency);
|
||||||
|
}
|
||||||
|
pw_stream_update_params(s, params, n_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_latencies(struct impl *impl)
|
static void update_latencies(struct impl *impl, bool process)
|
||||||
{
|
{
|
||||||
update_latency(impl, SPA_DIRECTION_INPUT);
|
update_latency(impl, SPA_DIRECTION_INPUT, process);
|
||||||
update_latency(impl, SPA_DIRECTION_OUTPUT);
|
update_latency(impl, SPA_DIRECTION_OUTPUT, process);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
|
|
@ -1229,7 +1235,7 @@ static void param_latency_changed(struct impl *impl, const struct spa_pod *param
|
||||||
return;
|
return;
|
||||||
|
|
||||||
impl->latency[latency.direction] = latency;
|
impl->latency[latency.direction] = latency;
|
||||||
update_latency(impl, latency.direction);
|
update_latency(impl, latency.direction, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void param_process_latency_changed(struct impl *impl, const struct spa_pod *param,
|
static void param_process_latency_changed(struct impl *impl, const struct spa_pod *param,
|
||||||
|
|
@ -1245,7 +1251,7 @@ static void param_process_latency_changed(struct impl *impl, const struct spa_po
|
||||||
return;
|
return;
|
||||||
|
|
||||||
impl->process_latency = process_latency;
|
impl->process_latency = process_latency;
|
||||||
update_latencies(impl);
|
update_latencies(impl, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void param_tag_changed(struct impl *impl, const struct spa_pod *param,
|
static void param_tag_changed(struct impl *impl, const struct spa_pod *param,
|
||||||
|
|
@ -1567,7 +1573,7 @@ static void graph_info(void *object, const struct spa_filter_graph_info *info)
|
||||||
if (spa_atod(s, &latency)) {
|
if (spa_atod(s, &latency)) {
|
||||||
if (impl->process_latency.rate != (int32_t)latency) {
|
if (impl->process_latency.rate != (int32_t)latency) {
|
||||||
impl->process_latency.rate = (int32_t)latency;
|
impl->process_latency.rate = (int32_t)latency;
|
||||||
update_latencies(impl);
|
update_latencies(impl, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -501,7 +501,7 @@ static void param_process_latency_changed(struct impl *impl, const struct spa_po
|
||||||
return;
|
return;
|
||||||
|
|
||||||
impl->process_latency = info;
|
impl->process_latency = info;
|
||||||
update_latencies(impl, true, false);
|
update_latencies(impl, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void param_props_changed(struct impl *impl, const struct spa_pod *param)
|
static void param_props_changed(struct impl *impl, const struct spa_pod *param)
|
||||||
|
|
@ -518,7 +518,7 @@ static void param_props_changed(struct impl *impl, const struct spa_pod *param)
|
||||||
if (impl->process_latency.ns == nsec)
|
if (impl->process_latency.ns == nsec)
|
||||||
return;
|
return;
|
||||||
impl->process_latency.ns = nsec;
|
impl->process_latency.ns = nsec;
|
||||||
update_latencies(impl, false, true);
|
update_latencies(impl, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void param_tag_changed(struct impl *impl, const struct spa_pod *param,
|
static void param_tag_changed(struct impl *impl, const struct spa_pod *param,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue