mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-03 16:09:39 +00:00
rtpbin: allow configurable rtcp stream syncing interval
... rather than necessarily syncing at each RTCP SR.
This commit is contained in:
parent
afd26f0078
commit
f29c253934
2 changed files with 37 additions and 0 deletions
|
@ -213,6 +213,9 @@ struct _GstRtpBinPrivate
|
||||||
gint shutdown;
|
gint shutdown;
|
||||||
|
|
||||||
gboolean autoremove;
|
gboolean autoremove;
|
||||||
|
|
||||||
|
/* UNIX (ntp) time of last SR sync used */
|
||||||
|
guint64 last_unix;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* signals and args */
|
/* signals and args */
|
||||||
|
@ -245,6 +248,7 @@ enum
|
||||||
#define DEFAULT_AUTOREMOVE FALSE
|
#define DEFAULT_AUTOREMOVE FALSE
|
||||||
#define DEFAULT_BUFFER_MODE RTP_JITTER_BUFFER_MODE_SLAVE
|
#define DEFAULT_BUFFER_MODE RTP_JITTER_BUFFER_MODE_SLAVE
|
||||||
#define DEFAULT_USE_PIPELINE_CLOCK FALSE
|
#define DEFAULT_USE_PIPELINE_CLOCK FALSE
|
||||||
|
#define DEFAULT_RTCP_SYNC_INTERVAL 0
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -254,6 +258,7 @@ enum
|
||||||
PROP_DO_LOST,
|
PROP_DO_LOST,
|
||||||
PROP_IGNORE_PT,
|
PROP_IGNORE_PT,
|
||||||
PROP_NTP_SYNC,
|
PROP_NTP_SYNC,
|
||||||
|
PROP_RTCP_SYNC_INTERVAL,
|
||||||
PROP_AUTOREMOVE,
|
PROP_AUTOREMOVE,
|
||||||
PROP_BUFFER_MODE,
|
PROP_BUFFER_MODE,
|
||||||
PROP_USE_PIPELINE_CLOCK,
|
PROP_USE_PIPELINE_CLOCK,
|
||||||
|
@ -1103,6 +1108,16 @@ gst_rtp_bin_associate (GstRtpBin * bin, GstRtpBinStream * stream, guint8 len,
|
||||||
GST_DEBUG_OBJECT (bin, "client %p min delta %" G_GINT64_FORMAT, client,
|
GST_DEBUG_OBJECT (bin, "client %p min delta %" G_GINT64_FORMAT, client,
|
||||||
min);
|
min);
|
||||||
|
|
||||||
|
/* bail out if we adjusted recently enough */
|
||||||
|
if (all_sync && (last_unix - bin->priv->last_unix) <
|
||||||
|
bin->rtcp_sync_interval * GST_MSECOND) {
|
||||||
|
GST_DEBUG_OBJECT (bin, "discarding RTCP sender packet for sync; "
|
||||||
|
"previous sender info too recent "
|
||||||
|
"(previous UNIX %" G_GUINT64_FORMAT ")", bin->priv->last_unix);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bin->priv->last_unix = last_unix;
|
||||||
|
|
||||||
/* calculate offsets for each stream */
|
/* calculate offsets for each stream */
|
||||||
for (walk = client->streams; walk; walk = g_slist_next (walk)) {
|
for (walk = client->streams; walk; walk = g_slist_next (walk)) {
|
||||||
GstRtpBinStream *ostream = (GstRtpBinStream *) walk->data;
|
GstRtpBinStream *ostream = (GstRtpBinStream *) walk->data;
|
||||||
|
@ -1677,6 +1692,19 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
|
||||||
"Synchronize received streams to the NTP clock", DEFAULT_NTP_SYNC,
|
"Synchronize received streams to the NTP clock", DEFAULT_NTP_SYNC,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstRtpBin::rtcp-sync-interval:
|
||||||
|
*
|
||||||
|
* Determines how often to sync streams using RTCP data.
|
||||||
|
*
|
||||||
|
* Since: 0.10.31
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class, PROP_RTCP_SYNC_INTERVAL,
|
||||||
|
g_param_spec_uint ("rtcp-sync-interval", "RTCP Sync Interval",
|
||||||
|
"RTCP SR interval synchronization (ms) (0 = always)",
|
||||||
|
0, G_MAXUINT, DEFAULT_RTCP_SYNC_INTERVAL,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_rtp_bin_change_state);
|
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_rtp_bin_change_state);
|
||||||
gstelement_class->request_new_pad =
|
gstelement_class->request_new_pad =
|
||||||
GST_DEBUG_FUNCPTR (gst_rtp_bin_request_new_pad);
|
GST_DEBUG_FUNCPTR (gst_rtp_bin_request_new_pad);
|
||||||
|
@ -1706,6 +1734,7 @@ gst_rtp_bin_init (GstRtpBin * rtpbin, GstRtpBinClass * klass)
|
||||||
rtpbin->do_lost = DEFAULT_DO_LOST;
|
rtpbin->do_lost = DEFAULT_DO_LOST;
|
||||||
rtpbin->ignore_pt = DEFAULT_IGNORE_PT;
|
rtpbin->ignore_pt = DEFAULT_IGNORE_PT;
|
||||||
rtpbin->ntp_sync = DEFAULT_NTP_SYNC;
|
rtpbin->ntp_sync = DEFAULT_NTP_SYNC;
|
||||||
|
rtpbin->rtcp_sync_interval = DEFAULT_RTCP_SYNC_INTERVAL;
|
||||||
rtpbin->priv->autoremove = DEFAULT_AUTOREMOVE;
|
rtpbin->priv->autoremove = DEFAULT_AUTOREMOVE;
|
||||||
rtpbin->buffer_mode = DEFAULT_BUFFER_MODE;
|
rtpbin->buffer_mode = DEFAULT_BUFFER_MODE;
|
||||||
rtpbin->use_pipeline_clock = DEFAULT_USE_PIPELINE_CLOCK;
|
rtpbin->use_pipeline_clock = DEFAULT_USE_PIPELINE_CLOCK;
|
||||||
|
@ -1821,6 +1850,9 @@ gst_rtp_bin_set_property (GObject * object, guint prop_id,
|
||||||
case PROP_NTP_SYNC:
|
case PROP_NTP_SYNC:
|
||||||
rtpbin->ntp_sync = g_value_get_boolean (value);
|
rtpbin->ntp_sync = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_RTCP_SYNC_INTERVAL:
|
||||||
|
rtpbin->rtcp_sync_interval = g_value_get_uint (value);
|
||||||
|
break;
|
||||||
case PROP_IGNORE_PT:
|
case PROP_IGNORE_PT:
|
||||||
rtpbin->ignore_pt = g_value_get_boolean (value);
|
rtpbin->ignore_pt = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
@ -1883,6 +1915,9 @@ gst_rtp_bin_get_property (GObject * object, guint prop_id,
|
||||||
case PROP_NTP_SYNC:
|
case PROP_NTP_SYNC:
|
||||||
g_value_set_boolean (value, rtpbin->ntp_sync);
|
g_value_set_boolean (value, rtpbin->ntp_sync);
|
||||||
break;
|
break;
|
||||||
|
case PROP_RTCP_SYNC_INTERVAL:
|
||||||
|
g_value_set_uint (value, rtpbin->rtcp_sync_interval);
|
||||||
|
break;
|
||||||
case PROP_AUTOREMOVE:
|
case PROP_AUTOREMOVE:
|
||||||
g_value_set_boolean (value, rtpbin->priv->autoremove);
|
g_value_set_boolean (value, rtpbin->priv->autoremove);
|
||||||
break;
|
break;
|
||||||
|
@ -2108,6 +2143,7 @@ gst_rtp_bin_change_state (GstElement * element, GstStateChange transition)
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
|
priv->last_unix = 0;
|
||||||
GST_LOG_OBJECT (rtpbin, "clearing shutdown flag");
|
GST_LOG_OBJECT (rtpbin, "clearing shutdown flag");
|
||||||
g_atomic_int_set (&priv->shutdown, 0);
|
g_atomic_int_set (&priv->shutdown, 0);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -50,6 +50,7 @@ struct _GstRtpBin {
|
||||||
gboolean do_lost;
|
gboolean do_lost;
|
||||||
gboolean ignore_pt;
|
gboolean ignore_pt;
|
||||||
gboolean ntp_sync;
|
gboolean ntp_sync;
|
||||||
|
guint rtcp_sync_interval;
|
||||||
RTPJitterBufferMode buffer_mode;
|
RTPJitterBufferMode buffer_mode;
|
||||||
gboolean buffering;
|
gboolean buffering;
|
||||||
gboolean use_pipeline_clock;
|
gboolean use_pipeline_clock;
|
||||||
|
|
Loading…
Reference in a new issue