[gstreamer-bugs] [Bug 393099] New: GstBuffer copy vfunc broken?

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Fri Jan 5 03:43:26 PST 2007


Do not reply to this via email (we are currently unable to handle email
responses and they get discarded).  You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=393099

  GStreamer | gstreamer (core) | Ver: HEAD CVS

           Summary: GstBuffer copy vfunc broken?
           Product: GStreamer
           Version: HEAD CVS
          Platform: Other
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: t.i.m at zen.co.uk
         QAContact: gstreamer-bugs at lists.sourceforge.net
     GNOME version: Unspecified
   GNOME milestone: Unspecified


The GstBuffer class ::copy() vfunc wrongly creates a new buffer with a
GstBuffer GType and the size of a GstBuffer structure, instead of creating a
new buffer with the same type and size as the input buffer.

This fails spectactularly in the case of GstNetBuffer from gst-plugins-base,
which just chains up to GstBuffer::copy and then copies over some additional
fields.

This might have been done on purpose, but I still wonder whether this isn't
broken and should be fixed, since it kind of defeats the purpose of
sub-classing (copying over the code from the copy vfunc into every subclass
doesn't seem like a particularly good idea).

However, changing GstBuffer::copy() to create a new buffer struct of the type
and size of the incoming buffer will probably break implementations of
read-only buffers that have been built on top of this behaviour (such as
GstSubBuffer and GstFileSrcMMapBuffer). The reason this breaks stuff is because
::copy() is used to create a writable buffer.

Possibilities:

 1) declare current behaviour as broken, and use
      copy = gst_mini_object_new (G_TYPE_FROM_INSTANCE (buffer))
    in GstBuffer::copy() and fix up read-only buffer subclasses to
    munge the GType before chaining up to the parent class copy function.
    This might break external uses of read-only buffer subclasses that
    chain up to GstBuffer::copy() though.

 2) just fix GstNetBuffer not to chain up and copy over code from gstbuffer.c

 3) make functionality from GstBuffer::copy() available as new function that
    operates on an already-copied buffer structure, so sub-classes just
    create their own copied buffer instance and then use that new function
    instead of chaining up to the parent class's copy function.

Opinions?


-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email




More information about the Gstreamer-bugs mailing list