mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
rtpsource: Track the seqnum for senders
RTP source statistics are tracked for local senders by treating them as a receiver of their own outbound packets. Accordingly, track the highest packet seqnum so that the packets-lost calculation generates a sensible number instead of always reporting -$number_of_packets_sent Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3454>
This commit is contained in:
parent
843f10f7f9
commit
cb225b3682
1 changed files with 22 additions and 0 deletions
|
@ -1251,6 +1251,28 @@ update_receiver_stats (RTPSource * src, RTPPacketInfo * pinfo,
|
|||
GST_INFO ("duplicate or reordered packet (seqnr %u, expected %u)",
|
||||
seqnr, expected);
|
||||
}
|
||||
} else {
|
||||
/* Sender stats - update the outbound sequence number */
|
||||
expected = src->stats.max_seq + 1;
|
||||
delta = gst_rtp_buffer_compare_seqnum (expected, seqnr);
|
||||
/* No probation for local senders, just check for lost / dropouts */
|
||||
if (delta >= 0 && delta < max_dropout) {
|
||||
stats->bad_seq = RTP_SEQ_MOD + 1; /* so seq == bad_seq is false */
|
||||
/* in order, with permissible gap */
|
||||
if (seqnr < stats->max_seq) {
|
||||
/* sequence number wrapped - count another 64K cycle. */
|
||||
stats->cycles += RTP_SEQ_MOD;
|
||||
}
|
||||
stats->max_seq = seqnr;
|
||||
} else if (delta < -max_misorder || delta >= max_dropout) {
|
||||
/* the sequence number made a very large jump */
|
||||
if (seqnr != stats->bad_seq) {
|
||||
/* unacceptable jump */
|
||||
stats->bad_seq = (seqnr + 1) & (RTP_SEQ_MOD - 1);
|
||||
}
|
||||
} else { /* delta < 0 && delta >= -max_misorder */
|
||||
stats->bad_seq = RTP_SEQ_MOD + 1; /* so seq == bad_seq is false */
|
||||
}
|
||||
}
|
||||
|
||||
src->stats.octets_received += pinfo->payload_len;
|
||||
|
|
Loading…
Reference in a new issue