TT#78307 keep track of RTP stats also when forwarding

Change-Id: Iea6214104b7032687608af71f6270a375fed2702
changes/61/39061/8
Richard Fuchs 6 years ago
parent 34baba9d22
commit 92bcedc08a

@ -638,12 +638,16 @@ static void call_timer(void *ptr) {
}
mutex_lock(&ps->in_lock);
if (sfd->crypto.params.crypto_suite && ps->ssrc_in
&& ntohl(ke->target.ssrc) == ps->ssrc_in->parent->h.ssrc
&& ke->target.decrypt.last_index - ps->ssrc_in->srtp_index > 0x4000)
{
if (ps->ssrc_in && ntohl(ke->target.ssrc) == ps->ssrc_in->parent->h.ssrc) {
atomic64_add(&ps->ssrc_in->octets, diff_bytes);
atomic64_add(&ps->ssrc_in->packets, diff_packets);
ps->ssrc_in->srtp_index = ke->target.decrypt.last_index;
update = 1;
if (sfd->crypto.params.crypto_suite
&& ke->target.decrypt.last_index
- ps->ssrc_in->srtp_index > 0x4000)
update = 1;
}
mutex_unlock(&ps->in_lock);
}

@ -1848,9 +1848,22 @@ static int stream_packet(struct packet_handler_ctx *phc) {
media_packet_rtp(phc);
// SSRC receive stats
if (phc->mp.ssrc_in) {
if (phc->mp.ssrc_in && phc->mp.rtp) {
atomic64_inc(&phc->mp.ssrc_in->packets);
atomic64_add(&phc->mp.ssrc_in->packets, phc->mp.raw.len);
// no real sequencing, so this is rudimentary
uint64_t old_seq = atomic64_get(&phc->mp.ssrc_in->last_seq);
uint64_t new_seq = ntohs(phc->mp.rtp->seq_num) | (old_seq & 0xffff0000UL);
// XXX combine this with similar code elsewhere
long seq_diff = new_seq - old_seq;
while (seq_diff < -60000) {
new_seq += 0x10000;
seq_diff += 0x10000;
}
if (seq_diff > 0 || seq_diff < -10) {
atomic64_set(&phc->mp.ssrc_in->last_seq, new_seq);
atomic64_set(&phc->mp.ssrc_in->last_ts, ntohl(phc->mp.rtp->timestamp));
}
}

Loading…
Cancel
Save