summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorPhilippe Kalaf <philippe.kalaf@collabora.co.uk>2005-12-18 00:56:07 +0000
committerPhilippe Kalaf <philippe.kalaf@collabora.co.uk>2005-12-18 00:56:07 +0000
commitf5723a256e5945b63b7bbfa12d1ae874a73b5dfe (patch)
tree0d73cee66d58217fdc030622fd1cca9312629a86 /gst-libs
parent3247ffbbb30007f51c2c2fb52d0318d89c1af1ea (diff)
gst-libs/gst/rtp/gstbasertpdepayload.c: Handle downstream newsegment by sending our own newsegment before the next bu...
Original commit message from CVS: 2005-12-17 Philippe Khalaf <burger@speedy.org> * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_init), (gst_base_rtp_depayload_handle_sink_event): Handle downstream newsegment by sending our own newsegment before the next buffer to be released. (#323900)
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/rtp/gstbasertpdepayload.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/gst-libs/gst/rtp/gstbasertpdepayload.c b/gst-libs/gst/rtp/gstbasertpdepayload.c
index 64ba48b5f..54ef567c6 100644
--- a/gst-libs/gst/rtp/gstbasertpdepayload.c
+++ b/gst-libs/gst/rtp/gstbasertpdepayload.c
@@ -79,6 +79,8 @@ static gboolean gst_base_rtp_depayload_setcaps (GstPad * pad, GstCaps * caps);
static GstFlowReturn gst_base_rtp_depayload_chain (GstPad * pad,
GstBuffer * in);
+static gboolean
+gst_base_rtp_depayload_handle_sink_event (GstPad * pad, GstEvent * event);
static GstStateChangeReturn gst_base_rtp_depayload_change_state (GstElement *
element, GstStateChange transition);
@@ -139,6 +141,8 @@ gst_base_rtp_depayload_init (GstBaseRTPDepayload * filter, gpointer g_class)
gst_pad_set_setcaps_function (filter->sinkpad,
gst_base_rtp_depayload_setcaps);
gst_pad_set_chain_function (filter->sinkpad, gst_base_rtp_depayload_chain);
+ gst_pad_set_event_function (filter->sinkpad,
+ gst_base_rtp_depayload_handle_sink_event);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
pad_template =
@@ -205,6 +209,33 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
return ret;
}
+static gboolean
+gst_base_rtp_depayload_handle_sink_event (GstPad * pad, GstEvent * event)
+{
+ GstBaseRTPDepayload *filter =
+ GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
+ gboolean res = TRUE;
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_NEWSEGMENT:
+ {
+ GST_DEBUG_OBJECT (filter,
+ "Upstream sent a NEWSEGMENT, handle in worker thread.");
+ /* the worker thread will assign a new RTP-TS<->GST-TS mapping
+ * based on the next processed RTP packet */
+ filter->need_newsegment = TRUE;
+ gst_event_unref (event);
+ break;
+ }
+ default:
+ /* pass other events forward */
+ res = gst_pad_push_event (filter->srcpad, event);
+ break;
+ }
+
+ return res;
+}
+
static GstFlowReturn
gst_base_rtp_depayload_add_to_queue (GstBaseRTPDepayload * filter,
GstBuffer * in)
@@ -359,8 +390,10 @@ 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 */
- /* sleep for 5msec */
+ /* sleep for 5msec (XXX: 5msec is a value that works for audio and video,
+ * should be adjusted based on frequency of incoming packet,
+ * or by data comsumption rate of the sink (depends on how
+ * clock-drift compensation is implemented) */
gst_base_rtp_depayload_wait (filter, GST_MSECOND * 5);
}
return NULL;