gst/udp/gstudpsrc.*: Don't call gst_pad_push in a get function. Fixes #150449

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
This commit is contained in:
Jan Schmidt 2004-08-19 13:33:46 +00:00
parent 5de70d8e4b
commit 7c336e85ad
3 changed files with 25 additions and 2 deletions

View file

@ -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> 2004-08-18 Wim Taymans <wim@fluendo.com>
* gst/tcp/gstfdset.c: (gst_fdset_free), (gst_fdset_set_mode), * gst/tcp/gstfdset.c: (gst_fdset_free), (gst_fdset_set_mode),

View file

@ -175,6 +175,7 @@ gst_udpsrc_init (GstUDPSrc * udpsrc)
udpsrc->multi_group = g_strdup (UDP_DEFAULT_MULTICAST_GROUP); udpsrc->multi_group = g_strdup (UDP_DEFAULT_MULTICAST_GROUP);
udpsrc->first_buf = TRUE; udpsrc->first_buf = TRUE;
udpsrc->defer_data = NULL;
} }
static GstData * static GstData *
@ -193,6 +194,13 @@ gst_udpsrc_get (GstPad * pad)
udpsrc = GST_UDPSRC (GST_OBJECT_PARENT (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_ZERO (&read_fds);
FD_SET (udpsrc->sock, &read_fds); FD_SET (udpsrc->sock, &read_fds);
if (udpsrc->control != CONTROL_NONE) { if (udpsrc->control != CONTROL_NONE) {
@ -275,7 +283,7 @@ gst_udpsrc_get (GstPad * pad)
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
current_time, NULL); current_time, NULL);
gst_pad_push (udpsrc->srcpad, GST_DATA (discont)); udpsrc->defer_data = GST_DATA (discont);
} }
udpsrc->first_buf = FALSE; udpsrc->first_buf = FALSE;
@ -296,12 +304,21 @@ gst_udpsrc_get (GstPad * pad)
gst_buffer_unref (outbuf); gst_buffer_unref (outbuf);
outbuf = NULL; outbuf = NULL;
} }
} }
} else { } else {
perror ("select"); perror ("select");
outbuf = NULL; 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); return GST_DATA (outbuf);
} }

View file

@ -75,6 +75,7 @@ struct _GstUDPSrc {
GstClock *clock; GstClock *clock;
gboolean first_buf; gboolean first_buf;
GstData *defer_data;
}; };
struct _GstUDPSrcClass { struct _GstUDPSrcClass {