summaryrefslogtreecommitdiffstats
path: root/gst/udp/gstudpsrc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/udp/gstudpsrc.c')
-rw-r--r--gst/udp/gstudpsrc.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c
index 8486376c..801176c9 100644
--- a/gst/udp/gstudpsrc.c
+++ b/gst/udp/gstudpsrc.c
@@ -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);
}