[vlc-devel] [PATCH 2/2] aout: pulse: use the period_hint

Thomas Guillem thomas at gllm.fr
Fri Feb 8 08:09:15 CET 2019


---
 modules/audio_output/pulse.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index eb53a1e2f3..35f21e9bd1 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -785,14 +785,16 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt,
                             | PA_STREAM_AUTO_TIMING_UPDATE
                             | PA_STREAM_FIX_RATE;
 
+    assert(*period_hint >= AOUT_MAX_PTS_ADVANCE);
+
     struct pa_buffer_attr attr;
     attr.maxlength = -1;
     /* PulseAudio goes berserk if the target length (tlength) is not
      * significantly longer than 2 periods (minreq), or when the period length
      * is unspecified and the target length is short. */
-    attr.tlength = pa_usec_to_bytes(3 * AOUT_MIN_PREPARE_TIME, &ss);
+    attr.tlength = pa_usec_to_bytes(3 * *period_hint, &ss);
     attr.prebuf = 0; /* trigger manually */
-    attr.minreq = pa_usec_to_bytes(AOUT_MIN_PREPARE_TIME, &ss);
+    attr.minreq = pa_usec_to_bytes(*period_hint, &ss);
     attr.fragsize = 0; /* not used for output */
 
     pa_cvolume *cvolume = NULL, cvolumebuf;
@@ -819,7 +821,6 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt,
         /* Setup low latency in order to quickly react to ambisonics
          * filters viewpoint changes. */
         flags |= PA_STREAM_ADJUST_LATENCY;
-        attr.tlength = pa_usec_to_bytes(3 * AOUT_MIN_PREPARE_TIME, &ss);
     }
 
     if (encoding != PA_ENCODING_PCM)
@@ -963,7 +964,6 @@ fail:
     pa_threaded_mainloop_unlock(sys->mainloop);
     Stop(aout);
     return VLC_EGENERIC;
-    VLC_UNUSED(period_hint);
 }
 
 /**
-- 
2.20.1



More information about the vlc-devel mailing list