static void gst_rtp_session_reconsider (RTPSession * sess, gpointer user_data);
static void gst_rtp_session_request_key_unit (RTPSession * sess,
gboolean all_headers, gpointer user_data);
+static GstClockTime gst_rtp_session_request_time (RTPSession * session,
+ gpointer user_data);
static RTPSessionCallbacks callbacks = {
gst_rtp_session_process_rtp,
gst_rtp_session_send_rtcp,
gst_rtp_session_clock_rate,
gst_rtp_session_reconsider,
- gst_rtp_session_request_key_unit
+ gst_rtp_session_request_key_unit,
+ gst_rtp_session_request_time
};
/* GObject vmethods */
"all-headers", G_TYPE_BOOLEAN, all_headers, NULL));
gst_pad_push_event (rtpsession->send_rtp_sink, event);
}
+
+static GstClockTime
+gst_rtp_session_request_time (RTPSession * session, gpointer user_data)
+{
+ GstRtpSession *rtpsession = GST_RTP_SESSION (user_data);
+
+ return gst_clock_get_time (rtpsession->priv->sysclock);
+}
sess->callbacks.request_key_unit = callbacks->request_key_unit;
sess->request_key_unit_user_data = user_data;
}
+ if (callbacks->request_time) {
+ sess->callbacks.request_time = callbacks->request_time;
+ sess->request_time_user_data = user_data;
+ }
}
/**
sess->reconsider_user_data = user_data;
}
+/**
+ * rtp_session_set_request_time_callback:
+ * @sess: an #RTPSession
+ * @callback: callback to set
+ * @user_data: user data passed in the callback
+ *
+ * Configure only the request_time callback
+ */
+void
+rtp_session_set_request_time_callback (RTPSession * sess,
+ RTPSessionRequestTime callback, gpointer user_data)
+{
+ g_return_if_fail (RTP_IS_SESSION (sess));
+
+ sess->callbacks.request_time = callback;
+ sess->request_time_user_data = user_data;
+}
+
/**
* rtp_session_set_bandwidth:
* @sess: an #RTPSession
typedef void (*RTPSessionRequestKeyUnit) (RTPSession *sess,
gboolean all_headers, gpointer user_data);
+/**
+ * RTPSessionRequestTime:
+ * @sess: an #RTPSession
+ * @user_data: user data specified when registering
+ *
+ * This callback will be called when @sess needs the current time. The time
+ * should be returned as a #GstClockTime
+ */
+typedef GstClockTime (*RTPSessionRequestTime) (RTPSession *sess,
+ gpointer user_data);
+
/**
* RTPSessionCallbacks:
* @RTPSessionProcessRTP: callback to process RTP packets
RTPSessionClockRate clock_rate;
RTPSessionReconsider reconsider;
RTPSessionRequestKeyUnit request_key_unit;
+ RTPSessionRequestTime request_time;
} RTPSessionCallbacks;
/**
gpointer clock_rate_user_data;
gpointer reconsider_user_data;
gpointer request_key_unit_user_data;
+ gpointer request_time_user_data;
RTPSessionStats stats;
void rtp_session_set_reconsider_callback (RTPSession * sess,
RTPSessionReconsider callback,
gpointer user_data);
+void rtp_session_set_request_time_callback (RTPSession * sess,
+ RTPSessionRequestTime callback,
+ gpointer user_data);
+
void rtp_session_set_bandwidth (RTPSession *sess, gdouble bandwidth);
gdouble rtp_session_get_bandwidth (RTPSession *sess);
void rtp_session_set_rtcp_fraction (RTPSession *sess, gdouble fraction);