MT#55283 don't clobber jitter estimator in metrics collection

ssrc_collect_metrics() converted the running RFC 3550 jitter estimate
to milliseconds in place on every call timer run with --measure-rtp,
dividing it by clock_rate/1000 each time. The estimator is kept in
RTP timestamp units and also feeds generated RTCP RRs, which therefore
reported a jitter decaying towards zero. Convert a copy instead.

The RTCP test expected the resulting zero jitter; it now gets the
value actually measured from its back-to-back packets.

Change-Id: Ice29029322764fd76374eb3f7dda517570f7f75b
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 4dd1826ffa)
mr13.5
darwvin-dev 1 month ago committed by Richard Fuchs
parent 7515f94802
commit ccba94a1ca

@ -710,20 +710,22 @@ void ssrc_collect_metrics(struct call_media *media) {
if (!s)
break; // end of list
// work on a copy, as the estimator itself must stay in RTP timestamp units
uint32_t jitter = s->jitter;
// exclude zero values - technically possible but unlikely and probably just unset
if (!s->jitter)
if (!jitter)
continue;
if (s->tracker.most_len > 0 && s->tracker.most[0] != 255) {
const rtp_payload_type *rpt = get_rtp_payload_type(s->tracker.most[0],
&media->codecs);
if (rpt && rpt->clock_rate)
s->jitter = s->jitter * 1000 / rpt->clock_rate;
jitter = jitter * 1000 / rpt->clock_rate;
}
if (media->streams.head) {
LOCK(&media->streams.head->data->lock);
RTPE_SAMPLE_SFD(jitter_measured, s->jitter, media->streams.head->data->selected_sfd);
RTPE_SAMPLE_SFD(jitter_measured, jitter, media->streams.head->data->selected_sfd);
}
}
}

@ -85,17 +85,18 @@ rcv($sock_a, $port_b, rtpm(0, 4001, 8000+160*1, 0x6789, "\x00" x 160));
snd($sock_b, $port_a, rtp(0, 4002, 8000+160*2, 0x6789, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(0, 4002, 8000+160*2, 0x6789, "\x00" x 160));
# wait for RTCP
# wait for RTCP. Jitter is measured from the back-to-back packets above, which
# carry 20 ms of timestamp spacing each.
sleep(6);
rcv($sock_ax, $port_bx, qr/^\x81\xc8\x00\x0c\x00\x00\x67\x89.{8}\x00\x00\x20\x80\x00\x00\x00\x03\x00\x00\x02\x04\x00\x00\x12\x34\x00\x00\x00\x00\x00\x00\x03\xea\x00\x00\x00\x00.{4}.{4}\x81\xca\x00\x05\x00\x00\x67\x89\x01/s);
rcv($sock_bx, $port_ax, qr/^\x81\xc8\x00\x0c\x00\x00\x12\x34.{8}\x00\x00\x0c\xf8\x00\x00\x00\x03\x00\x00\x02\x04\x00\x00\x67\x89\x00\x00\x00\x00\x00\x00\x0f\xa2\x00\x00\x00\x00.{4}.{4}\x81\xca\x00\x05\x00\x00\x12\x34\x01/s);
rcv($sock_ax, $port_bx, qr/^\x81\xc8\x00\x0c\x00\x00\x67\x89.{8}\x00\x00\x20\x80\x00\x00\x00\x03\x00\x00\x02\x04\x00\x00\x12\x34\x00\x00\x00\x00\x00\x00\x03\xea\x00\x00\x00[\x01-\x7f].{4}.{4}\x81\xca\x00\x05\x00\x00\x67\x89\x01/s);
rcv($sock_bx, $port_ax, qr/^\x81\xc8\x00\x0c\x00\x00\x12\x34.{8}\x00\x00\x0c\xf8\x00\x00\x00\x03\x00\x00\x02\x04\x00\x00\x67\x89\x00\x00\x00\x00\x00\x00\x0f\xa2\x00\x00\x00[\x01-\x7f].{4}.{4}\x81\xca\x00\x05\x00\x00\x12\x34\x01/s);
# wait for RTCP again
sleep(6);
rcv($sock_ax, $port_bx, qr/^\x81\xc8\x00\x0c\x00\x00\x67\x89.{8}\x00\x00\x20\x80\x00\x00\x00\x03\x00\x00\x02\x04\x00\x00\x12\x34\x00\x00\x00\x00\x00\x00\x03\xea\x00\x00\x00\x00.{4}.{4}\x81\xca\x00\x05\x00\x00\x67\x89\x01/s);
rcv($sock_bx, $port_ax, qr/^\x81\xc8\x00\x0c\x00\x00\x12\x34.{8}\x00\x00\x0c\xf8\x00\x00\x00\x03\x00\x00\x02\x04\x00\x00\x67\x89\x00\x00\x00\x00\x00\x00\x0f\xa2\x00\x00\x00\x00.{4}.{4}\x81\xca\x00\x05\x00\x00\x12\x34\x01/s);
rcv($sock_ax, $port_bx, qr/^\x81\xc8\x00\x0c\x00\x00\x67\x89.{8}\x00\x00\x20\x80\x00\x00\x00\x03\x00\x00\x02\x04\x00\x00\x12\x34\x00\x00\x00\x00\x00\x00\x03\xea\x00\x00\x00[\x01-\x7f].{4}.{4}\x81\xca\x00\x05\x00\x00\x67\x89\x01/s);
rcv($sock_bx, $port_ax, qr/^\x81\xc8\x00\x0c\x00\x00\x12\x34.{8}\x00\x00\x0c\xf8\x00\x00\x00\x03\x00\x00\x02\x04\x00\x00\x67\x89\x00\x00\x00\x00\x00\x00\x0f\xa2\x00\x00\x00[\x01-\x7f].{4}.{4}\x81\xca\x00\x05\x00\x00\x12\x34\x01/s);
$resp = rtpe_req('delete', 'delete');
is($resp->{SSRC}{4660}{packets}, 3, 'packet count');

Loading…
Cancel
Save