mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
sink-input: extend comments on rewinding logic a bit
This commit is contained in:
parent
c372b52a77
commit
5df842db64
2 changed files with 16 additions and 8 deletions
|
|
@ -1472,7 +1472,13 @@ pa_bool_t pa_sink_input_safe_to_remove(pa_sink_input *i) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from IO context */
|
/* Called from IO context */
|
||||||
void pa_sink_input_request_rewind(pa_sink_input *i, size_t nbytes /* in our sample spec */, pa_bool_t rewrite, pa_bool_t flush, pa_bool_t dont_rewind_render) {
|
void pa_sink_input_request_rewind(
|
||||||
|
pa_sink_input *i,
|
||||||
|
size_t nbytes /* in our sample spec */,
|
||||||
|
pa_bool_t rewrite,
|
||||||
|
pa_bool_t flush,
|
||||||
|
pa_bool_t dont_rewind_render) {
|
||||||
|
|
||||||
size_t lbq;
|
size_t lbq;
|
||||||
|
|
||||||
/* If 'rewrite' is TRUE the sink is rewound as far as requested
|
/* If 'rewrite' is TRUE the sink is rewound as far as requested
|
||||||
|
|
@ -1487,19 +1493,20 @@ void pa_sink_input_request_rewind(pa_sink_input *i, size_t nbytes /* in our sam
|
||||||
* dont_rewind_render is TRUE then the render memblockq is not
|
* dont_rewind_render is TRUE then the render memblockq is not
|
||||||
* rewound. */
|
* rewound. */
|
||||||
|
|
||||||
|
/* nbytes = 0 means maximum rewind request */
|
||||||
|
|
||||||
pa_sink_input_assert_ref(i);
|
pa_sink_input_assert_ref(i);
|
||||||
pa_sink_input_assert_io_context(i);
|
pa_sink_input_assert_io_context(i);
|
||||||
|
pa_assert(rewrite || flush);
|
||||||
nbytes = PA_MAX(i->thread_info.rewrite_nbytes, nbytes);
|
pa_assert(!dont_rewind_render || !rewrite);
|
||||||
|
|
||||||
/* pa_log_debug("request rewrite %lu", (unsigned long) nbytes); */
|
|
||||||
|
|
||||||
/* We don't take rewind requests while we are corked */
|
/* We don't take rewind requests while we are corked */
|
||||||
if (i->thread_info.state == PA_SINK_INPUT_CORKED)
|
if (i->thread_info.state == PA_SINK_INPUT_CORKED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pa_assert(rewrite || flush);
|
nbytes = PA_MAX(i->thread_info.rewrite_nbytes, nbytes);
|
||||||
pa_assert(!dont_rewind_render || !rewrite);
|
|
||||||
|
/* pa_log_debug("request rewrite %zu", nbytes); */
|
||||||
|
|
||||||
/* Calculate how much we can rewind locally without having to
|
/* Calculate how much we can rewind locally without having to
|
||||||
* touch the sink */
|
* touch the sink */
|
||||||
|
|
@ -1519,6 +1526,7 @@ void pa_sink_input_request_rewind(pa_sink_input *i, size_t nbytes /* in our sam
|
||||||
nbytes = pa_resampler_request(i->thread_info.resampler, nbytes);
|
nbytes = pa_resampler_request(i->thread_info.resampler, nbytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remember how much we actually want to rewrite */
|
||||||
if (i->thread_info.rewrite_nbytes != (size_t) -1) {
|
if (i->thread_info.rewrite_nbytes != (size_t) -1) {
|
||||||
if (rewrite) {
|
if (rewrite) {
|
||||||
/* Make sure to not overwrite over underruns */
|
/* Make sure to not overwrite over underruns */
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ struct pa_sink_input {
|
||||||
|
|
||||||
pa_bool_t attached:1; /* True only between ->attach() and ->detach() calls */
|
pa_bool_t attached:1; /* True only between ->attach() and ->detach() calls */
|
||||||
|
|
||||||
/* 0: rewrite nothing, (size_t) -1: rewrite everything, otherwise how many bytes to rewrite */
|
/* rewrite_nbytes: 0: rewrite nothing, (size_t) -1: rewrite everything, otherwise how many bytes to rewrite */
|
||||||
pa_bool_t rewrite_flush:1, dont_rewind_render:1;
|
pa_bool_t rewrite_flush:1, dont_rewind_render:1;
|
||||||
size_t rewrite_nbytes;
|
size_t rewrite_nbytes;
|
||||||
uint64_t underrun_for, playing_for;
|
uint64_t underrun_for, playing_for;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue