mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
rtpsession: Add callback to get the current time
This commit is contained in:
parent
a630c68fc3
commit
c0996e6b90
3 changed files with 51 additions and 1 deletions
|
@ -259,6 +259,8 @@ static gint gst_rtp_session_clock_rate (RTPSession * sess, guint8 payload,
|
||||||
static void gst_rtp_session_reconsider (RTPSession * sess, gpointer user_data);
|
static void gst_rtp_session_reconsider (RTPSession * sess, gpointer user_data);
|
||||||
static void gst_rtp_session_request_key_unit (RTPSession * sess,
|
static void gst_rtp_session_request_key_unit (RTPSession * sess,
|
||||||
gboolean all_headers, gpointer user_data);
|
gboolean all_headers, gpointer user_data);
|
||||||
|
static GstClockTime gst_rtp_session_request_time (RTPSession * session,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
static RTPSessionCallbacks callbacks = {
|
static RTPSessionCallbacks callbacks = {
|
||||||
gst_rtp_session_process_rtp,
|
gst_rtp_session_process_rtp,
|
||||||
|
@ -267,7 +269,8 @@ static RTPSessionCallbacks callbacks = {
|
||||||
gst_rtp_session_send_rtcp,
|
gst_rtp_session_send_rtcp,
|
||||||
gst_rtp_session_clock_rate,
|
gst_rtp_session_clock_rate,
|
||||||
gst_rtp_session_reconsider,
|
gst_rtp_session_reconsider,
|
||||||
gst_rtp_session_request_key_unit
|
gst_rtp_session_request_key_unit,
|
||||||
|
gst_rtp_session_request_time
|
||||||
};
|
};
|
||||||
|
|
||||||
/* GObject vmethods */
|
/* GObject vmethods */
|
||||||
|
@ -2159,3 +2162,11 @@ gst_rtp_session_request_key_unit (RTPSession * sess,
|
||||||
"all-headers", G_TYPE_BOOLEAN, all_headers, NULL));
|
"all-headers", G_TYPE_BOOLEAN, all_headers, NULL));
|
||||||
gst_pad_push_event (rtpsession->send_rtp_sink, event);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -773,6 +773,10 @@ rtp_session_set_callbacks (RTPSession * sess, RTPSessionCallbacks * callbacks,
|
||||||
sess->callbacks.request_key_unit = callbacks->request_key_unit;
|
sess->callbacks.request_key_unit = callbacks->request_key_unit;
|
||||||
sess->request_key_unit_user_data = user_data;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -883,6 +887,24 @@ rtp_session_set_reconsider_callback (RTPSession * sess,
|
||||||
sess->reconsider_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:
|
* rtp_session_set_bandwidth:
|
||||||
* @sess: an #RTPSession
|
* @sess: an #RTPSession
|
||||||
|
|
|
@ -133,6 +133,17 @@ typedef void (*RTPSessionReconsider) (RTPSession *sess, gpointer user_data);
|
||||||
typedef void (*RTPSessionRequestKeyUnit) (RTPSession *sess,
|
typedef void (*RTPSessionRequestKeyUnit) (RTPSession *sess,
|
||||||
gboolean all_headers, gpointer user_data);
|
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:
|
* RTPSessionCallbacks:
|
||||||
* @RTPSessionProcessRTP: callback to process RTP packets
|
* @RTPSessionProcessRTP: callback to process RTP packets
|
||||||
|
@ -154,6 +165,7 @@ typedef struct {
|
||||||
RTPSessionClockRate clock_rate;
|
RTPSessionClockRate clock_rate;
|
||||||
RTPSessionReconsider reconsider;
|
RTPSessionReconsider reconsider;
|
||||||
RTPSessionRequestKeyUnit request_key_unit;
|
RTPSessionRequestKeyUnit request_key_unit;
|
||||||
|
RTPSessionRequestTime request_time;
|
||||||
} RTPSessionCallbacks;
|
} RTPSessionCallbacks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,6 +225,7 @@ struct _RTPSession {
|
||||||
gpointer clock_rate_user_data;
|
gpointer clock_rate_user_data;
|
||||||
gpointer reconsider_user_data;
|
gpointer reconsider_user_data;
|
||||||
gpointer request_key_unit_user_data;
|
gpointer request_key_unit_user_data;
|
||||||
|
gpointer request_time_user_data;
|
||||||
|
|
||||||
RTPSessionStats stats;
|
RTPSessionStats stats;
|
||||||
|
|
||||||
|
@ -278,6 +291,10 @@ void rtp_session_set_clock_rate_callback (RTPSession * sess,
|
||||||
void rtp_session_set_reconsider_callback (RTPSession * sess,
|
void rtp_session_set_reconsider_callback (RTPSession * sess,
|
||||||
RTPSessionReconsider callback,
|
RTPSessionReconsider callback,
|
||||||
gpointer user_data);
|
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);
|
void rtp_session_set_bandwidth (RTPSession *sess, gdouble bandwidth);
|
||||||
gdouble rtp_session_get_bandwidth (RTPSession *sess);
|
gdouble rtp_session_get_bandwidth (RTPSession *sess);
|
||||||
void rtp_session_set_rtcp_fraction (RTPSession *sess, gdouble fraction);
|
void rtp_session_set_rtcp_fraction (RTPSession *sess, gdouble fraction);
|
||||||
|
|
Loading…
Reference in a new issue