summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pulsecore/core.h1
-rw-r--r--src/pulsecore/sink.c11
-rw-r--r--src/pulsecore/source.c11
3 files changed, 17 insertions, 6 deletions
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index cf7cc1198..6b5b16ae5 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -36,6 +36,7 @@ typedef enum pa_suspend_cause {
PA_SUSPEND_IDLE = 4, /* Used by module-suspend-on-idle */
PA_SUSPEND_SESSION = 8, /* Used by module-hal for mark inactive sessions */
PA_SUSPEND_PASSTHROUGH = 16, /* Used to suspend monitor sources when the sink is in passthrough mode */
+ PA_SUSPEND_INTERNAL = 32, /* This is used for short period server-internal suspends, such as for sample rate updates */
PA_SUSPEND_ALL = 0xFFFF /* Magic cause that can be used to resume forcibly */
} pa_suspend_cause_t;
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 451247092..1522e60b2 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1337,6 +1337,8 @@ void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result) {
/* Called from main thread */
pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough)
{
+ pa_bool_t ret = FALSE;
+
if (s->update_rate) {
uint32_t desired_rate = rate;
uint32_t default_rate = s->default_sample_rate;
@@ -1395,7 +1397,7 @@ pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough)
if (!passthrough && pa_sink_used_by(s) > 0)
return FALSE;
- pa_sink_suspend(s, TRUE, PA_SUSPEND_IDLE); /* needed before rate update, will be resumed automatically */
+ pa_sink_suspend(s, TRUE, PA_SUSPEND_INTERNAL);
if (s->update_rate(s, desired_rate) == TRUE) {
/* update monitor source as well */
@@ -1408,10 +1410,13 @@ pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough)
pa_sink_input_update_rate(i);
}
- return TRUE;
+ ret = TRUE;
}
+
+ pa_sink_suspend(s, FALSE, PA_SUSPEND_INTERNAL);
}
- return FALSE;
+
+ return ret ;
}
/* Called from main thread */
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index e9c366989..5c264e0c1 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -955,6 +955,8 @@ void pa_source_post_direct(pa_source*s, pa_source_output *o, const pa_memchunk *
/* Called from main thread */
pa_bool_t pa_source_update_rate(pa_source *s, uint32_t rate, pa_bool_t passthrough)
{
+ pa_bool_t ret = FALSE;
+
if (s->update_rate) {
uint32_t desired_rate = rate;
uint32_t default_rate = s->default_sample_rate;
@@ -1006,7 +1008,7 @@ pa_bool_t pa_source_update_rate(pa_source *s, uint32_t rate, pa_bool_t passthrou
if (!passthrough && pa_source_used_by(s) > 0)
return FALSE;
- pa_source_suspend(s, TRUE, PA_SUSPEND_IDLE); /* needed before rate update, will be resumed automatically */
+ pa_source_suspend(s, TRUE, PA_SUSPEND_INTERNAL);
if (s->update_rate(s, desired_rate) == TRUE) {
pa_log_info("Changed sampling rate successfully ");
@@ -1015,10 +1017,13 @@ pa_bool_t pa_source_update_rate(pa_source *s, uint32_t rate, pa_bool_t passthrou
if (o->state == PA_SOURCE_OUTPUT_CORKED)
pa_source_output_update_rate(o);
}
- return TRUE;
+ ret = TRUE;
}
+
+ pa_source_suspend(s, FALSE, PA_SUSPEND_INTERNAL);
}
- return FALSE;
+
+ return ret;
}
/* Called from main thread */