+2005-11-04 Zeeshan Ali <zeenix@gmail.com>
+
+ * gst-libs/gst/rtp/gstbasertpdepayload.c:
+ (gst_base_rtp_depayload_class_init), (gst_base_rtp_depayload_init),
+ (gst_base_rtp_depayload_thread), (gst_base_rtp_depayload_wait),
+ (gst_base_rtp_depayload_set_clock):
+ * gst-libs/gst/rtp/gstbasertpdepayload.h:
+ Don't sleep on the bench (system clock) when you have a nice
+ comfortable bed (Gstreamer clock) to sleep on.
+
2005-11-03 Wim Taymans <wim@fluendo.com>
* gst/playback/gstdecodebin.c: (gst_decode_bin_init),
static GstFlowReturn gst_base_rtp_depayload_chain (GstPad * pad,
GstBuffer * in);
+static void gst_base_rtp_depayload_set_clock (GstElement * element,
+ GstClock * clock);
static GstStateChangeReturn gst_base_rtp_depayload_change_state (GstElement *
element, GstStateChange transition);
static GstFlowReturn gst_base_rtp_depayload_add_to_queue (GstBaseRTPDepayload *
static void gst_base_rtp_depayload_set_gst_timestamp
(GstBaseRTPDepayload * filter, guint32 timestamp, GstBuffer * buf);
+static void
+gst_base_rtp_depayload_wait (GstBaseRTPDepayload * filter, GstClockTime time);
static void
gst_base_rtp_depayload_base_init (GstBaseRTPDepayloadClass * klass)
gobject_class->finalize = gst_base_rtp_depayload_finalize;
+ gstelement_class->set_clock =
+ GST_DEBUG_FUNCPTR (gst_base_rtp_depayload_set_clock);
gstelement_class->change_state = gst_base_rtp_depayload_change_state;
klass->add_to_queue = gst_base_rtp_depayload_add_to_queue;
/* this one needs to be overwritten by child */
filter->clock_rate = 0;
+ filter->clock = NULL;
}
static void
while (filter->thread_running) {
gst_base_rtp_depayload_queue_release (filter);
/* i want to run this thread clock_rate times per second */
- g_usleep (1000000 / filter->clock_rate);
+ gst_base_rtp_depayload_wait (filter, GST_NSECOND / filter->clock_rate);
}
return NULL;
}
return TRUE;
}
+static void
+gst_base_rtp_depayload_wait (GstBaseRTPDepayload * filter, GstClockTime time)
+{
+ GstClockID id;
+
+ g_return_if_fail (filter->clock != NULL);
+ g_return_if_fail (GST_CLOCK_TIME_IS_VALID (time));
+
+ id = gst_clock_new_single_shot_id (filter->clock, time);
+
+ gst_clock_id_wait (id, NULL);
+ gst_clock_id_unref (id);
+}
+
+static void
+gst_base_rtp_depayload_set_clock (GstElement * element, GstClock * clock)
+{
+ GstBaseRTPDepayload *sink;
+
+ sink = GST_BASE_RTP_DEPAYLOAD (element);
+
+ sink->clock = clock;
+}
+
static GstStateChangeReturn
gst_base_rtp_depayload_change_state (GstElement * element,
GstStateChange transition)