<html><head></head><body>The patch description makes no sense to me, because it describes the existing state before the patch.<br>
<br>
Besides, there are no problems with output not starting corked, as long as the output knows its latency immediately. Not all but several outputs can probably start corked (i.e. paused), but they might not need to.<br>
<br>
The issue is PulseAudio has no latency estimate at start, so it needs to postpone start. This is more generic for the users: it can cope with fringe sink sorts. But for our purpose as developers, it is just an inconvenience of PulseAudio.<br>
<br>
But really the assumption is that one of the following is true:<br>
1) latency is known immediately (e.g. ALSA),<br>
2) latency is signaled asynchronously when it becomes available (e.g. PulseAudio), or<br>
3) latency is irrelevant (e.g. file).<br>
<br>
And with that, I don't follow what this patch does, other than make the existing code more intricate.<br><br><div class="gmail_quote">Le 27 juin 2018 15:41:34 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">The idea here is a play a silence corresponding to the difference between the<br>first system pts and now. This will be used for aouts that can't start corked,<br>so every aout modules except PulseAudio. To reach this new code path, aout<br>modules need to return a valid value from the first pf_get_time callback<br>(already the case of main modules).<br>---<br> src/audio_output/aout_internal.h | 1 +<br> src/audio_output/dec.c | 54 ++++++++++++++++++++++----------<br> 2 files changed, 38 insertions(+), 17 deletions(-)<br><br>diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h<br>index 55fab1a7e9..42d0f1ff35 100644<br>--- a/src/audio_output/aout_internal.h<br>+++ b/src/audio_output/aout_internal.h<br>@@ -72,6 +72,7 @@ typedef struct<br> <br> struct<br> {<br>+ bool is_first;<br> vlc_tick_t end; /**< Last seen PTS */<br> struct vlc_clock_t *clock;<br> float rate; /**< Play-out speed rate */<br>diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c<br>index 523682e619..8a2808c5a0 100644<br>--- a/src/audio_output/dec.c<br>+++ b/src/audio_output/dec.c<br>@@ -102,6 +102,7 @@ error:<br> return -1;<br> }<br> <br>+ owner->sync.is_first = true;<br> owner->sync.rate = 1.f;<br> owner->sync.end = VLC_TS_INVALID;<br> owner->sync.resamp_type = AOUT_RESAMPLING_NONE;<br>@@ -229,8 +230,8 @@ static void aout_DecSilence (audio_output_t *aout, vlc_tick_t length, vlc_tick_t<br> vlc_clock_ConvertToSystem(owner->sync.clock, vlc_tick_now(), pts));<br> }<br> <br>-static void aout_DecSynchronize(audio_output_t *aout, vlc_tick_t system_now,<br>- vlc_tick_t dec_pts)<br>+static vlc_tick_t aout_DecSynchronize(audio_output_t *aout, vlc_tick_t system_now,<br>+ block_t *block)<br> {<br> /**<br> * Depending on the drift between the actual and intended playback times,<br>@@ -248,11 +249,39 @@ static void aout_DecSynchronize(audio_output_t *aout, vlc_tick_t system_now,<br> * all samples in the buffer will have been played. Then:<br> * pts = vlc_tick_now() + delay<br> */<br>+ aout_owner_t *owner = aout_owner (aout);<br> vlc_tick_t delay;<br>- if (aout->time_get(aout, &delay) != 0)<br>- return; /* nothing can be done if timing is unknown */<br>+ if (aout->time_get(aout, &delay) == 0)<br>+ {<br>+ if (owner->sync.is_first)<br>+ {<br>+ vlc_tick_t system_pts =<br>+ vlc_clock_ConvertToSystem(owner->sync.clock, system_now + delay,<br>+ block->i_pts);<br>+ vlc_tick_t silence_delay = system_pts - system_now;<br>+ if (silence_delay > 0)<br>+ aout_DecSilence (aout, silence_delay, block->i_pts);<br>+ if (aout->time_get(aout, &delay) == 0)<br>+ aout_RequestRetiming(aout, system_now + delay, block->i_pts);<br>+ }<br>+ else<br>+ aout_RequestRetiming(aout, system_now + delay, block->i_pts);<br>+ }<br>+<br>+ if (owner->sync.delay != 0)<br>+ {<br>+ block->i_pts += owner->sync.delay;<br>+ block->i_dts += owner->sync.delay;<br>+ }<br> <br>- aout_RequestRetiming(aout, system_now, dec_pts - delay);<br>+ vlc_tick_t system_pts = vlc_clock_ConvertToSystem(owner->sync.clock, system_now,<br>+ block->i_pts);<br>+<br>+ owner->sync.end = block->i_pts + block->i_length + 1;<br>+ owner->sync.discontinuity = false;<br>+ owner->sync.is_first = false;<br>+<br>+ return system_pts;<br> }<br> <br> void aout_RequestRetiming(audio_output_t *aout, vlc_tick_t system_ts,<br>@@ -397,20 +426,10 @@ int aout_DecPlay(audio_output_t *aout, block_t *block)<br> }<br> <br> /* Drift correction */<br>- vlc_tick_t system_now = vlc_tick_now();<br>- aout_DecSynchronize(aout, system_now, block->i_pts);<br>-<br>- if (owner->sync.delay != 0)<br>- {<br>- block->i_pts += owner->sync.delay;<br>- block->i_dts += owner->sync.delay;<br>- }<br>+ vlc_tick_t system_pts = aout_DecSynchronize(aout, vlc_tick_now(), block);<br> <br> /* Output */<br>- owner->sync.end = block->i_pts + block->i_length + 1;<br>- owner->sync.discontinuity = false;<br>- aout->play(aout, block, vlc_clock_ConvertToSystem(owner->sync.clock, system_now,<br>- block->i_pts));<br>+ aout->play(aout, block, system_pts);<br> atomic_fetch_add_explicit(&owner->buffers_played, 1, memory_order_relaxed);<br> return ret;<br> drop:<br>@@ -473,6 +492,7 @@ void aout_DecFlush (audio_output_t *aout, bool wait)<br> {<br> aout_owner_t *owner = aout_owner (aout);<br> <br>+ owner->sync.is_first = true;<br> owner->sync.end = VLC_TS_INVALID;<br> if (owner->mixer_format.i_format)<br> {</pre></blockquote></div><br>
-- <br>
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>