gstwaylandsink: "hide" video window when pipeline is stopped

Nicolas Dufresne nicolas at ndufresne.ca
Thu Jan 23 18:19:14 UTC 2020


Le jeudi 23 janvier 2020 à 17:53 +0100, Guillermo Rodriguez Garcia a écrit :
> Hi,
> 
> El jue., 23 ene. 2020 a las 17:30, Nicolas Dufresne
> (<nicolas at ndufresne.ca>) escribió:
> > Le jeudi 23 janvier 2020 à 11:47 +0100, Guillermo Rodriguez Garcia a écrit :
> > > El mié., 22 ene. 2020 a las 21:47, Nicolas Dufresne
> > > (<nicolas at ndufresne.ca>) escribió:
> > > > Le mercredi 22 janvier 2020 à 18:36 +0100, Guillermo Rodriguez Garcia a
> > > > écrit :
> > > > > Hello all,
> > > > > 
> > > > > I am using gstwaylandsink to render to an application supplied surface
> > > > > (via the GstVideoOverlay interface). I need to control the position of
> > > > > the video window, so the application creates a top-level, fully
> > > > > transparent surface with the same size as the screen, then I use
> > > > > set_render_rectangle to tell waylandsink where the video should
> > > > > actually be drawn. This is working fine.
> > > > > 
> > > > > My problem is that when the pipeline is stopped (state set to NULL),
> > > > > the video area is cleared to black, and stays on top of the
> > > > > controlling application. I would need the video area to be "hidden"
> > > > > instead (i.e. removed from the composition).
> > > > > 
> > > > > The thing is that looking at the code it seems that this (hiding the
> > > > > window) was actually the intended behaviour. Pipeline state changes
> > > > > are handled in gst_wayland_sink_change_state [1]. For the PAUSED to
> > > > > READY transition, the code looks like this:
> > > > > 
> > > > >     case GST_STATE_CHANGE_PAUSED_TO_READY:
> > > > >       gst_buffer_replace (&sink->last_buffer, NULL);
> > > > >       if (sink->window) {
> > > > >         if (gst_wl_window_is_toplevel (sink->window)) {
> > > > >           g_clear_object (&sink->window);
> > > > >         } else {
> > > > >           /* remove buffer from surface, show nothing */
> > > > >           gst_wl_window_render (sink->window, NULL, NULL);
> > > > >         }
> > > > >       }
> > > > > 
> > > > > In my case, sink->window is not a toplevel, so the 'else' branch runs.
> > > > > 
> > > > > gst_wl_window_render does a wl_surface_attach with a NULL buffer +
> > > > > wl_surface_commit, which should actually "hide" the window. Yet for
> > > > > some reason this is not what is happening.
> > > > > 
> > > > > I am probably missing something; any ideas or hints?
> > > > 
> > > > Indeed, I would expect exactly what you want to happen. Which compositor
> > > > is
> > > > this?
> > > 
> > > I am using Weston in my application but I have checked and I get
> > > exactly the same behaviour with Mutter...
> > 
> > Had a second thought, you said we do remove the surface on the video
> > subsurface,
> > did we forgot to do the same on the backplate subsurface ? Remember there is
> > 2
> > subsurfaces, one is a opaque black plane, that handle the bars when there is
> > padding due to pixel aspect ration adjustment. Maybe that's the problem ?
> 
> Yes, exactly! I thought the video surface was being cleared to black
> but that's not what
> is happening. The video surface is being removed properly, but the
> black surface behind
> remains there.
> 
> Shall I prepare a patch for this ?

Please do if you have the time, seems exactly what we should be doing.

> 
> Guillermo Rodriguez Garcia
> guille.rodriguez at gmail.com
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list