mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 13:06:23 +00:00
Don't sleep on the bench (system clock) when you have a nice comfortable bed (Gstreamer clock) to sleep on.
Original commit message from CVS: Don't sleep on the bench (system clock) when you have a nice comfortable bed (Gstreamer clock) to sleep on.
This commit is contained in:
parent
6e48aa490c
commit
5194aac11a
3 changed files with 44 additions and 1 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
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),
|
||||
|
|
|
@ -80,6 +80,8 @@ static gboolean gst_base_rtp_depayload_setcaps (GstPad * pad, GstCaps * caps);
|
|||
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 *
|
||||
|
@ -88,6 +90,8 @@ 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)
|
||||
|
@ -114,6 +118,8 @@ gst_base_rtp_depayload_class_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;
|
||||
|
@ -151,6 +157,7 @@ gst_base_rtp_depayload_init (GstBaseRTPDepayload * filter, gpointer g_class)
|
|||
|
||||
/* this one needs to be overwritten by child */
|
||||
filter->clock_rate = 0;
|
||||
filter->clock = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -358,7 +365,7 @@ gst_base_rtp_depayload_thread (GstBaseRTPDepayload * filter)
|
|||
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;
|
||||
}
|
||||
|
@ -387,6 +394,30 @@ gst_base_rtp_depayload_stop_thread (GstBaseRTPDepayload * filter)
|
|||
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)
|
||||
|
|
|
@ -78,6 +78,8 @@ struct _GstBaseRTPDepayload
|
|||
*/
|
||||
GQueue *queue;
|
||||
|
||||
GstClock *clock;
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue