[vlc-devel] [PATCH 2/2] vout: don't drop window size when there is no display plugins yet

Alexandre Janniaux ajanni at videolabs.io
Fri Mar 27 11:05:21 CET 2020


Hi,

On Fri, Mar 27, 2020 at 10:39:29AM +0100, Thomas Guillem wrote:
>
>
> On Fri, Mar 27, 2020, at 10:19, Rémi Denis-Courmont wrote:
> > Le perjantaina 27. maaliskuuta 2020, 10.57.36 EET Thomas Guillem a écrit :
> > > This fixes the window size that was ignored when the size was updated from
> > > the open callback of the window plugin.
> > >
> > > Fixes #22674
> > > ---
> > >  src/video_output/video_output.c  | 9 +++++++++
> > >  src/video_output/vout_internal.h | 2 ++
> > >  2 files changed, 11 insertions(+)
> > >
> > > diff --git a/src/video_output/video_output.c
> > > b/src/video_output/video_output.c index 373c09f1dc..dffd93f4d2 100644
> > > --- a/src/video_output/video_output.c
> > > +++ b/src/video_output/video_output.c
> > > @@ -425,6 +425,10 @@ void vout_ChangeDisplaySize(vout_thread_t *vout,
> > >
> > >      /* DO NOT call this outside the vout window callbacks */
> > >      vlc_mutex_lock(&sys->display_lock);
> > > +
> > > +    sys->window_width = width;
> > > +    sys->window_height = height;
> > > +
> > >      if (sys->display != NULL)
> > >          vout_display_SetSize(sys->display, width, height);
> > >      vlc_mutex_unlock(&sys->display_lock);
> > > @@ -1605,6 +1609,10 @@ static int vout_Start(vout_thread_t *vout,
> > > vlc_video_context *vctx, const vout_c vlc_mutex_lock(&sys->display_lock);
> > >      vlc_mutex_unlock(&sys->window_lock);
> > >
> > > +    /* Setup the window size, protected by the display_lock */
> > > +    dcfg.window_props.width = sys->window_width;
> > > +    dcfg.window_props.height = sys->window_height;
> > > +
> > >      sys->display = vout_OpenWrapper(vout, sys->splitter_name, &dcfg, vctx);
> > > if (sys->display == NULL) {
> > >          vlc_mutex_unlock(&sys->display_lock);
> > > @@ -1938,6 +1946,7 @@ vout_thread_t *vout_Create(vlc_object_t *object)
> > >      vlc_mutex_init(&sys->display_lock);
> > >
> > >      /* Window */
> > > +    sys->window_width = sys->window_height = 0;
> >
> > Shouldn't this go into sys->display_cfg now?
>
> For now, the whole display_cfg struct is written with the window_lock held.
> Nevertheless, the window size are written with the display_lock held.
>
> So we have 2 choices:
>  - Protect display_cfg.window with the display_lock and the other part of this struct with window_lock. For me, it is quite confusing (but still perfectly valid)
> .
>  - Keep the previous behavior: only protect display_cfg with one lock (window_lock) and create a temp vout_display_cfg (like it's already done, before creating the VD wrapper) from the display_cfg and window_width/height.

In the long run, it might be a good idea to start the display
module in the most suitable thread for the windowing system,
as it would greatly simplify the sizing mechanisms.

It's not directly linked to this fix though.

Regards,
--
Alexandre Janniaux
Videolabs


More information about the vlc-devel mailing list