summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorForest Bond <forest.bond@rapidrollout.com>2011-05-20 12:21:13 -0400
committerColin Guthrie <colin@mageia.org>2011-06-05 21:25:47 +0200
commit8a437ee5e19b38431ca6bccfd6676fcc23c88f0c (patch)
treeec0be60673511b319a6817d99007f12aac4910a3 /src
parentcc91a8f4b4c1108d2e11d27bb931651b8ee9b41f (diff)
module-combine-sink: Initialize smoother in paused state
The smoother is paused on initialization and resumed when the sink state is set to running. Otherwise, early latency estimates are too low since there is some delay between module initialization and entering the running state. After the smoother is initially resumed, it is paused when the sink state is not running. The previous behavior was to pause only when the sink enters suspended state, however, this would lead to large errors in latency estimates after the sink has been idle for some time.
Diffstat (limited to 'src')
-rw-r--r--src/modules/module-combine.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
index f230bda1..aec774ee 100644
--- a/src/modules/module-combine.c
+++ b/src/modules/module-combine.c
@@ -732,15 +732,18 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
switch (code) {
- case PA_SINK_MESSAGE_SET_STATE:
- pa_atomic_store(&u->thread_info.running, PA_PTR_TO_UINT(data) == PA_SINK_RUNNING);
+ case PA_SINK_MESSAGE_SET_STATE: {
+ pa_bool_t running = (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING);
- if (PA_PTR_TO_UINT(data) == PA_SINK_SUSPENDED)
- pa_smoother_pause(u->thread_info.smoother, pa_rtclock_now());
- else
+ pa_atomic_store(&u->thread_info.running, running);
+
+ if (running)
pa_smoother_resume(u->thread_info.smoother, pa_rtclock_now(), TRUE);
+ else
+ pa_smoother_pause(u->thread_info.smoother, pa_rtclock_now());
break;
+ }
case PA_SINK_MESSAGE_GET_LATENCY: {
pa_usec_t x, y, c, *delay = data;
@@ -1160,7 +1163,7 @@ int pa__init(pa_module*m) {
TRUE,
10,
pa_rtclock_now(),
- FALSE);
+ TRUE);
adjust_time_sec = DEFAULT_ADJUST_TIME_USEC / PA_USEC_PER_SEC;
if (pa_modargs_get_value_u32(ma, "adjust_time", &adjust_time_sec) < 0) {