summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Xingchao <xingchao.wang@intel.com>2011-08-13 13:55:06 +0200
committerColin Guthrie <colin@mageia.org>2011-08-15 09:41:55 +0100
commit2f55da5baa0323af76510fd07c540f6dafcf1ac0 (patch)
treea935829f902c5fb975def212fff69d6bbce6fdab
parent50b420aebd876557a64f9015e1197e7d12201f5f (diff)
sink-input: Avoid fake rewind in corked state
sink_input_request_rewind() does nothing if we are in the corked state. Thus do not set the new state untill we have issued the rewind request.
-rw-r--r--src/pulsecore/sink-input.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 384647f2..22de3bc1 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1752,8 +1752,6 @@ void pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state
if (i->state_change)
i->state_change(i, state);
- i->thread_info.state = state;
-
if (corking) {
pa_log_debug("Requesting rewind due to corking");
@@ -1762,17 +1760,25 @@ void pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state
* so that the unplayed already mixed data is not lost */
pa_sink_input_request_rewind(i, 0, TRUE, TRUE, FALSE);
+ /* Set the corked state *after* requesting rewind */
+ i->thread_info.state = state;
+
} else if (uncorking) {
+ pa_log_debug("Requesting rewind due to uncorking");
+
i->thread_info.underrun_for = (uint64_t) -1;
i->thread_info.playing_for = 0;
- pa_log_debug("Requesting rewind due to uncorking");
+ /* Set the uncorked state *before* requesting rewind */
+ i->thread_info.state = state;
/* OK, we're being uncorked. Make sure we're not rewound when
* the hw buffer is remixed and request a remix. */
pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE);
- }
+ } else
+ /* We may not be corking or uncorking, but we still need to set the state. */
+ i->thread_info.state = state;
}
/* Called from thread context, except when it is not. */