From bbcd8293ef911c2bfcae0327dc15266b6d6b0bee Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 14 Feb 2015 12:33:52 +0100 Subject: [PATCH] Count reorders somewhat differently. --- reorderer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reorderer.cpp b/reorderer.cpp index 2374ffd..c2823e5 100644 --- a/reorderer.cpp +++ b/reorderer.cpp @@ -66,6 +66,8 @@ void Reorderer::send_packet(uint16_t proto, const string& data, int seq) packet.ts = now; packet_buffer.push(packet); + bool did_reorder = false; + while (!packet_buffer.empty() && (last_seq == -1 || packet_buffer.top().seq <= last_seq + 1)) { int front_seq = packet_buffer.top().seq; @@ -87,13 +89,17 @@ void Reorderer::send_packet(uint16_t proto, const string& data, int seq) last_seq = front_seq; last_sent_packet = now; if (!packet_buffer.empty()) { - ++num_reorders; + did_reorder = true; if (!silence) { printf("Reordering with packet buffer size %d: seq=%d new_front_seq=%d\n", int(packet_buffer.size()), front_seq, packet_buffer.top().seq); silence = true; } } } + + if (did_reorder) { + ++num_reorders; + } } void Reorderer::check_ts_discontinuity(uint16_t proto, const string &data, bool silence) -- 2.39.2