<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div><br></div><div>On Thu, Sep 5, 2019, at 16:36, Rémi Denis-Courmont wrote:<br></div><blockquote type="cite" id="qt"><div>Hi,<br></div><div><br></div><div>I don't follow the comments. We need to support rendering when paused, to update OSD (and potentially to handle seeking while paused).<br></div></blockquote><div><br></div><div>Yes, this behavior is not changed. What changes with this commit, when the clock is paused before the vout:<br></div><div> - The next picture is not updated, so we keep displaying the current picture.<br></div><div> - Fix the system date that we pass to plugins: it won't be INT64_MAX but tick_now()<br></div><div><br></div><blockquote type="cite" id="qt"><div><br></div><div class="qt-gmail_quote"><div>Le 5 septembre 2019 14:40:02 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><pre class="qt-k9mail"><div>This case can happen during a very short timespan, when the clock is paused<br></div><div>before the vout thread processed the pause event.<br></div><div><br></div><div>There are two way to handle it:<br></div><div><br></div><div> - In the prepare step: continue processing the picture but don't display it,<br></div><div> (keep displaying the old one, that is sys->displayed.current).<br></div><div><br></div><div> - In the render step: make the picture as forced and display it now. It's too<br></div><div> late to fallback to the previous picture.<hr> src/video_output/video_output.c | 56 ++++++++++++++++++++++++++++-----<br></div><div> 1 file changed, 48 insertions(+), 8 deletions(-)<br></div><div><br></div><div>diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c<br></div><div>index 2c63624808..5badb35321 100644<br></div><div>--- a/src/video_output/video_output.c<br></div><div>+++ b/src/video_output/video_output.c<br></div><div>@@ -865,7 +865,8 @@ static void ThreadChangeFilters(vout_thread_t *vout,<br></div><div> <br></div><div> <br></div><div> /* */<br></div><div>-static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool frame_by_frame)<br></div><div>+static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse,<br></div><div>+ bool frame_by_frame, bool *paused)<br></div><div> {<br></div><div> bool is_late_dropped = vout->p->is_late_dropped && !vout->p->pause.is_on && !frame_by_frame;<br></div><div> vout_thread_sys_t *sys = vout->p;<br></div><div>@@ -888,7 +889,19 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool fra<br></div><div> const vlc_tick_t system_pts =<br></div><div> vlc_clock_ConvertToSystem(vout->p->clock, date,<br></div><div> decoded->date, sys->rate);<br></div><div>- const vlc_tick_t late = date - system_pts;<br></div><div>+<br></div><div>+ vlc_tick_t late;<br></div><div>+ if (system_pts == INT64_MAX)<br></div><div>+ {<br></div><div>+ /* The clock is paused, notify it (so that the current<br></div><div>+ * picture is displayed but not the next one), this<br></div><div>+ * current picture can't be be late. */<br></div><div>+ *paused = true;<br></div><div>+ late = 0;<br></div><div>+ }<br></div><div>+ else<br></div><div>+ late = date - system_pts;<br></div><div>+<br></div><div> vlc_tick_t late_threshold;<br></div><div> if (decoded->format.i_frame_rate && decoded->format.i_frame_rate_base)<br></div><div> late_threshold = VLC_TICK_FROM_MS(500) * decoded->format.i_frame_rate_base / decoded->format.i_frame_rate;<br></div><div>@@ -1021,10 +1034,21 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)<br></div><div> if (sys->pause.is_on)<br></div><div> render_subtitle_date = sys->pause.date;<br></div><div> else<br></div><div>+ {<br></div><div> render_subtitle_date = filtered->date <= 1 ? system_now :<br></div><div> vlc_clock_ConvertToSystem(sys->clock, system_now, filtered->date,<br></div><div> sys->rate);<br></div><div> <br></div><div>+ /* The clock is paused, it's too late to fallback to the previous<br></div><div>+ * picture, display the current picture anyway and force the rendering<br></div><div>+ * to now. */<br></div><div>+ if (unlikely(render_subtitle_date == INT64_MAX))<br></div><div>+ {<br></div><div>+ render_subtitle_date = system_now;<br></div><div>+ is_forced = true;<br></div><div>+ }<br></div><div>+ }<br></div><div>+<br></div><div> /*<br></div><div> * Get the subpicture to be displayed<br></div><div> */<br></div><div>@@ -1154,6 +1178,14 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)<br></div><div> const vlc_tick_t pts = todisplay->date;<br></div><div> vlc_tick_t system_pts = is_forced ? system_now :<br></div><div> vlc_clock_ConvertToSystem(sys->clock, system_now, pts, sys->rate);<br></div><div>+ if (unlikely(system_pts == INT64_MAX))<br></div><div>+ {<br></div><div>+ /* The clock is paused, it's too late to fallback to the previous<br></div><div>+ * picture, display the current picture anyway and force the rendering<br></div><div>+ * to now. */<br></div><div>+ system_pts = system_now;<br></div><div>+ is_forced = true;<br></div><div>+ }<br></div><div> <br></div><div> if (vd->prepare != NULL)<br></div><div> vd->prepare(vd, todisplay, do_dr_spu ? subpic : NULL, system_pts);<br></div><div>@@ -1207,11 +1239,12 @@ static int ThreadDisplayPicture(vout_thread_t *vout, vlc_tick_t *deadline)<br></div><div> assert(sys->clock);<br></div><div> <br></div><div> if (first)<br></div><div>- if (ThreadDisplayPreparePicture(vout, true, frame_by_frame)) /* FIXME not sure it is ok */<br></div><div>+ if (ThreadDisplayPreparePicture(vout, true, frame_by_frame, &paused)) /* FIXME not sure it is ok */<br></div><div> return VLC_EGENERIC;<br></div><div> <br></div><div> if (!paused || frame_by_frame)<br></div><div>- while (!sys->displayed.next && !ThreadDisplayPreparePicture(vout, false, frame_by_frame))<br></div><div>+ while (!sys->displayed.next<br></div><div>+ && !ThreadDisplayPreparePicture(vout, false, frame_by_frame, &paused))<br></div><div> ;<br></div><div> <br></div><div> const vlc_tick_t system_now = vlc_tick_now();<br></div><div>@@ -1224,10 +1257,17 @@ static int ThreadDisplayPicture(vout_thread_t *vout, vlc_tick_t *deadline)<br></div><div> const vlc_tick_t next_system_pts =<br></div><div> vlc_clock_ConvertToSystem(sys->clock, system_now,<br></div><div> sys->displayed.next->date, sys->rate);<br></div><div>-<br></div><div>- date_next = next_system_pts - render_delay;<br></div><div>- if (date_next <= system_now)<br></div><div>- drop_next_frame = true;<br></div><div>+ if (unlikely(next_system_pts == INT64_MAX))<br></div><div>+ {<br></div><div>+ /* The clock was just paused, don't display the next frame (keep<br></div><div>+ * the current one). */<br></div><div>+ paused = true;<br></div><div>+ }<br></div><div>+ {<br></div><div>+ date_next = next_system_pts - render_delay;<br></div><div>+ if (date_next <= system_now)<br></div><div>+ drop_next_frame = true;<br></div><div>+ }<br></div><div> }<br></div><div> <br></div><div> /* FIXME/XXX we must redisplay the last decoded picture (because<br></div></pre></blockquote></div><div><br></div><div>-- <br></div><div>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. <br></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div>https://mailman.videolan.org/listinfo/vlc-devel<br></div></blockquote><div><br></div></body></html>