avformat/rtpdec: fix RTCP RR cumulative packet loss clamping

Per RFC 3550 Appendix A.3, the cumulative number of packets lost is a
signed 24-bit field. Clamp to signed 24-bit range using av_clip_intp2
and av_zero_extend to handle duplicate packets correctly.
This commit is contained in:
Nariman-Sayed
2026-03-09 04:11:28 +02:00
committed by Marton Balint
parent 053fb462d8
commit 2501954d49
+1 -2
View File
@@ -355,8 +355,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd,
// RFC 1889/p64
extended_max = stats->cycles + stats->max_seq;
expected = extended_max - stats->base_seq;
lost = expected - stats->received;
lost = FFMIN(lost, 0xffffff); // clamp it since it's only 24 bits...
lost = av_zero_extend(av_clip_intp2(expected - stats->received, 23), 24);
expected_interval = expected - stats->expected_prior;
stats->expected_prior = expected;
received_interval = stats->received - stats->received_prior;