diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-09-16 19:28:11 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-09-25 23:55:00 +0200 |
commit | a0ae6b5b5a73d1afeeeced38e61bf1f106f9eb12 (patch) | |
tree | 4d25a4da1f113377c87e942ecc48e6e12ce555d1 /gst/rtpmanager/gstrtpsession.c | |
parent | 4dade84258ad27fb9e1dfc40b6431dcf6f1f3ccf (diff) |
rtpbin/session: Allow RTCP sync to happen based on capture time or send time
Send time is the previous behaviour and the default, but there are use cases
where you want to synchronize based on the capture time.
https://bugzilla.gnome.org/show_bug.cgi?id=755125
Diffstat (limited to 'gst/rtpmanager/gstrtpsession.c')
-rw-r--r-- | gst/rtpmanager/gstrtpsession.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c index 2604c61fd..844a75f5d 100644 --- a/gst/rtpmanager/gstrtpsession.c +++ b/gst/rtpmanager/gstrtpsession.c @@ -223,6 +223,7 @@ enum #define DEFAULT_PROBATION RTP_DEFAULT_PROBATION #define DEFAULT_RTP_PROFILE GST_RTP_PROFILE_AVP #define DEFAULT_NTP_TIME_SOURCE GST_RTP_NTP_TIME_SOURCE_NTP +#define DEFAULT_RTCP_SYNC_SEND_TIME TRUE enum { @@ -240,7 +241,8 @@ enum PROP_PROBATION, PROP_STATS, PROP_RTP_PROFILE, - PROP_NTP_TIME_SOURCE + PROP_NTP_TIME_SOURCE, + PROP_RTCP_SYNC_SEND_TIME }; #define GST_RTP_SESSION_GET_PRIVATE(obj) \ @@ -274,6 +276,7 @@ struct _GstRtpSessionPrivate gboolean use_pipeline_clock; GstRtpNtpTimeSource ntp_time_source; + gboolean rtcp_sync_send_time; guint rtx_count; }; @@ -682,6 +685,13 @@ gst_rtp_session_class_init (GstRtpSessionClass * klass) gst_rtp_ntp_time_source_get_type (), DEFAULT_NTP_TIME_SOURCE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_RTCP_SYNC_SEND_TIME, + g_param_spec_boolean ("rtcp-sync-send-time", "RTCP Sync Send Time", + "Use send time or capture time for RTCP sync " + "(TRUE = send time, FALSE = capture time)", + DEFAULT_RTCP_SYNC_SEND_TIME, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_rtp_session_change_state); gstelement_class->request_new_pad = @@ -726,6 +736,7 @@ gst_rtp_session_init (GstRtpSession * rtpsession) rtpsession->priv->sysclock = gst_system_clock_obtain (); rtpsession->priv->session = rtp_session_new (); rtpsession->priv->use_pipeline_clock = DEFAULT_USE_PIPELINE_CLOCK; + rtpsession->priv->rtcp_sync_send_time = DEFAULT_RTCP_SYNC_SEND_TIME; /* configure callbacks */ rtp_session_set_callbacks (rtpsession->priv->session, &callbacks, rtpsession); @@ -821,6 +832,9 @@ gst_rtp_session_set_property (GObject * object, guint prop_id, case PROP_NTP_TIME_SOURCE: priv->ntp_time_source = g_value_get_enum (value); break; + case PROP_RTCP_SYNC_SEND_TIME: + priv->rtcp_sync_send_time = g_value_get_boolean (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -884,6 +898,9 @@ gst_rtp_session_get_property (GObject * object, guint prop_id, case PROP_NTP_TIME_SOURCE: g_value_set_enum (value, priv->ntp_time_source); break; + case PROP_RTCP_SYNC_SEND_TIME: + g_value_set_boolean (value, priv->rtcp_sync_send_time); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -2174,7 +2191,8 @@ gst_rtp_session_chain_send_rtp_common (GstRtpSession * rtpsession, running_time = gst_segment_to_running_time (&rtpsession->send_rtp_seg, GST_FORMAT_TIME, timestamp); - running_time += priv->send_latency; + if (priv->rtcp_sync_send_time) + running_time += priv->send_latency; } else { /* no timestamp. */ running_time = -1; |