diff options
-rw-r--r-- | gst/udp/gstudpsink.c | 20 | ||||
-rw-r--r-- | gst/udp/gstudpsink.h | 2 | ||||
-rw-r--r-- | gst/udp/gstudpsrc.c | 2 |
3 files changed, 23 insertions, 1 deletions
diff --git a/gst/udp/gstudpsink.c b/gst/udp/gstudpsink.c index 4273dda6..a9059032 100644 --- a/gst/udp/gstudpsink.c +++ b/gst/udp/gstudpsink.c @@ -165,6 +165,16 @@ gst_udpsink_sinkconnect (GstPad *pad, GstCaps *caps) } static void +gst_udpsink_set_clock (GstElement *element, GstClock *clock) +{ + GstUDPSink *udpsink; + + udpsink = GST_UDPSINK (element); + + udpsink->clock = clock; +} + +static void gst_udpsink_init (GstUDPSink *udpsink) { /* create the sink and src pads */ @@ -175,6 +185,10 @@ gst_udpsink_init (GstUDPSink *udpsink) udpsink->host = g_strdup (UDP_DEFAULT_HOST); udpsink->port = UDP_DEFAULT_PORT; + + udpsink->clock = NULL; + + GST_ELEMENT (udpsink)->setclockfunc = gst_udpsink_set_clock; } static void @@ -182,12 +196,18 @@ gst_udpsink_chain (GstPad *pad, GstBuffer *buf) { GstUDPSink *udpsink; int tolen; + GstClockTimeDiff *jitter = NULL; g_return_if_fail (pad != NULL); g_return_if_fail (GST_IS_PAD (pad)); g_return_if_fail (buf != NULL); udpsink = GST_UDPSINK (GST_OBJECT_PARENT (pad)); + + if (udpsink->clock) { + GST_DEBUG (0, "udpsink: clock wait: %llu\n", GST_BUFFER_TIMESTAMP (buf)); + gst_element_clock_wait (GST_ELEMENT (udpsink), udpsink->clock, GST_BUFFER_TIMESTAMP (buf), jitter); + } tolen = sizeof(udpsink->theiraddr); diff --git a/gst/udp/gstudpsink.h b/gst/udp/gstudpsink.h index 0f986fdb..0fd39f4e 100644 --- a/gst/udp/gstudpsink.h +++ b/gst/udp/gstudpsink.h @@ -73,6 +73,8 @@ struct _GstUDPSink { gint port; gchar *host; + + GstClock *clock; }; struct _GstUDPSinkClass { diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c index 39541f70..2de4b266 100644 --- a/gst/udp/gstudpsrc.c +++ b/gst/udp/gstudpsrc.c @@ -266,7 +266,7 @@ gst_udpsrc_init_receive (GstUDPSrc *src) fcntl (src->control_sock, F_SETFL, O_NONBLOCK); GST_FLAG_SET (src, GST_UDPSRC_OPEN); - + return TRUE; } |