diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c index 2753fb87fd..5075dd92ce 100644 --- a/modules/audio_output/pulse.c +++ b/modules/audio_output/pulse.c @@ -68,8 +68,7 @@ typedef struct pa_threaded_mainloop *mainloop; /**< PulseAudio thread */ pa_time_event *trigger; /**< Deferred stream trigger */ pa_cvolume cvolume; /**< actual sink input volume */ - vlc_tick_t first_pts; /**< Play stream timestamp of buffer start */ - vlc_tick_t first_date; /**< Play system timestamp of buffer start */ + vlc_tick_t last_date; /**< Play system timestamp of last buffer */ pa_volume_t volume_force; /**< Forced volume (stream must be NULL) */ pa_stream_flags_t flags_force; /**< Forced flags (stream must be NULL) */ @@ -227,7 +226,7 @@ static void stream_start(pa_stream *s, audio_output_t *aout, vlc_tick_t date) aout_sys_t *sys = aout->sys; vlc_tick_t delta; - assert (sys->first_pts != VLC_TICK_INVALID); + assert (sys->last_date != VLC_TICK_INVALID); if (sys->trigger != NULL) { vlc_pa_rttime_free(sys->mainloop, sys->trigger); @@ -258,10 +257,10 @@ static void stream_latency_cb(pa_stream *s, void *userdata) aout_sys_t *sys = aout->sys; /* This callback is _never_ called while paused. */ - if (sys->first_pts == VLC_TICK_INVALID) + if (sys->last_date == VLC_TICK_INVALID) return; /* nothing to do if buffers are (still) empty */ if (pa_stream_is_corked(s) > 0) - stream_start(s, aout, sys->first_date); + stream_start(s, aout, sys->last_date); } @@ -331,7 +330,7 @@ static void stream_overflow_cb(pa_stream *s, void *userdata) if (unlikely(op == NULL)) return; pa_operation_unref(op); - sys->first_pts = VLC_TICK_INVALID; + sys->last_date = VLC_TICK_INVALID; } static void stream_started_cb(pa_stream *s, void *userdata) @@ -504,10 +503,7 @@ static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date) * will take place, and sooner or later a deadlock. */ pa_threaded_mainloop_lock(sys->mainloop); - if (sys->first_pts == VLC_TICK_INVALID) { - sys->first_pts = block->i_pts; - sys->first_date = date; - } + sys->last_date = date; if (pa_stream_is_corked(s) > 0) stream_start(s, aout, date); @@ -543,7 +539,7 @@ static void Pause(audio_output_t *aout, bool paused, vlc_tick_t date) stream_stop(s, aout); } else { pa_stream_set_latency_update_callback(s, stream_latency_cb, aout); - if (likely(sys->first_pts != VLC_TICK_INVALID)) + if (likely(sys->last_date != VLC_TICK_INVALID)) stream_start_now(s, aout); } @@ -576,7 +572,7 @@ static void Flush(audio_output_t *aout, bool wait) op = pa_stream_flush(s, NULL, NULL); if (op != NULL) pa_operation_unref(op); - sys->first_pts = VLC_TICK_INVALID; + sys->last_date = VLC_TICK_INVALID; stream_stop(s, aout); pa_threaded_mainloop_unlock(sys->mainloop); @@ -807,7 +803,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt) sys->trigger = NULL; pa_cvolume_init(&sys->cvolume); - sys->first_pts = VLC_TICK_INVALID; + sys->last_date = VLC_TICK_INVALID; pa_format_info *formatv = pa_format_info_new(); formatv->encoding = encoding;