[gstreamer-bugs] [Bug 628176] [basetransform] Problems with buffer handling in inplace mode

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Thu Sep 23 09:09:55 PDT 2010


https://bugzilla.gnome.org/show_bug.cgi?id=628176
  GStreamer | gstreamer (core) | git

--- Comment #1 from Wim Taymans <wim.taymans at gmail.com> 2010-09-23 16:09:51 UTC ---
(In reply to comment #0)
> 
> This is the memcpy() in gstbasetransform.c:2186:
> >      if (inbuf != *outbuf) {
> >        /* different buffers, copy the input to the output first, we then do an
> >         * in-place transform on the output buffer. */
> >        memcpy (GST_BUFFER_DATA (*outbuf), GST_BUFFER_DATA (inbuf),
> >            GST_BUFFER_SIZE (inbuf));
> >      }
> 
> If the data pointers are the same but the buffer pointer are not the same, one
> of them must be a subbuffer of the other one and both are not writable at all,
> or even worse, they're completely unrelated but share the same memory.

Your reasoning would be correct if it weren't for the FIXME in
gst_base_transform_prepare_output_buffer(). the problem is currently that when
the prepare_output_buffer function reuses the input buffer as output buffer
(which would increase the refcount of in/out), we decrease that refcount later
again in order to keep the reused buffer writable.

I don't quite remember how this abomination came to live but it think it was a
natural result of the refcounting practices for a function like
prepare_output_buffer(). It should have taken ownership of the input buffer
instead of how it was designed before.

So, you can end up in above situation without anything being really wrong.. 

I think the best thing is to simply check for the pointers as well.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- 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