<html><head></head><body>Hi,<br><br>I don't follow the comments. We need to support rendering when paused, to update OSD (and potentially to handle seeking while paused).<br><br><div class="gmail_quote">Le 5 septembre 2019 14:40:02 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">This case can happen during a very short timespan, when the clock is paused<br>before the vout thread processed the pause event.<br><br>There are two way to handle it:<br><br> - In the prepare step: continue processing the picture but don't display it,<br> (keep displaying the old one, that is sys->displayed.current).<br><br> - In the render step: make the picture as forced and display it now. It's too<br> late to fallback to the previous picture.<hr> src/video_output/video_output.c | 56 ++++++++++++++++++++++++++++-----<br> 1 file changed, 48 insertions(+), 8 deletions(-)<br><br>diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c<br>index 2c63624808..5badb35321 100644<br>--- a/src/video_output/video_output.c<br>+++ b/src/video_output/video_output.c<br>@@ -865,7 +865,8 @@ static void ThreadChangeFilters(vout_thread_t *vout,<br> <br> <br> /* */<br>-static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool frame_by_frame)<br>+static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse,<br>+ bool frame_by_frame, bool *paused)<br> {<br> bool is_late_dropped = vout->p->is_late_dropped && !vout->p->pause.is_on && !frame_by_frame;<br> vout_thread_sys_t *sys = vout->p;<br>@@ -888,7 +889,19 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool fra<br> const vlc_tick_t system_pts =<br> vlc_clock_ConvertToSystem(vout->p->clock, date,<br> decoded->date, sys->rate);<br>- const vlc_tick_t late = date - system_pts;<br>+<br>+ vlc_tick_t late;<br>+ if (system_pts == INT64_MAX)<br>+ {<br>+ /* The clock is paused, notify it (so that the current<br>+ * picture is displayed but not the next one), this<br>+ * current picture can't be be late. */<br>+ *paused = true;<br>+ late = 0;<br>+ }<br>+ else<br>+ late = date - system_pts;<br>+<br> vlc_tick_t late_threshold;<br> if (decoded->format.i_frame_rate && decoded->format.i_frame_rate_base)<br> late_threshold = VLC_TICK_FROM_MS(500) * decoded->format.i_frame_rate_base / decoded->format.i_frame_rate;<br>@@ -1021,10 +1034,21 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)<br> if (sys->pause.is_on)<br> render_subtitle_date = sys->pause.date;<br> else<br>+ {<br> render_subtitle_date = filtered->date <= 1 ? system_now :<br> vlc_clock_ConvertToSystem(sys->clock, system_now, filtered->date,<br> sys->rate);<br> <br>+ /* The clock is paused, it's too late to fallback to the previous<br>+ * picture, display the current picture anyway and force the rendering<br>+ * to now. */<br>+ if (unlikely(render_subtitle_date == INT64_MAX))<br>+ {<br>+ render_subtitle_date = system_now;<br>+ is_forced = true;<br>+ }<br>+ }<br>+<br> /*<br> * Get the subpicture to be displayed<br> */<br>@@ -1154,6 +1178,14 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)<br> const vlc_tick_t pts = todisplay->date;<br> vlc_tick_t system_pts = is_forced ? system_now :<br> vlc_clock_ConvertToSystem(sys->clock, system_now, pts, sys->rate);<br>+ if (unlikely(system_pts == INT64_MAX))<br>+ {<br>+ /* The clock is paused, it's too late to fallback to the previous<br>+ * picture, display the current picture anyway and force the rendering<br>+ * to now. */<br>+ system_pts = system_now;<br>+ is_forced = true;<br>+ }<br> <br> if (vd->prepare != NULL)<br> vd->prepare(vd, todisplay, do_dr_spu ? subpic : NULL, system_pts);<br>@@ -1207,11 +1239,12 @@ static int ThreadDisplayPicture(vout_thread_t *vout, vlc_tick_t *deadline)<br> assert(sys->clock);<br> <br> if (first)<br>- if (ThreadDisplayPreparePicture(vout, true, frame_by_frame)) /* FIXME not sure it is ok */<br>+ if (ThreadDisplayPreparePicture(vout, true, frame_by_frame, &paused)) /* FIXME not sure it is ok */<br> return VLC_EGENERIC;<br> <br> if (!paused || frame_by_frame)<br>- while (!sys->displayed.next && !ThreadDisplayPreparePicture(vout, false, frame_by_frame))<br>+ while (!sys->displayed.next<br>+ && !ThreadDisplayPreparePicture(vout, false, frame_by_frame, &paused))<br> ;<br> <br> const vlc_tick_t system_now = vlc_tick_now();<br>@@ -1224,10 +1257,17 @@ static int ThreadDisplayPicture(vout_thread_t *vout, vlc_tick_t *deadline)<br> const vlc_tick_t next_system_pts =<br> vlc_clock_ConvertToSystem(sys->clock, system_now,<br> sys->displayed.next->date, sys->rate);<br>-<br>- date_next = next_system_pts - render_delay;<br>- if (date_next <= system_now)<br>- drop_next_frame = true;<br>+ if (unlikely(next_system_pts == INT64_MAX))<br>+ {<br>+ /* The clock was just paused, don't display the next frame (keep<br>+ * the current one). */<br>+ paused = true;<br>+ }<br>+ {<br>+ date_next = next_system_pts - render_delay;<br>+ if (date_next <= system_now)<br>+ drop_next_frame = true;<br>+ }<br> }<br> <br> /* FIXME/XXX we must redisplay the last decoded picture (because</pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>