[Bug 772835] videooverlaycomposition: Need unref composition when remove video overlay composition meta

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Fri Oct 14 13:42:27 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=772835

Nicolas Dufresne (stormer) <nicolas at ndufresne.ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #8 from Nicolas Dufresne (stormer) <nicolas at ndufresne.ca> ---
(In reply to kevin from comment #7)
> Below is our code.
> 
>   while ((meta = gst_buffer_iterate_meta (src, &state))) {
>     if (meta->info->api == GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE) {
>       compmeta = (GstVideoOverlayCompositionMeta*)meta;
>       if (GST_IS_VIDEO_OVERLAY_COMPOSITION (compmeta->overlay)) {
>         comp_copy = gst_video_overlay_composition_copy(compmeta->overlay);
>         if (comp_copy) {
>           gst_buffer_add_video_overlay_composition_meta(dst, comp_copy);
>         }
>       }
>     }
>   }
> 
> gst_video_overlay_composition_copy() will new comp_copy and
> gst_buffer_add_video_overlay_composition_meta() will add one ref. Do you
> have any suggestion.

According to the API, you must unref if you don't want to keep the composition
after gst_buffer_add_video_overlay_composition_meta(). So basically, it is your
fault if it leaks. The API makes sense, since the the
GstVideoOverlayComposition meta is a copy on write object. That means if it's
reference count is bigger then 1, it will be considered immutable and
gst_video_overlay_composition_make_writable() will copy. The appropriate usage
here is the following:

> compmeta = gst_buffer_get_video_overlay_composition_meta(src);
> if (compmeta)
>   gst_buffer_add_video_overlay_composition_meta (dst, compmeta->overlay);

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list