highfidelity/hifi — pull request #3245 by wangyix (2014-08-01 23:59:37+00:00)
Title: Improved SequenceNumberStats

Issue 1: SequenceNumberStats would not recover if the incoming sequence numbers got out of sync. Most likely, it would mark all those seq nums as "Unreasonable", which in the case of audio packets would cause them to be ignored.

Fix: A child instance of SequenceNumberStats was added to SequenceNumberStats for the purpose of tracking unreasonable seq nums. If it detected a reasonable stream, its state would replace that of the parent.

Test: Added code to randomly reset upstream audio sequence numbers. Audio continued to be mixed after SequenceNumberStats got back in sync.

Issue 2: SequenceNumberStats::PacketStreamStats calculated loss rate incorrectly: it gave a value that's too high and sometimes could go over 100%.

Fix: Skipped sequence numbers are now counted towards numReceived.

Test: Added code to drop N% of upstream audio packets and verified that we had N% loss in the upstream audio stats.