highfidelity/hifi — pull request #3153 by wangyix (2014-07-10 17:08:44+00:00)
Title: Added more stats to AudioStreamStats; Added template classes RingBufferHistory and MovingMinMaxAvg

Issue 1: AudioStreamStats didn't have enough stats about upstream audio.

Fix: More stats are now tracked in PositionalAudioRingBuffer, and AudioStreamStats now contains more stats. The interface has been updated to show many of the new stats in the stats overaly (expanded mode).

Test: Ran local audiomixer and stats showed up in interface.

Issue 2: A ring buffer container for storing a history of objects did not exist, but would be useful for SentPacketHistory, MovingMinMaxAvg, and for storing past stats packets received for calculating packet loss over the last 30s or something like that.

Fix: A template class RingBufferHistory was added. It stores the last N objects inserted, where each object can be quickly retrieved by their age (0 being most recently inserted, 1 is the one inserted before that, so on).

Test: RingBufferHistory was not specifically tested, but MovingMinMaxAvg (which implements RingBufferHistory) passes its unit test.