mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 04:22:27 +00:00
rtpsource: fix receiver source stats to consider previously queued packets
When it is not clear yet if a packet relative to a source should be pushed, the packet is put into a queue, this happens in two cases: - the source is still in probation; - there is a large jump in seqnum, and it is not clear what the cause is, future packets will help making a guess. In either case stats about received packets are not updated at all; and even if they were, when init_seq() is called it resets all receiver stats, effectively loosing any possible stat about previously received packets. Fix this by taking into account the queued packets and update the stats when calling init_seq().
This commit is contained in:
parent
cf0ffd8693
commit
ae48646d8e
1 changed files with 25 additions and 0 deletions
|
@ -1017,6 +1017,28 @@ no_clock_rate:
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_queued_stats (GstBuffer * buffer, RTPSource * src)
|
||||
{
|
||||
GstRTPBuffer rtp = { NULL };
|
||||
guint payload_len;
|
||||
guint64 bytes;
|
||||
|
||||
/* no need to check the return value, a queued packet is a valid RTP one */
|
||||
gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp);
|
||||
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
|
||||
|
||||
bytes = gst_buffer_get_size (buffer) + UDP_IP_HEADER_OVERHEAD;
|
||||
|
||||
src->stats.octets_received += payload_len;
|
||||
src->stats.bytes_received += bytes;
|
||||
src->stats.packets_received++;
|
||||
/* for the bitrate estimation consider all lower level headers */
|
||||
src->bytes_received += bytes;
|
||||
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
}
|
||||
|
||||
static void
|
||||
init_seq (RTPSource * src, guint16 seq)
|
||||
{
|
||||
|
@ -1032,6 +1054,9 @@ init_seq (RTPSource * src, guint16 seq)
|
|||
src->stats.recv_pli_count = 0;
|
||||
src->stats.recv_fir_count = 0;
|
||||
|
||||
/* if there are queued packets, consider them too in the stats */
|
||||
g_queue_foreach (src->packets, (GFunc) update_queued_stats, src);
|
||||
|
||||
GST_DEBUG ("base_seq %d", seq);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue