[gstreamer-bugs] [Bug 547352] New: race condition with GstPadBufferAllocFunction

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Mon Aug 11 14:33:12 PDT 2008


If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=547352

  GStreamer | gstreamer (core) | Ver: HEAD CVS
           Summary: race condition with GstPadBufferAllocFunction
           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: ivanohe at abacom.com
         QAContact: gstreamer-bugs at lists.sourceforge.net
     GNOME version: Unspecified
   GNOME milestone: Unspecified


There is a race condition when gstreamer call an element
GstPadBufferAllocFunction. There is a possibility that the element is doing a
state change from paused to ready at the same time.

I got the problem in my older version of gstreamer, but I see the problem is
still there in head.

I can see this with this pipeline and some modif in the code

gst-launch videotestsrc num-buffers=2000 !  videoscale ! "video/x-raw-yuv,
format=(fourcc)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1"
!  fakesink

And doing ctrl-c.

The modif I made to see the problem occur are in gstbasetransform. I just set
flags and some g_usleep to make the problem occur more often. I can see that 
gst_base_transform_activate is called (and code after the STREAM_LOCK/UNLOCK
run while at the same time, some code is running on the same element in
gst_base_transform_buffer_alloc.

(on my older gstreamer, this cause a problem with the variable
trans->have_same_caps being changed and causing a gwarning since I run my app
with --gst-fatal-warnings).

The fix is simple and consist of putting a stream lock in gstpad.c

GST_PAD_STREAM_LOCK (pad);
   ret = bufferallocfunc (pad, offset, size, caps, buf);
GST_PAD_STREAM_UNLOCK (pad);

This seems to work correct with my application (and my not up to date
gstreamer). However, I am wondering if this can cause some problem.


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=547352.




More information about the Gstreamer-bugs mailing list