[pulseaudio-commits] r2300 - in /branches/glitch-free/src/pulse: internal.h stream.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Wed Apr 23 11:10:35 PDT 2008


Author: lennart
Date: Wed Apr 23 20:10:34 2008
New Revision: 2300

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2300&root=pulseaudio&view=rev
Log:
do not fix automatic buffer attrs anymore, the new protocol version doesn't need this anymore and it creates more problems than it solves. Also drop the initial timing info query. Correct programs shouldn't depend on it anyway

Modified:
    branches/glitch-free/src/pulse/internal.h
    branches/glitch-free/src/pulse/stream.c

Modified: branches/glitch-free/src/pulse/internal.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulse/internal.h?rev=2300&root=pulseaudio&r1=2299&r2=2300&view=diff
==============================================================================
--- branches/glitch-free/src/pulse/internal.h (original)
+++ branches/glitch-free/src/pulse/internal.h Wed Apr 23 20:10:34 2008
@@ -116,7 +116,6 @@
     uint32_t stream_index;
     pa_stream_direction_t direction;
     pa_stream_state_t state;
-    pa_bool_t buffer_attr_not_ready, timing_info_not_ready;
 
     uint32_t requested_bytes;
 

Modified: branches/glitch-free/src/pulse/stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulse/stream.c?rev=2300&root=pulseaudio&r1=2299&r2=2300&view=diff
==============================================================================
--- branches/glitch-free/src/pulse/stream.c (original)
+++ branches/glitch-free/src/pulse/stream.c Wed Apr 23 20:10:34 2008
@@ -67,8 +67,6 @@
     PA_REFCNT_INIT(s);
     s->context = c;
     s->mainloop = c->mainloop;
-
-    s->buffer_attr_not_ready = s->timing_info_not_ready = FALSE;
 
     s->read_callback = NULL;
     s->read_userdata = NULL;
@@ -527,9 +525,6 @@
     pa_assert(PA_REFCNT_VALUE(s) >= 1);
     pa_assert(s->state == PA_STREAM_CREATING);
 
-    if (s->buffer_attr_not_ready || s->timing_info_not_ready)
-        return;
-
     pa_stream_set_state(s, PA_STREAM_READY);
 
     if (s->requested_bytes > 0 && s->write_callback)
@@ -562,7 +557,7 @@
         attr->tlength = pa_bytes_per_second(ss)*2; /* 2s of buffering */
 
     if (!attr->minreq <= 0)
-        attr->minreq = (9*attr->tlength)/10; /* Ask for more data when there are only 200ms left in the playback buffer */
+        attr->minreq = (2*attr->tlength)/10; /* Ask for more data when there are only 200ms left in the playback buffer */
 
     if (!attr->prebuf)
         attr->prebuf = attr->tlength; /* Start to play only when the playback is fully filled up once */
@@ -644,25 +639,6 @@
         s->device_name = pa_xstrdup(dn);
         s->suspended = suspended;
 
-        if (!s->manual_buffer_attr && pa_bytes_per_second(&ss) != pa_bytes_per_second(&s->sample_spec)) {
-            pa_buffer_attr attr;
-            pa_operation *o;
-
-            memset(&attr, 0, sizeof(attr));
-            automatic_buffer_attr(s, &attr, &ss);
-
-            /* If we need to update the buffer metrics, we wait for
-             * the the OK for that call before we go to
-             * PA_STREAM_READY */
-
-            s->state = PA_STREAM_READY;
-            pa_assert_se(o = pa_stream_set_buffer_attr(s, &attr, NULL, NULL));
-            pa_operation_unref(o);
-            s->state = PA_STREAM_CREATING;
-
-            s->buffer_attr_not_ready = TRUE;
-        }
-
         s->channel_map = cm;
         s->sample_spec = ss;
     }
@@ -702,19 +678,6 @@
 
     s->channel_valid = 1;
     pa_dynarray_put((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, s->channel, s);
-
-    if (s->direction != PA_STREAM_UPLOAD && s->flags & PA_STREAM_AUTO_TIMING_UPDATE) {
-
-        /* If automatic timing updates are active, we wait for the
-         * first timing update before going to PA_STREAM_READY
-         * state */
-
-        s->state = PA_STREAM_READY;
-        request_auto_timing_update(s, 1);
-        s->state = PA_STREAM_CREATING;
-
-        s->timing_info_not_ready = TRUE;
-    }
 
     create_stream_complete(s);
 
@@ -1212,12 +1175,6 @@
         }
     }
 
-    /* First, let's complete the initialization, if necessary. */
-    if (o->stream->state == PA_STREAM_CREATING) {
-        o->stream->timing_info_not_ready = FALSE;
-        create_stream_complete(o->stream);
-    }
-
     if (o->stream->latency_update_callback)
         o->stream->latency_update_callback(o->stream, o->stream->latency_update_userdata);
 
@@ -1777,11 +1734,6 @@
         o->stream->manual_buffer_attr = TRUE;
     }
 
-    if (o->stream->state == PA_STREAM_CREATING) {
-        o->stream->buffer_attr_not_ready = FALSE;
-        create_stream_complete(o->stream);
-    }
-
     if (o->callback) {
         pa_stream_success_cb_t cb = (pa_stream_success_cb_t) o->callback;
         cb(o->stream, success, o->userdata);
@@ -1826,6 +1778,9 @@
     else
         pa_tagstruct_putu32(t, attr->fragsize);
 
+    if (s->context->version >= 13)
+        pa_tagstruct_put_boolean(t, !!(s->flags & PA_STREAM_ADJUST_LATENCY));
+
     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);
 




More information about the pulseaudio-commits mailing list