You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.6 KiB
67 lines
2.6 KiB
diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
|
|
index 86bd6dd..ce133f9 100644
|
|
--- a/modules/audio_output/pulse.c
|
|
+++ b/modules/audio_output/pulse.c
|
|
@@ -175,16 +175,17 @@ static int Open ( vlc_object_t *p_this )
|
|
msg_Err(p_aout,"Invalid sample spec");
|
|
goto fail;
|
|
}
|
|
+
|
|
+ a.maxlength = pa_bytes_per_second(&ss)/4/pa_frame_size(&ss);
|
|
+ a.tlength = a.maxlength*9/10;
|
|
+ a.prebuf = a.tlength/2;
|
|
+ a.minreq = a.tlength/10;
|
|
|
|
- /* Reduce overall latency to 200mS to reduce audible clicks
|
|
- * Also pulse minreq and internal buffers are now 20mS which reduces resampling
|
|
- */
|
|
- a.tlength = pa_bytes_per_second(&ss)/5;
|
|
- a.maxlength = a.tlength * 2;
|
|
- a.prebuf = a.tlength;
|
|
- a.minreq = a.tlength / 10;
|
|
+ a.maxlength *= pa_frame_size(&ss);
|
|
+ a.tlength *= pa_frame_size(&ss);
|
|
+ a.prebuf *= pa_frame_size(&ss);
|
|
+ a.minreq *= pa_frame_size(&ss);
|
|
|
|
- /* Buffer size is 20mS */
|
|
p_sys->buffer_size = a.minreq;
|
|
|
|
/* Initialise the speaker map setup above */
|
|
@@ -212,7 +213,7 @@ static int Open ( vlc_object_t *p_this )
|
|
PULSE_DEBUG( "Pulse after context connect");
|
|
|
|
pa_threaded_mainloop_lock(p_sys->mainloop);
|
|
-
|
|
+
|
|
if (pa_threaded_mainloop_start(p_sys->mainloop) < 0) {
|
|
msg_Err(p_aout, "Failed to start main loop");
|
|
goto unlock_and_fail;
|
|
@@ -239,7 +240,7 @@ static int Open ( vlc_object_t *p_this )
|
|
pa_stream_set_write_callback(p_sys->stream, stream_request_cb, p_aout);
|
|
pa_stream_set_latency_update_callback(p_sys->stream, stream_latency_update_cb, p_aout);
|
|
|
|
- if (pa_stream_connect_playback(p_sys->stream, NULL, &a, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_ADJUST_LATENCY, NULL, NULL) < 0) {
|
|
+ if (pa_stream_connect_playback(p_sys->stream, NULL, &a, PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL) < 0) {
|
|
msg_Err(p_aout, "Failed to connect stream: %s", pa_strerror(pa_context_errno(p_sys->context)));
|
|
goto unlock_and_fail;
|
|
}
|
|
@@ -447,11 +448,16 @@ static void stream_request_cb(pa_stream *s, size_t length, void *userdata) {
|
|
latency = 0;
|
|
|
|
}
|
|
-
|
|
PULSE_DEBUG( "Pulse stream request latency=%"PRId64"", latency);
|
|
next_date = mdate() + latency;
|
|
|
|
+
|
|
if(p_sys->start_date < next_date + AOUT_PTS_TOLERANCE ){
|
|
+ /*
|
|
+ vlc_mutex_lock( &p_aout->output_fifo_lock );
|
|
+ p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo );
|
|
+ vlc_mutex_unlock( &p_aout->output_fifo_lock );
|
|
+ */
|
|
p_buffer = aout_OutputNextBuffer( p_aout, next_date, 0);
|
|
}
|
|
}
|