summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaska Uimonen <jaska.uimonen@intel.com>2013-03-07 13:41:44 +0200
committerJaska Uimonen <jaska.uimonen@intel.com>2013-03-12 10:19:03 +0200
commitbf510cc11109c6344054a527b2d4ae9c14d1882c (patch)
tree58ba04f458f1fc64baa255d6b1a372cd68512890
parent9d1c7716c0ade92634b41d1ec4bd49c3af177d41 (diff)
downloadpulseaudio-panda-bf510cc11109c6344054a527b2d4ae9c14d1882c.tar.gz
pulseaudio-panda-bf510cc11109c6344054a527b2d4ae9c14d1882c.tar.bz2
pulseaudio-panda-bf510cc11109c6344054a527b2d4ae9c14d1882c.zip
add internal corking state for sink-input
-rw-r--r--src/pulsecore/sink-input.c30
-rw-r--r--src/pulsecore/sink-input.h4
2 files changed, 33 insertions, 1 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 58a4f20a..adc8a7bb 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -730,6 +730,9 @@ void pa_sink_input_put(pa_sink_input *i) {
update_n_corked(i, state);
i->state = state;
+ i->corked = FALSE;
+ i->corked_internal = FALSE;
+
/* We might need to update the sink's volume if we are in flat volume mode. */
if (pa_sink_flat_volume_enabled(i->sink))
pa_sink_set_volume(i->sink, NULL, FALSE, i->save_volume);
@@ -1361,13 +1364,38 @@ void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_p
}
}
+static void pa_sink_input_cork_really(pa_sink_input *i, pa_bool_t b) {
+ pa_sink_input_assert_ref(i);
+ pa_assert_ctl_context();
+ pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
+
+ if (i->corked_internal == FALSE && i->corked == FALSE)
+ b = FALSE;
+ else
+ b = TRUE;
+
+ sink_input_set_state(i, b ? PA_SINK_INPUT_CORKED : PA_SINK_INPUT_RUNNING);
+}
+
/* Called from main context */
void pa_sink_input_cork(pa_sink_input *i, pa_bool_t b) {
pa_sink_input_assert_ref(i);
pa_assert_ctl_context();
pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
- sink_input_set_state(i, b ? PA_SINK_INPUT_CORKED : PA_SINK_INPUT_RUNNING);
+ i->corked = b;
+
+ pa_sink_input_cork_really(i, b);
+}
+
+void pa_sink_input_cork_internal(pa_sink_input *i, pa_bool_t b) {
+ pa_sink_input_assert_ref(i);
+ pa_assert_ctl_context();
+ pa_assert(PA_SINK_INPUT_IS_LINKED(i->state));
+
+ i->corked_internal = b;
+
+ pa_sink_input_cork_really(i, b);
}
/* Called from main context */
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index b7686bed..9f6516ba 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -119,6 +119,9 @@ struct pa_sink_input {
/* for volume ramps */
pa_cvolume_ramp_int ramp;
+ pa_bool_t corked;
+ pa_bool_t corked_internal;
+
pa_resample_method_t requested_resample_method, actual_resample_method;
/* Returns the chunk of audio data and drops it from the
@@ -343,6 +346,7 @@ implementing the "zero latency" write-through functionality. */
void pa_sink_input_request_rewind(pa_sink_input *i, size_t nbytes, pa_bool_t rewrite, pa_bool_t flush, pa_bool_t dont_rewind_render);
void pa_sink_input_cork(pa_sink_input *i, pa_bool_t b);
+void pa_sink_input_cork_internal(pa_sink_input *i, pa_bool_t b);
int pa_sink_input_set_rate(pa_sink_input *i, uint32_t rate);
int pa_sink_input_update_rate(pa_sink_input *i);