surface: fix memory leak through unreleased parent context.

Break the circular references between GstVaapiContext and its children
GstVaapiSurfaces. Since the VA surfaces held an extra reference to the
context, which holds a reference to its VA surfaces, then none of those
were released.

How does this impact support for subpictures?

The only situation when the parent context needs to disappear is when
it is replaced with another one because of a resolution change in the
video stream for instance, or a normal destroy. In this case, it does
not really matter to apply subpictures to the peer surfaces since they
are either gone, or those that are left in the pipe can probably bear
a reinstantiation of the subpictures for it.

So, parent_context is set to NULL when the parent context is destroyed,
other VA surfaces can still get subpictures attached to them, individually
not as a whole. i.e. subpictures for surface S1 will be created from
active composition buffers and associated to S1, subpictures for S2 will
be created from the next active composition buffers, etc. We don't try
to cache the subpictures in those cases (pending surfaces until EOS
is reached, or pending surfaces until new surfaces matching new VA context
get to be used instead).
This commit is contained in:
Gwenole Beauchesne 2013-05-30 18:17:07 +02:00
parent c12dc19b8b
commit 18031dc6ff

View file

@ -312,7 +312,7 @@ gst_vaapi_surface_set_parent_context(
{
g_return_if_fail(surface != NULL);
gst_vaapi_object_replace(&surface->parent_context, context);
surface->parent_context = NULL;
}
/**