PROP_LAST
};
-/* update average packet size, we keep this scaled by 16 to keep enough
- * precision. */
+/* update average packet size */
+#define INIT_AVG(avg, val) \
+ (avg) = (val);
#define UPDATE_AVG(avg, val) \
if ((avg) == 0) \
- (avg) = (val) << 4; \
+ (avg) = (val); \
else \
- (avg) = ((val) + (15 * (avg)));
+ (avg) = ((val) + (15 * (val))) >> 4;
/* The number RTCP intervals after which to timeout entries in the
* collision table
/* at least one member wants to send a BYE */
g_free (sess->bye_reason);
sess->bye_reason = g_strdup (reason);
- /* The avg packet size is kept scaled by 16 */
- sess->stats.avg_rtcp_packet_size = 100 * 16;
+ INIT_AVG (sess->stats.avg_rtcp_packet_size, 100);
sess->stats.bye_members = 1;
sess->first_rtcp = TRUE;
sess->sent_bye = FALSE;
/* close the RTCP packet */
gst_rtcp_buffer_end (data.rtcp);
- GST_DEBUG ("sending packet");
if (sess->callbacks.send_rtcp) {
UPDATE_AVG (sess->stats.avg_rtcp_packet_size,
GST_BUFFER_SIZE (data.rtcp));
- result = sess->callbacks.send_rtcp (sess, own, data.rtcp,
- sess->sent_bye, sess->send_rtcp_user_data);
+ GST_DEBUG ("sending RTCP packet, avg size %u",
+ sess->stats.avg_rtcp_packet_size);
+ result =
+ sess->callbacks.send_rtcp (sess, own, data.rtcp, sess->sent_bye,
+ sess->send_rtcp_user_data);
} else {
GST_DEBUG ("freeing packet");
gst_buffer_unref (data.rtcp);
if (rtcp_bw <= 0.00001)
return GST_CLOCK_TIME_NONE;
- avg_rtcp_size = stats->avg_rtcp_packet_size / 16.0;
+ avg_rtcp_size = stats->avg_rtcp_packet_size;
/*
* The effective number of sites times the average packet size is
* the total number of octets sent when each site sends a report.
* time interval we send one report so this time is also our
* average time between reports.
*/
+ GST_DEBUG ("avg size %f, n %f, rtcp_bw %f", avg_rtcp_size, n, rtcp_bw);
interval = avg_rtcp_size * n / rtcp_bw;
if (interval < rtcp_min_time)
interval = rtcp_min_time;
if (rtcp_bw <= 0.0001)
return GST_CLOCK_TIME_NONE;
- avg_rtcp_size = stats->avg_rtcp_packet_size / 16.0;
+ avg_rtcp_size = stats->avg_rtcp_packet_size;
/*
* The effective number of sites times the average packet size is
* the total number of octets sent when each site sends a report.
* Returns: total RTP packets lost.
*/
gint64
-rtp_stats_get_packets_lost (const RTPSourceStats *stats)
+rtp_stats_get_packets_lost (const RTPSourceStats * stats)
{
gint64 lost;
guint64 extended_max, expected;
lost = expected - stats->packets_received;
return lost;
-}
\ No newline at end of file
+}