Lines Matching refs:stats
137 rtp_stats_init_defaults (RTPSessionStats * stats) in rtp_stats_init_defaults() argument
139 rtp_stats_set_bandwidths (stats, -1, -1, -1, -1); in rtp_stats_init_defaults()
140 stats->min_interval = RTP_STATS_MIN_INTERVAL; in rtp_stats_init_defaults()
141 stats->bye_timeout = RTP_STATS_BYE_TIMEOUT; in rtp_stats_init_defaults()
142 stats->nacks_dropped = 0; in rtp_stats_init_defaults()
143 stats->nacks_sent = 0; in rtp_stats_init_defaults()
144 stats->nacks_received = 0; in rtp_stats_init_defaults()
160 rtp_stats_set_bandwidths (RTPSessionStats * stats, guint rtp_bw, in rtp_stats_set_bandwidths() argument
190 stats->bandwidth = rtp_bw; in rtp_stats_set_bandwidths()
191 stats->rtcp_bandwidth = rtcp_bw; in rtp_stats_set_bandwidths()
198 rs = stats->rtcp_bandwidth * RTP_STATS_SENDER_FRACTION; in rtp_stats_set_bandwidths()
199 rr = stats->rtcp_bandwidth * RTP_STATS_RECEIVER_FRACTION; in rtp_stats_set_bandwidths()
202 if (stats->rtcp_bandwidth > rr) in rtp_stats_set_bandwidths()
203 rs = stats->rtcp_bandwidth - rr; in rtp_stats_set_bandwidths()
209 if (stats->rtcp_bandwidth > rs) in rtp_stats_set_bandwidths()
210 rr = stats->rtcp_bandwidth - rs; in rtp_stats_set_bandwidths()
215 if (stats->rtcp_bandwidth > 0) { in rtp_stats_set_bandwidths()
216 stats->sender_fraction = ((gdouble) rs) / ((gdouble) stats->rtcp_bandwidth); in rtp_stats_set_bandwidths()
217 stats->receiver_fraction = 1.0 - stats->sender_fraction; in rtp_stats_set_bandwidths()
220 stats->sender_fraction = 0.0; in rtp_stats_set_bandwidths()
221 stats->receiver_fraction = 0.0; in rtp_stats_set_bandwidths()
223 GST_DEBUG ("bandwidths: RTP %u, RTCP %u, RS %f, RR %f", stats->bandwidth, in rtp_stats_set_bandwidths()
224 stats->rtcp_bandwidth, stats->sender_fraction, stats->receiver_fraction); in rtp_stats_set_bandwidths()
241 rtp_stats_calculate_rtcp_interval (RTPSessionStats * stats, gboolean we_send, in rtp_stats_calculate_rtcp_interval() argument
263 rtcp_min_time = stats->min_interval; in rtp_stats_calculate_rtcp_interval()
272 n = members = stats->active_sources; in rtp_stats_calculate_rtcp_interval()
273 senders = (gdouble) stats->sender_sources; in rtp_stats_calculate_rtcp_interval()
274 rtcp_bw = stats->rtcp_bandwidth; in rtp_stats_calculate_rtcp_interval()
276 if (senders <= members * stats->sender_fraction) { in rtp_stats_calculate_rtcp_interval()
278 rtcp_bw *= stats->sender_fraction; in rtp_stats_calculate_rtcp_interval()
281 rtcp_bw *= stats->receiver_fraction; in rtp_stats_calculate_rtcp_interval()
291 avg_rtcp_size = 8.0 * stats->avg_rtcp_packet_size; in rtp_stats_calculate_rtcp_interval()
320 rtp_stats_add_rtcp_jitter (RTPSessionStats * stats, GstClockTime interval) in rtp_stats_add_rtcp_jitter() argument
346 rtp_stats_calculate_bye_interval (RTPSessionStats * stats) in rtp_stats_calculate_bye_interval() argument
354 if (stats->active_sources < 50) in rtp_stats_calculate_bye_interval()
357 rtcp_min_time = (stats->min_interval) / 2.0; in rtp_stats_calculate_bye_interval()
363 members = stats->bye_members; in rtp_stats_calculate_bye_interval()
364 rtcp_bw = stats->rtcp_bandwidth * stats->receiver_fraction; in rtp_stats_calculate_bye_interval()
371 avg_rtcp_size = 8.0 * stats->avg_rtcp_packet_size; in rtp_stats_calculate_bye_interval()
400 rtp_stats_get_packets_lost (const RTPSourceStats * stats) in rtp_stats_get_packets_lost() argument
405 extended_max = stats->cycles + stats->max_seq; in rtp_stats_get_packets_lost()
406 expected = extended_max - stats->base_seq + 1; in rtp_stats_get_packets_lost()
407 lost = expected - stats->packets_received; in rtp_stats_get_packets_lost()
413 rtp_stats_set_min_interval (RTPSessionStats * stats, gdouble min_interval) in rtp_stats_set_min_interval() argument
415 stats->min_interval = min_interval; in rtp_stats_set_min_interval()
499 rtp_twcc_stats_calculate_stats (RTPTWCCStats * stats, GArray * twcc_packets) in rtp_twcc_stats_calculate_stats() argument
511 GST_CLOCK_TIME_IS_VALID (stats->last_local_ts)) { in rtp_twcc_stats_calculate_stats()
512 pkt->local_delta = GST_CLOCK_DIFF (stats->last_local_ts, pkt->local_ts); in rtp_twcc_stats_calculate_stats()
516 GST_CLOCK_TIME_IS_VALID (stats->last_remote_ts)) { in rtp_twcc_stats_calculate_stats()
518 GST_CLOCK_DIFF (stats->last_remote_ts, pkt->remote_ts); in rtp_twcc_stats_calculate_stats()
526 stats->last_local_ts = pkt->local_ts; in rtp_twcc_stats_calculate_stats()
527 stats->last_remote_ts = pkt->remote_ts; in rtp_twcc_stats_calculate_stats()
530 stats->packets_sent = twcc_packets->len; in rtp_twcc_stats_calculate_stats()
531 stats->packets_recv = packets_recv; in rtp_twcc_stats_calculate_stats()
535 _get_window_start_index (RTPTWCCStats * stats, GstClockTime duration, in _get_window_start_index() argument
541 if (stats->packets->len < 2) in _get_window_start_index()
544 for (i = 0; i < stats->packets->len; i++) { in _get_window_start_index()
545 guint start_index = stats->packets->len - 1 - i; in _get_window_start_index()
547 &g_array_index (stats->packets, RTPTWCCPacket, start_index); in _get_window_start_index()
569 rtp_twcc_stats_calculate_windowed_stats (RTPTWCCStats * stats) in rtp_twcc_stats_calculate_windowed_stats() argument
583 start_idx = _get_window_start_index (stats, stats->window_size, in rtp_twcc_stats_calculate_windowed_stats()
591 g_array_remove_range (stats->packets, 0, start_idx); in rtp_twcc_stats_calculate_windowed_stats()
593 packets_sent = stats->packets->len - 1; in rtp_twcc_stats_calculate_windowed_stats()
596 RTPTWCCPacket *pkt = &g_array_index (stats->packets, RTPTWCCPacket, i); in rtp_twcc_stats_calculate_windowed_stats()
614 stats->packet_loss_pct = (packets_lost * 100) / (gfloat) packets_sent; in rtp_twcc_stats_calculate_windowed_stats()
618 if (GST_CLOCK_STIME_IS_VALID (stats->avg_delta_of_delta)) { in rtp_twcc_stats_calculate_windowed_stats()
619 stats->avg_delta_of_delta_change = in rtp_twcc_stats_calculate_windowed_stats()
621 stats->avg_delta_of_delta) / (250 * GST_USECOND); in rtp_twcc_stats_calculate_windowed_stats()
623 stats->avg_delta_of_delta = avg_delta_of_delta; in rtp_twcc_stats_calculate_windowed_stats()
627 stats->bitrate_sent = in rtp_twcc_stats_calculate_windowed_stats()
630 stats->bitrate_recv = in rtp_twcc_stats_calculate_windowed_stats()
636 "delta-delta-change: %f", bits_sent, bits_recv, stats->packets_sent, in rtp_twcc_stats_calculate_windowed_stats()
637 packets_recv, stats->packet_loss_pct, stats->bitrate_sent, in rtp_twcc_stats_calculate_windowed_stats()
638 stats->bitrate_recv, GST_STIME_ARGS (stats->avg_delta_of_delta), in rtp_twcc_stats_calculate_windowed_stats()
639 stats->avg_delta_of_delta_change); in rtp_twcc_stats_calculate_windowed_stats()
645 RTPTWCCStats *stats = g_new0 (RTPTWCCStats, 1); in rtp_twcc_stats_new() local
646 stats->packets = g_array_new (FALSE, FALSE, sizeof (RTPTWCCPacket)); in rtp_twcc_stats_new()
647 stats->last_local_ts = GST_CLOCK_TIME_NONE; in rtp_twcc_stats_new()
648 stats->last_remote_ts = GST_CLOCK_TIME_NONE; in rtp_twcc_stats_new()
649 stats->avg_delta_of_delta = GST_CLOCK_STIME_NONE; in rtp_twcc_stats_new()
650 stats->window_size = 300 * GST_MSECOND; /* FIXME: could be configurable? */ in rtp_twcc_stats_new()
651 return stats; in rtp_twcc_stats_new()
655 rtp_twcc_stats_free (RTPTWCCStats * stats) in rtp_twcc_stats_free() argument
657 g_array_unref (stats->packets); in rtp_twcc_stats_free()
658 g_free (stats); in rtp_twcc_stats_free()
662 rtp_twcc_stats_get_stats_structure (RTPTWCCStats * stats) in rtp_twcc_stats_get_stats_structure() argument
665 "bitrate-sent", G_TYPE_UINT, stats->bitrate_sent, in rtp_twcc_stats_get_stats_structure()
666 "bitrate-recv", G_TYPE_UINT, stats->bitrate_recv, in rtp_twcc_stats_get_stats_structure()
667 "packets-sent", G_TYPE_UINT, stats->packets_sent, in rtp_twcc_stats_get_stats_structure()
668 "packets-recv", G_TYPE_UINT, stats->packets_recv, in rtp_twcc_stats_get_stats_structure()
669 "packet-loss-pct", G_TYPE_DOUBLE, stats->packet_loss_pct, in rtp_twcc_stats_get_stats_structure()
670 "avg-delta-of-delta", G_TYPE_INT64, stats->avg_delta_of_delta, NULL); in rtp_twcc_stats_get_stats_structure()
674 rtp_twcc_stats_process_packets (RTPTWCCStats * stats, GArray * twcc_packets) in rtp_twcc_stats_process_packets() argument
676 rtp_twcc_stats_calculate_stats (stats, twcc_packets); in rtp_twcc_stats_process_packets()
677 g_array_append_vals (stats->packets, twcc_packets->data, twcc_packets->len); in rtp_twcc_stats_process_packets()
678 rtp_twcc_stats_calculate_windowed_stats (stats); in rtp_twcc_stats_process_packets()
679 return rtp_twcc_stats_get_stats_structure (stats); in rtp_twcc_stats_process_packets()