#define DEFAULT_NTP_NS_BASE 0
#define DEFAULT_BANDWIDTH RTP_STATS_BANDWIDTH
-#define DEFAULT_RTCP_FRACTION RTP_STATS_RTCP_BANDWIDTH
+#define DEFAULT_RTCP_FRACTION (RTP_STATS_BANDWIDTH * RTP_STATS_RTCP_FRACTION)
#define DEFAULT_RTCP_RR_BANDWIDTH -1
#define DEFAULT_RTCP_RS_BANDWIDTH -1
#define DEFAULT_SDES NULL
g_object_class_install_property (gobject_class, PROP_RTCP_FRACTION,
g_param_spec_double ("rtcp-fraction", "RTCP Fraction",
- "The RTCP bandwidth of the session in bytes per second",
+ "The RTCP bandwidth of the session in bytes per second (or as a real fraction of the RTP bandwidth if < 1)",
0.0, G_MAXDOUBLE, DEFAULT_RTCP_FRACTION, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_RTCP_RR_BANDWIDTH,
#define DEFAULT_INTERNAL_SOURCE NULL
#define DEFAULT_BANDWIDTH RTP_STATS_BANDWIDTH
-#define DEFAULT_RTCP_FRACTION RTP_STATS_RTCP_BANDWIDTH
+#define DEFAULT_RTCP_FRACTION (RTP_STATS_RTCP_FRACTION * RTP_STATS_BANDWIDTH)
#define DEFAULT_RTCP_RR_BANDWIDTH -1
#define DEFAULT_RTCP_RS_BANDWIDTH -1
#define DEFAULT_RTCP_MTU 1400
g_object_class_install_property (gobject_class, PROP_RTCP_FRACTION,
g_param_spec_double ("rtcp-fraction", "RTCP Fraction",
- "The fraction of the bandwidth used for RTCP",
+ "The fraction of the bandwidth used for RTCP (or as a real fraction of the RTP bandwidth if < 1)",
0.0, G_MAXDOUBLE, DEFAULT_RTCP_FRACTION,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/* bandwidths */
gboolean recalc_bandwidth;
guint bandwidth;
- guint rtcp_bandwidth;
+ gdouble rtcp_bandwidth;
guint rtcp_rr_bandwidth;
guint rtcp_rs_bandwidth;
* defaults.
*/
void
-rtp_stats_set_bandwidths (RTPSessionStats * stats, guint rtp_bw, guint rtcp_bw,
- guint rs, guint rr)
+rtp_stats_set_bandwidths (RTPSessionStats * stats, guint rtp_bw,
+ gdouble rtcp_bw, guint rs, guint rr)
{
GST_DEBUG ("recalc bandwidths: RTP %u, RTCP %u, RS %u, RR %u", rtp_bw,
rtcp_bw, rs, rr);
if (rs != -1 && rr != -1)
rtcp_bw = rs + rr;
+ /* If rtcp_bw is between 0 and 1, it is a fraction of rtp_bw */
+ if (rtcp_bw > 0 && rtcp_bw < 1) {
+ if (rtp_bw > 0)
+ rtcp_bw = rtp_bw * rtcp_bw;
+ else
+ rtcp_bw = -1;
+ }
+
/* RTCP is 5% of the RTP bandwidth */
- if (rtp_bw == -1 && rtcp_bw != -1)
+ if (rtp_bw == -1 && rtcp_bw > 0)
rtp_bw = rtcp_bw * 20;
- else if (rtp_bw != -1 && rtcp_bw == -1)
+ else if (rtp_bw != -1 && rtcp_bw < 0)
rtcp_bw = rtp_bw / 20;
- else if (rtp_bw == -1 && rtcp_bw == -1) {
+ else if (rtp_bw == -1 && rtcp_bw < 0) {
/* nothing given, take defaults */
rtp_bw = RTP_STATS_BANDWIDTH;
- rtcp_bw = RTP_STATS_RTCP_BANDWIDTH;
+ rtcp_bw = rtp_bw = RTP_STATS_RTCP_FRACTION;
}
+
stats->bandwidth = rtp_bw;
stats->rtcp_bandwidth = rtcp_bw;
} RTPSourceStats;
#define RTP_STATS_BANDWIDTH 64000
-#define RTP_STATS_RTCP_BANDWIDTH 3200
+#define RTP_STATS_RTCP_FRACTION 0.05
/*
* Minimum average time between RTCP packets from this site (in
* seconds). This time prevents the reports from `clumping' when
void rtp_stats_init_defaults (RTPSessionStats *stats);
-void rtp_stats_set_bandwidths (RTPSessionStats *stats, guint rtp_bw, guint rtcp_bw,
+void rtp_stats_set_bandwidths (RTPSessionStats *stats,
+ guint rtp_bw,
+ gdouble rtcp_bw,
guint rs, guint rr);
GstClockTime rtp_stats_calculate_rtcp_interval (RTPSessionStats *stats, gboolean sender, gboolean first);