From 40b66a0be9579fff095cba77f3ea29c390d966f2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 3 Sep 2008 18:31:46 +0200 Subject: Implement "early requests" mode. PA_STREAM_EARLY_REQUESTS is a new flag that will modify buffering metric selection behaviour a bit. This code is good for broken ALSA/OSS clients that ignore 'readability' on the fds in question and schedule audio via usleep() instead. --- src/pulse/stream.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/pulse/stream.c') diff --git a/src/pulse/stream.c b/src/pulse/stream.c index 6a497b70..d0c7d67e 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -886,7 +886,8 @@ static int create_stream( PA_STREAM_VARIABLE_RATE| PA_STREAM_PEAK_DETECT| PA_STREAM_START_MUTED| - PA_STREAM_ADJUST_LATENCY)), PA_ERR_INVALID); + PA_STREAM_ADJUST_LATENCY| + PA_STREAM_EARLY_REQUESTS)), PA_ERR_INVALID); PA_CHECK_VALIDITY(s->context, s->context->version >= 12 || !(flags & PA_STREAM_VARIABLE_RATE), PA_ERR_NOTSUPPORTED); PA_CHECK_VALIDITY(s->context, s->context->version >= 13 || !(flags & PA_STREAM_PEAK_DETECT), PA_ERR_NOTSUPPORTED); @@ -899,6 +900,7 @@ static int create_stream( PA_CHECK_VALIDITY(s->context, direction == PA_STREAM_RECORD || !(flags & (PA_STREAM_PEAK_DETECT)), PA_ERR_INVALID); PA_CHECK_VALIDITY(s->context, !volume || volume->channels == s->sample_spec.channels, PA_ERR_INVALID); PA_CHECK_VALIDITY(s->context, !sync_stream || (direction == PA_STREAM_PLAYBACK && sync_stream->direction == PA_STREAM_PLAYBACK), PA_ERR_INVALID); + PA_CHECK_VALIDITY(s->context, (flags & (PA_STREAM_ADJUST_LATENCY|PA_STREAM_EARLY_REQUESTS)) != (PA_STREAM_ADJUST_LATENCY|PA_STREAM_EARLY_REQUESTS), PA_ERR_INVALID); pa_stream_ref(s); @@ -997,13 +999,12 @@ static int create_stream( pa_tagstruct_putu32(t, s->direct_on_input); } - if (s->context->version >= 14 && - s->direction == PA_STREAM_PLAYBACK) { + if (s->context->version >= 14) { - pa_tagstruct_put( - t, - PA_TAG_BOOLEAN, volume_set, - PA_TAG_INVALID); + if (s->direction == PA_STREAM_PLAYBACK) + pa_tagstruct_put_boolean(t, volume_set); + + pa_tagstruct_put_boolean(t, flags & PA_STREAM_EARLY_REQUESTS); } pa_pstream_send_tagstruct(s->context->pstream, t); @@ -2079,6 +2080,9 @@ pa_operation* pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr if (s->context->version >= 13) pa_tagstruct_put_boolean(t, !!(s->flags & PA_STREAM_ADJUST_LATENCY)); + if (s->context->version >= 14) + pa_tagstruct_put_boolean(t, !!(s->flags & PA_STREAM_EARLY_REQUESTS)); + pa_pstream_send_tagstruct(s->context->pstream, t); pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, stream_set_buffer_attr_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref); -- cgit