rtp: Add property to disable RTCP reports per internal rtpsource

This is useful when implementing custom retransmission mechanism like
RIST to prevent RTCP from being produces for the retransmitted SSRC.
This would also be used in general for various purpose when customizing
an RTP base pipeline.
This commit is contained in:
Nicolas Dufresne 2019-02-12 18:28:40 -05:00
parent b88a3abf46
commit 06c340edd4
3 changed files with 32 additions and 1 deletions

View file

@ -3476,6 +3476,11 @@ session_report_blocks (const gchar * key, RTPSource * source, ReportData * data)
goto reported;
}
if (source->disable_rtcp) {
GST_DEBUG ("source %08x has RTCP disabled", source->ssrc);
goto reported;
}
GST_DEBUG ("create RB for SSRC %08x", source->ssrc);
/* get new stats */
@ -3993,6 +3998,12 @@ generate_rtcp (const gchar * key, RTPSource * source, ReportData * data)
if (sess->scheduled_bye && !source->marked_bye)
return;
/* skip if RTCP is disabled */
if (source->disable_rtcp) {
GST_DEBUG ("source %08x has RTCP disabled", source->ssrc);
return;
}
data->source = source;
/* open packet */

View file

@ -44,6 +44,7 @@ enum
#define DEFAULT_PROBATION RTP_DEFAULT_PROBATION
#define DEFAULT_MAX_DROPOUT_TIME 60000
#define DEFAULT_MAX_MISORDER_TIME 2000
#define DEFAULT_DISABLE_RTCP FALSE
enum
{
@ -56,7 +57,8 @@ enum
PROP_STATS,
PROP_PROBATION,
PROP_MAX_DROPOUT_TIME,
PROP_MAX_MISORDER_TIME
PROP_MAX_MISORDER_TIME,
PROP_DISABLE_RTCP
};
/* GObject vmethods */
@ -237,6 +239,16 @@ rtp_source_class_init (RTPSourceClass * klass)
0, G_MAXUINT, DEFAULT_MAX_MISORDER_TIME,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* RTPSession::disable-rtcp:
*
* Allow disabling the sending of RTCP packets for this source.
*/
g_object_class_install_property (gobject_class, PROP_DISABLE_RTCP,
g_param_spec_boolean ("disable-rtcp", "Disable RTCP",
"Disable sending RTCP packets for this source",
DEFAULT_DISABLE_RTCP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
GST_DEBUG_CATEGORY_INIT (rtp_source_debug, "rtpsource", 0, "RTP Source");
}
@ -541,6 +553,9 @@ rtp_source_set_property (GObject * object, guint prop_id,
case PROP_MAX_MISORDER_TIME:
src->max_misorder_time = g_value_get_uint (value);
break;
case PROP_DISABLE_RTCP:
src->disable_rtcp = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -583,6 +598,9 @@ rtp_source_get_property (GObject * object, guint prop_id,
case PROP_MAX_MISORDER_TIME:
g_value_set_uint (value, src->max_misorder_time);
break;
case PROP_DISABLE_RTCP:
g_value_set_boolean (value, src->disable_rtcp);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View file

@ -201,6 +201,8 @@ struct _RTPSource {
gboolean pt_set;
guint8 pt;
gboolean disable_rtcp;
};
struct _RTPSourceClass {