Skip to content

Commit

Permalink
Fix inaccurate TX packet loss percentage and stats calculation in sam…
Browse files Browse the repository at this point in the history
…ples (#3791)
  • Loading branch information
trengginas authored Nov 29, 2023
1 parent 04f8121 commit 78b73c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pjsip-apps/src/samples/siprtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1789,9 +1789,9 @@ static void print_avg_stat(void)
min_stat.tx.loss, avg_stat.tx.loss, max_stat.tx.loss,
"packets",

min_stat.tx.loss*100.0/(min_stat.tx.pkt+min_stat.tx.loss),
avg_stat.tx.loss*100.0/(avg_stat.tx.pkt+avg_stat.tx.loss),
max_stat.tx.loss*100.0/(max_stat.tx.pkt+max_stat.tx.loss),
min_stat.tx.loss*100.0/(min_stat.tx.pkt),
avg_stat.tx.loss*100.0/(avg_stat.tx.pkt),
max_stat.tx.loss*100.0/(max_stat.tx.pkt),
"%",

min_stat.tx.dup, avg_stat.tx.dup, max_stat.tx.dup,
Expand Down
6 changes: 3 additions & 3 deletions pjsip-apps/src/samples/siprtp_report.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ static void print_call(int call_index)
good_number(ipbytes, sizeof(ipbytes), audio->rtcp.stat.tx.bytes + audio->rtcp.stat.tx.pkt * 32),
"",
audio->rtcp.stat.tx.loss,
audio->rtcp.stat.tx.loss * 100.0 / (audio->rtcp.stat.tx.pkt + audio->rtcp.stat.tx.loss),
audio->rtcp.stat.tx.loss * 100.0 / (audio->rtcp.stat.tx.pkt),
audio->rtcp.stat.tx.dup,
audio->rtcp.stat.tx.dup * 100.0 / (audio->rtcp.stat.tx.pkt + audio->rtcp.stat.tx.loss),
audio->rtcp.stat.tx.dup * 100.0 / (audio->rtcp.stat.tx.pkt),
audio->rtcp.stat.tx.reorder,
audio->rtcp.stat.tx.reorder * 100.0 / (audio->rtcp.stat.tx.pkt + audio->rtcp.stat.tx.loss),
audio->rtcp.stat.tx.reorder * 100.0 / (audio->rtcp.stat.tx.pkt),
"",
audio->rtcp.stat.tx.loss_period.min / 1000.0,
audio->rtcp.stat.tx.loss_period.mean / 1000.0,
Expand Down
6 changes: 3 additions & 3 deletions pjsip-apps/src/samples/streamutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,11 +1056,11 @@ static void print_stream_stat(pjmedia_stream *stream,
good_number(ipbytes, sizeof(ipbytes), stat.tx.bytes + stat.tx.pkt * 32),
"",
stat.tx.loss,
stat.tx.loss * 100.0 / (stat.tx.pkt + stat.tx.loss),
stat.tx.loss * 100.0 / (stat.tx.pkt),
stat.tx.dup,
stat.tx.dup * 100.0 / (stat.tx.pkt + stat.tx.loss),
stat.tx.dup * 100.0 / (stat.tx.pkt),
stat.tx.reorder,
stat.tx.reorder * 100.0 / (stat.tx.pkt + stat.tx.loss),
stat.tx.reorder * 100.0 / (stat.tx.pkt),
"",
stat.tx.loss_period.min / 1000.0,
stat.tx.loss_period.mean / 1000.0,
Expand Down

0 comments on commit 78b73c9

Please sign in to comment.