]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
Use PA_STREAM_EARLY_REQUESTS if available
authorLennart Poettering <lennart@poettering.net>
Wed, 3 Sep 2008 17:59:12 +0000 (19:59 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 3 Sep 2008 18:25:38 +0000 (20:25 +0200)
Use PA_STREAM_EARLY_REQUESTS if PA knows it. PA >= 0.9.12 learned this flag
which will make the buffering more similar to traditional fragment/period-based
scheduling. Instead of delaying buffer fillup until the latest moment possible
this will cause fillups much earlier.

This is useful for compatibility for broken ALSA clients that don't care about
'readability' of the ALSA fd but instead schedule audio via usleep() or a
similar call. (One exampler being mplayer)

pulse/pcm_pulse.c

index 5a5b95434e9a91be163403c349c79e55ec214d48..fb88697beeb4a9903e0c3940d0c9dc67a697d7a1 100644 (file)
@@ -539,15 +539,22 @@ static int pulse_prepare(snd_pcm_ioplug_t * io)
                r = pa_stream_connect_playback(pcm->stream, pcm->device,
                                               &pcm->buffer_attr,
                                               PA_STREAM_AUTO_TIMING_UPDATE |
-                                              PA_STREAM_INTERPOLATE_TIMING,
-                                              NULL, NULL);
+                                              PA_STREAM_INTERPOLATE_TIMING
+#ifdef PA_STREAM_EARLY_REQUESTS
+                                            | PA_STREAM_EARLY_REQUESTS
+#endif
+                                              , NULL, NULL);
        } else {
                pa_stream_set_read_callback(pcm->stream, stream_request_cb,
                                            pcm);
                r = pa_stream_connect_record(pcm->stream, pcm->device,
                                             &pcm->buffer_attr,
                                             PA_STREAM_AUTO_TIMING_UPDATE |
-                                            PA_STREAM_INTERPOLATE_TIMING);
+                                            PA_STREAM_INTERPOLATE_TIMING
+#ifdef PA_STREAM_EARLY_REQUESTS
+                                            | PA_STREAM_EARLY_REQUESTS
+#endif
+                       );
        }
 
        if (r < 0) {