rtpsession: Add property for minimum interval between Regular RTCP messages

This can be changed according to RFC 4585
This commit is contained in:
Olivier Crête 2010-06-01 19:28:01 -04:00 committed by Wim Taymans
parent cdb5465741
commit 975e1fecb3
4 changed files with 39 additions and 0 deletions

View file

@ -199,6 +199,7 @@ enum
#define DEFAULT_NUM_SOURCES 0
#define DEFAULT_NUM_ACTIVE_SOURCES 0
#define DEFAULT_USE_PIPELINE_CLOCK FALSE
#define DEFAULT_RTCP_MIN_INTERVAL (RTP_STATS_MIN_INTERVAL * GST_SECOND)
enum
{
@ -213,6 +214,7 @@ enum
PROP_NUM_ACTIVE_SOURCES,
PROP_INTERNAL_SESSION,
PROP_USE_PIPELINE_CLOCK,
PROP_RTCP_MIN_INTERVAL,
PROP_LAST
};
@ -588,6 +590,12 @@ gst_rtp_session_class_init (GstRtpSessionClass * klass)
DEFAULT_USE_PIPELINE_CLOCK,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_RTCP_MIN_INTERVAL,
g_param_spec_uint64 ("rtcp-min-interval", "Minimum RTCP interval",
"Minimum interval between Regular RTCP packet (in ns)",
0, G_MAXUINT64, DEFAULT_RTCP_MIN_INTERVAL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_rtp_session_change_state);
gstelement_class->request_new_pad =
@ -693,6 +701,10 @@ gst_rtp_session_set_property (GObject * object, guint prop_id,
case PROP_USE_PIPELINE_CLOCK:
priv->use_pipeline_clock = g_value_get_boolean (value);
break;
case PROP_RTCP_MIN_INTERVAL:
g_object_set_property (G_OBJECT (priv->session), "rtcp-min-interval",
value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -745,6 +757,10 @@ gst_rtp_session_get_property (GObject * object, guint prop_id,
case PROP_USE_PIPELINE_CLOCK:
g_value_set_boolean (value, priv->use_pipeline_clock);
break;
case PROP_RTCP_MIN_INTERVAL:
g_object_get_property (G_OBJECT (priv->session), "rtcp-min-interval",
value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View file

@ -56,6 +56,7 @@ enum
#define DEFAULT_NUM_SOURCES 0
#define DEFAULT_NUM_ACTIVE_SOURCES 0
#define DEFAULT_SOURCES NULL
#define DEFAULT_RTCP_MIN_INTERVAL (RTP_STATS_MIN_INTERVAL * GST_SECOND)
enum
{
@ -72,6 +73,7 @@ enum
PROP_NUM_ACTIVE_SOURCES,
PROP_SOURCES,
PROP_FAVOR_NEW,
PROP_RTCP_MIN_INTERVAL,
PROP_LAST
};
@ -360,6 +362,11 @@ rtp_session_class_init (RTPSessionClass * klass)
"Resolve SSRC conflict in favor of new sources", FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_RTCP_MIN_INTERVAL,
g_param_spec_uint64 ("rtcp-min-interval", "Minimum RTCP interval",
"Minimum interval between Regular RTCP packet (in ns)",
0, G_MAXUINT64, DEFAULT_RTCP_MIN_INTERVAL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
klass->get_source_by_ssrc =
GST_DEBUG_FUNCPTR (rtp_session_get_source_by_ssrc);
@ -505,6 +512,10 @@ rtp_session_set_property (GObject * object, guint prop_id,
case PROP_FAVOR_NEW:
sess->favor_new = g_value_get_boolean (value);
break;
case PROP_RTCP_MIN_INTERVAL:
rtp_stats_set_min_interval (&sess->stats,
(gdouble) g_value_get_uint64 (value) / GST_SECOND);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -556,6 +567,9 @@ rtp_session_get_property (GObject * object, guint prop_id,
case PROP_FAVOR_NEW:
g_value_set_boolean (value, sess->favor_new);
break;
case PROP_RTCP_MIN_INTERVAL:
g_value_set_uint64 (value, sess->stats.min_interval * GST_SECOND);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View file

@ -286,3 +286,9 @@ rtp_stats_get_packets_lost (const RTPSourceStats * stats)
return lost;
}
void
rtp_stats_set_min_interval (RTPSessionStats * stats, gdouble min_interval)
{
stats->min_interval = min_interval;
}

View file

@ -195,4 +195,7 @@ GstClockTime rtp_stats_calculate_rtcp_interval (RTPSessionStats *stats, gbo
GstClockTime rtp_stats_add_rtcp_jitter (RTPSessionStats *stats, GstClockTime interval);
GstClockTime rtp_stats_calculate_bye_interval (RTPSessionStats *stats);
gint64 rtp_stats_get_packets_lost (const RTPSourceStats *stats);
void rtp_stats_set_min_interval (RTPSessionStats *stats,
gdouble min_interval);
#endif /* __RTP_STATS_H__ */