[pulseaudio-discuss] What's the purpose of "rewind" on corking and uncorking?
Lin, Mengdong
mengdong.lin at intel.com
Mon Jun 13 09:09:34 PDT 2011
Why a sink input and its sink need "rewind" on corking and uncorking?
I don't quite understand the following code. Could somebody kindly shed light on it? And take ALSA sink for example, are there any valid (non-silent) data left in ALSA buffer after the rewinding?
void pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state_t state) {
...
corking = state == PA_SINK_INPUT_CORKED && i->thread_info.state == PA_SINK_INPUT_RUNNING;
uncorking = i->thread_info.state == PA_SINK_INPUT_CORKED && state == PA_SINK_INPUT_RUNNING;
if (i->state_change)
i->state_change(i, state);
i->thread_info.state = state;
if (corking) {
pa_log_debug("Requesting rewind due to corking");
/* This will tell the implementing sink input driver to rewind
* so that the unplayed already mixed data is not lost */
pa_sink_input_request_rewind(i, 0, TRUE, TRUE, FALSE); ...
} else if (uncorking) {
i->thread_info.underrun_for = (uint64_t) -1;
i->thread_info.playing_for = 0;
pa_log_debug("Requesting rewind due to uncorking");
/* 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);
}
}
Thanks
Amanda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110614/50dfba36/attachment.html>
More information about the pulseaudio-discuss
mailing list