"octets-received", G_TYPE_UINT64, src->stats.octets_received,
"packets-received", G_TYPE_UINT64, src->stats.packets_received,
"bitrate", G_TYPE_UINT64, src->bitrate,
- "packets-lost", G_TYPE_INT, (gint) rtp_stats_get_packets_lost (&src->stats),
- "jitter", G_TYPE_UINT, (guint) (src->stats.jitter >> 4), NULL);
+ "packets-lost", G_TYPE_INT,
+ (gint) rtp_stats_get_packets_lost (&src->stats), "jitter", G_TYPE_UINT,
+ (guint) (src->stats.jitter >> 4), NULL);
if (is_sender) {
gboolean have_sr;
GST_DEBUG ("base_seq %d", seq);
}
+#define BITRATE_INTERVAL (2 * GST_SECOND)
+
static void
do_bitrate_estimation (RTPSource * src, GstClockTime running_time,
guint64 * bytes_handled)
if (src->prev_rtime) {
elapsed = running_time - src->prev_rtime;
- if (elapsed > (G_GINT64_CONSTANT (1) << 31)) {
- const guint64 bits_per_byte = G_GUINT64_CONSTANT (8);
+ if (elapsed > BITRATE_INTERVAL) {
guint64 rate;
- rate = gst_util_uint64_scale (*bytes_handled,
- bits_per_byte * GST_SECOND, elapsed);
+ rate = gst_util_uint64_scale (*bytes_handled, 8 * GST_SECOND, elapsed);
GST_LOG ("Elapsed %" G_GUINT64_FORMAT ", bytes %" G_GUINT64_FORMAT
", rate %" G_GUINT64_FORMAT, elapsed, *bytes_handled, rate);