summaryrefslogtreecommitdiffstats
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-02 11:52:01 +0200
commit249218b944ed0237ec66d56c08ed4dddf5e98d24 (patch)
tree8df198032d59d2c8cda3db739c7c524afffce80e
parentab808930ef29a34bd8f0b872993bb900c8f45961 (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.
-rw-r--r--src/modules/module-combine-sink.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/modules/module-combine-sink.c b/src/modules/module-combine-sink.c
index c5c33f2d..76ffbd50 100644
--- a/src/modules/module-combine-sink.c
+++ b/src/modules/module-combine-sink.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) {