LAST_SIGNAL
};
-#define DEFAULT_LATENCY_MS 200
+#define DEFAULT_LATENCY_MS 200
#define DEFAULT_SDES NULL
#define DEFAULT_DO_LOST FALSE
#define DEFAULT_IGNORE_PT FALSE
#define DEFAULT_AUTOREMOVE FALSE
#define DEFAULT_BUFFER_MODE RTP_JITTER_BUFFER_MODE_SLAVE
+#define DEFAULT_USE_PIPELINE_CLOCK FALSE
enum
{
PROP_IGNORE_PT,
PROP_AUTOREMOVE,
PROP_BUFFER_MODE,
+ PROP_USE_PIPELINE_CLOCK,
PROP_LAST
};
/* configure SDES items */
GST_OBJECT_LOCK (rtpbin);
- g_object_set (session, "sdes", rtpbin->sdes, NULL);
+ g_object_set (session, "sdes", rtpbin->sdes, "use-pipeline-clock",
+ rtpbin->use_pipeline_clock, NULL);
GST_OBJECT_UNLOCK (rtpbin);
/* provide clock_rate to the session manager when needed */
"Send an event downstream when a packet is lost", DEFAULT_DO_LOST,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
g_object_class_install_property (gobject_class, PROP_AUTOREMOVE,
g_param_spec_boolean ("autoremove", "Auto Remove",
"Automatically remove timed out sources", DEFAULT_AUTOREMOVE,
g_param_spec_boolean ("ignore_pt", "Ignore PT",
"Do not demultiplex based on PT values", DEFAULT_IGNORE_PT,
G_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class, PROP_USE_PIPELINE_CLOCK,
+ g_param_spec_boolean ("use-pipeline-clock", "Use pipeline clock",
+ "Use the pipeline clock to set the NTP time in the RTCP SR messages",
+ DEFAULT_AUTOREMOVE, G_PARAM_READWRITE));
+
/**
* GstRtpBin::buffer-mode:
*
rtpbin->ignore_pt = DEFAULT_IGNORE_PT;
rtpbin->priv->autoremove = DEFAULT_AUTOREMOVE;
rtpbin->buffer_mode = DEFAULT_BUFFER_MODE;
+ rtpbin->use_pipeline_clock = DEFAULT_USE_PIPELINE_CLOCK;
/* some default SDES entries */
str = g_strdup_printf ("%s@%s", g_get_user_name (), g_get_host_name ());
case PROP_AUTOREMOVE:
rtpbin->priv->autoremove = g_value_get_boolean (value);
break;
+ case PROP_USE_PIPELINE_CLOCK:
+ {
+ GSList *sessions;
+ GST_RTP_BIN_LOCK (rtpbin);
+ rtpbin->use_pipeline_clock = g_value_get_boolean (value);
+ for (sessions = rtpbin->sessions; sessions;
+ sessions = g_slist_next (sessions)) {
+ g_object_set (G_OBJECT (sessions->data), "use-pipeline-clock",
+ rtpbin->use_pipeline_clock, NULL);
+ }
+ GST_RTP_BIN_UNLOCK (rtpbin);
+ }
+ break;
case PROP_BUFFER_MODE:
GST_RTP_BIN_LOCK (rtpbin);
rtpbin->buffer_mode = g_value_get_enum (value);
case PROP_BUFFER_MODE:
g_value_set_enum (value, rtpbin->buffer_mode);
break;
+ case PROP_USE_PIPELINE_CLOCK:
+ g_value_set_boolean (value, rtpbin->use_pipeline_clock);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
#define DEFAULT_SDES NULL
#define DEFAULT_NUM_SOURCES 0
#define DEFAULT_NUM_ACTIVE_SOURCES 0
+#define DEFAULT_USE_PIPELINE_CLOCK FALSE
enum
{
PROP_NUM_SOURCES,
PROP_NUM_ACTIVE_SOURCES,
PROP_INTERNAL_SESSION,
+ PROP_USE_PIPELINE_CLOCK,
PROP_LAST
};
/* NTP base time */
guint64 ntpnsbase;
+ gboolean use_pipeline_clock;
};
/* callbacks to handle actions from the session manager */
"The internal RTPSession object", RTP_TYPE_SESSION,
G_PARAM_READABLE));
+ g_object_class_install_property (gobject_class, PROP_USE_PIPELINE_CLOCK,
+ g_param_spec_boolean ("use-pipeline-clock", "Use pipeline clock",
+ "Use the pipeline clock to set the NTP time in the RTCP SR messages",
+ DEFAULT_USE_PIPELINE_CLOCK, G_PARAM_READWRITE));
+
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_rtp_session_change_state);
gstelement_class->request_new_pad =
rtpsession->priv->lock = g_mutex_new ();
rtpsession->priv->sysclock = gst_system_clock_obtain ();
rtpsession->priv->session = rtp_session_new ();
+ rtpsession->priv->use_pipeline_clock = DEFAULT_USE_PIPELINE_CLOCK;
/* configure callbacks */
rtp_session_set_callbacks (rtpsession->priv->session, &callbacks, rtpsession);
case PROP_SDES:
rtp_session_set_sdes_struct (priv->session, g_value_get_boxed (value));
break;
+ case PROP_USE_PIPELINE_CLOCK:
+ priv->use_pipeline_clock = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_INTERNAL_SESSION:
g_value_set_object (value, priv->session);
break;
+ case PROP_USE_PIPELINE_CLOCK:
+ g_value_set_boolean (value, priv->use_pipeline_clock);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
guint64 ntpns;
GstClock *clock;
GstClockTime base_time, rt;
- GTimeVal current;
GST_OBJECT_LOCK (rtpsession);
if ((clock = GST_ELEMENT_CLOCK (rtpsession))) {
gst_object_ref (clock);
GST_OBJECT_UNLOCK (rtpsession);
- /* get current NTP time */
- g_get_current_time (¤t);
- ntpns = GST_TIMEVAL_TO_TIME (current);
+ if (rtpsession->priv->use_pipeline_clock) {
+ ntpns = gst_clock_get_time (clock);
+ } else {
+ GTimeVal current;
+
+ /* get current NTP time */
+ g_get_current_time (¤t);
+ ntpns = GST_TIMEVAL_TO_TIME (current);
+ }
/* add constant to convert from 1970 based time to 1900 based time */
ntpns += (2208988800LL * GST_SECOND);