[vlc-devel] [PATCH 4/6] video_output: conditionnally render on display

Alexandre Janniaux ajanni at videolabs.io
Fri Feb 5 10:36:07 UTC 2021


Hi,

Fixed with the following diff:

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 12356bbda6..6db54fa143 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1455,10 +1455,13 @@ static int ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now)
     const unsigned frame_rate = todisplay->format.i_frame_rate;
     const unsigned frame_rate_base = todisplay->format.i_frame_rate_base;

-    if (vd->ops->prepare != NULL && sys->rendering_enabled)
-        vd->ops->prepare(vd, todisplay, do_dr_spu ? subpic : NULL, system_pts);
+    if (sys->rendering_enabled)
+    {
+        if (vd->ops->prepare != NULL)
+            vd->ops->prepare(vd, todisplay, do_dr_spu ? subpic : NULL, system_pts);

-    vout_chrono_Stop(&sys->render);
+        vout_chrono_Stop(&sys->render);
+    }
 #if 0
         {
         static int i = 0;

Like Thomas suggested, I don't alter the chrono_Start() call
because the display lock isn't protected there.

In the future, if we want to remove cases where the filters
are running for nothing, we'll probably need a way to protect
the code there too.

Regards,
--
Alexandre Janniaux
Videolabs


On Fri, Feb 05, 2021 at 11:16:12AM +0100, Alexandre Janniaux wrote:
> Hi,
>
> Ok, I'll fix that, thanks for the report!
>
> Regards,
> --
> Alexandre Janniaux
> Videolabs
>
> On Fri, Feb 05, 2021 at 10:57:41AM +0100, Thomas Guillem wrote:
> >
> >
> > On Fri, Feb 5, 2021, at 10:55, Steve Lhomme wrote:
> > > This is going to mess the sys->render chrono during the time rendering
> > > is suspending.
> >
> > Indeed, chrono_Stop() should not be called in that case.
> >
> > Then, the next chrono_Start() will drop the last reference.
> >
> > >
> > > On 2021-02-05 10:01, Alexandre Janniaux wrote:
> > > > Don't prepare/display if rendering is disabled. Rendering can only be
> > > > disabled when taking the display_lock so the prepare/display cannot be
> > > > done partially because of this patch.
> > > > ---
> > > >   src/video_output/video_output.c | 6 ++++--
> > > >   1 file changed, 4 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
> > > > index d225e56d8d..11c50871c1 100644
> > > > --- a/src/video_output/video_output.c
> > > > +++ b/src/video_output/video_output.c
> > > > @@ -1405,7 +1405,7 @@ static int ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now)
> > > >       const unsigned frame_rate = todisplay->format.i_frame_rate;
> > > >       const unsigned frame_rate_base = todisplay->format.i_frame_rate_base;
> > > >
> > > > -    if (vd->ops->prepare != NULL)
> > > > +    if (vd->ops->prepare != NULL && sys->rendering_enabled)
> > > >           vd->ops->prepare(vd, todisplay, do_dr_spu ? subpic : NULL, system_pts);
> > > >
> > > >       vout_chrono_Stop(&sys->render);
> > > > @@ -1452,7 +1452,9 @@ static int ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now)
> > > >                             frame_rate, frame_rate_base);
> > > >
> > > >       /* Display the direct buffer returned by vout_RenderPicture */
> > > > -    vout_display_Display(vd, todisplay);
> > > > +    if (sys->rendering_enabled)
> > > > +        vout_display_Display(vd, todisplay);
> > > > +
> > > >       vlc_mutex_unlock(&sys->display_lock);
> > > >
> > > >       if (subpic)
> > > > --
> > > > 2.28.0
> > > >
> > > > _______________________________________________
> > > > vlc-devel mailing list
> > > > To unsubscribe or modify your subscription options:
> > > > https://mailman.videolan.org/listinfo/vlc-devel
> > > >
> > > _______________________________________________
> > > vlc-devel mailing list
> > > To unsubscribe or modify your subscription options:
> > > https://mailman.videolan.org/listinfo/vlc-devel
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list