gst/udp/gstudpsrc.*: Don't call gst_pad_push in a get function. Fixes #150449
authorJan Schmidt <thaytan@mad.scientist.com>
Thu, 19 Aug 2004 13:33:46 +0000 (13:33 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Thu, 19 Aug 2004 13:33:46 +0000 (13:33 +0000)
Original commit message from CVS:
* gst/udp/gstudpsrc.c: (gst_udpsrc_init), (gst_udpsrc_get):
* gst/udp/gstudpsrc.h:
Don't call gst_pad_push in a get function. Fixes #150449

ChangeLog
gst/udp/gstudpsrc.c
gst/udp/gstudpsrc.h

index c1c7a5a..c0b536b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-08-19  Jan Schmidt  <thaytan@mad.scientist.com>
+       * gst/udp/gstudpsrc.c: (gst_udpsrc_init), (gst_udpsrc_get):
+       * gst/udp/gstudpsrc.h:
+         Don't call gst_pad_push in a get function. Fixes #150449
+
 2004-08-18  Wim Taymans  <wim@fluendo.com>
 
        * gst/tcp/gstfdset.c: (gst_fdset_free), (gst_fdset_set_mode),
index 8486376..801176c 100644 (file)
@@ -175,6 +175,7 @@ gst_udpsrc_init (GstUDPSrc * udpsrc)
   udpsrc->multi_group = g_strdup (UDP_DEFAULT_MULTICAST_GROUP);
 
   udpsrc->first_buf = TRUE;
+  udpsrc->defer_data = NULL;
 }
 
 static GstData *
@@ -193,6 +194,13 @@ gst_udpsrc_get (GstPad * pad)
 
   udpsrc = GST_UDPSRC (GST_OBJECT_PARENT (pad));
 
+  if (udpsrc->defer_data != NULL) {
+    GstData *outdata = udpsrc->defer_data;
+
+    udpsrc->defer_data = NULL;
+    return outdata;
+  }
+
   FD_ZERO (&read_fds);
   FD_SET (udpsrc->sock, &read_fds);
   if (udpsrc->control != CONTROL_NONE) {
@@ -275,7 +283,7 @@ gst_udpsrc_get (GstPad * pad)
           discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
               current_time, NULL);
 
-          gst_pad_push (udpsrc->srcpad, GST_DATA (discont));
+          udpsrc->defer_data = GST_DATA (discont);
         }
 
         udpsrc->first_buf = FALSE;
@@ -296,12 +304,21 @@ gst_udpsrc_get (GstPad * pad)
         gst_buffer_unref (outbuf);
         outbuf = NULL;
       }
-
     }
   } else {
     perror ("select");
     outbuf = NULL;
   }
+  if (udpsrc->defer_data) {
+    GstData *databuf = udpsrc->defer_data;
+
+    udpsrc->defer_data = GST_DATA (outbuf);
+    return databuf;
+  }
+
+  if (outbuf == NULL)
+    return GST_DATA (gst_event_new (GST_EVENT_EMPTY));
+
   return GST_DATA (outbuf);
 }
 
index f16673d..7573a2c 100644 (file)
@@ -75,6 +75,7 @@ struct _GstUDPSrc {
   GstClock *clock;
 
   gboolean first_buf;
+  GstData *defer_data;
 };
 
 struct _GstUDPSrcClass {