mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
* enable write_index correction and timing interpolation only for playback (and record) streams
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@656 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
22558b5e0e
commit
fdb48b4340
1 changed files with 46 additions and 39 deletions
|
|
@ -371,7 +371,8 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED
|
|||
/* We add an extra ref as long as we're connected (i.e. in the dynarray) */
|
||||
pa_stream_ref(s);
|
||||
|
||||
if (s->flags & PA_STREAM_INTERPOLATE_TIMING) {
|
||||
if (s->direction != PA_STREAM_UPLOAD &&
|
||||
s->flags & PA_STREAM_INTERPOLATE_TIMING) {
|
||||
struct timeval tv;
|
||||
|
||||
pa_gettimeofday(&tv);
|
||||
|
|
@ -542,6 +543,7 @@ int pa_stream_write(
|
|||
else
|
||||
s->requested_bytes = 0;
|
||||
|
||||
if (s->direction == PA_STREAM_PLAYBACK) {
|
||||
/* Update latency request correction */
|
||||
if (s->latency_corrections[s->idx_latency_correction].valid) {
|
||||
|
||||
|
|
@ -568,6 +570,7 @@ int pa_stream_write(
|
|||
} else
|
||||
s->timing_info.write_index_corrupt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -784,11 +787,13 @@ pa_operation* pa_stream_update_timing_info(pa_stream *s, pa_stream_success_cb_t
|
|||
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
|
||||
|
||||
if (s->direction == PA_STREAM_PLAYBACK) {
|
||||
/* Find a place to store the write_index correction data for this entry */
|
||||
cidx = (s->idx_latency_correction + 1) % PA_MAX_LATENCY_CORRECTIONS;
|
||||
|
||||
/* Check if we could allocate a correction slot. If not, there are too many outstanding queries */
|
||||
PA_CHECK_VALIDITY_RETURN_NULL(s->context, !s->latency_corrections[cidx].valid, PA_ERR_INTERNAL);
|
||||
}
|
||||
|
||||
o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata);
|
||||
|
||||
|
|
@ -802,6 +807,7 @@ pa_operation* pa_stream_update_timing_info(pa_stream *s, pa_stream_success_cb_t
|
|||
pa_pstream_send_tagstruct(s->context->pstream, t);
|
||||
pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_timing_info_callback, o);
|
||||
|
||||
if (s->direction == PA_STREAM_PLAYBACK) {
|
||||
/* Fill in initial correction data */
|
||||
o->stream->idx_latency_correction = cidx;
|
||||
o->stream->latency_corrections[cidx].valid = 1;
|
||||
|
|
@ -809,6 +815,7 @@ pa_operation* pa_stream_update_timing_info(pa_stream *s, pa_stream_success_cb_t
|
|||
o->stream->latency_corrections[cidx].absolute = 0;
|
||||
o->stream->latency_corrections[cidx].value = 0;
|
||||
o->stream->latency_corrections[cidx].corrupt = 0;
|
||||
}
|
||||
|
||||
return pa_operation_ref(o);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue