Fixed bugs and improved overflow handling in AudioRingBuffer; Added audio stream stats packets; Added seq numbers and tracking to audio packets;

Issue 1: AudioRingBuffer read and write pointers did not differentiate between a full buffer and an empty buffer (in either cases, those pointers are the same).

Fix: An extra bool member _isFull was added to AudioRingBuffer to differentiate between the empty and full cases.

Testing: unit test for AudioRingBuffer tests samplesAvailable() return values for full and empty arrays.


Issue 2: AudioRingBuffer writeData() would reset the buffer (empty it) if the new data would overflow it.

Fix: Instead, the new data would overwrite some old data and the ring buffer would become full.

Testing: unit test for AudioRingBuffer calls writeData() to overflow buffer and data is read back to confirm that old data was overwritten correctly


Issue 3: AudioRingBuffer addSilentFrame() did not check if the requested number of silent samples would overflow the buffer. As a result, the write-pointer was advanced no matter what, which means it would sometimes "lap" the read-pointer, effectively erasing a bunch of data in the buffer.

Fix: A check was added so that if an overflow would occur, the number of silent samples is reduced just enough so that the buffer fills up to capacity without overflow occurring.

Testing: unit test for AudioRingBuffer calls addSilentFrame() to overflow buffer and data is read back to confirm a smaller number of silent samples were added than specified to fill the buffer.


Issue 4: AudioMixer's audio stream stats cannot be seen by the client.

Fix: Added PacketTypeAudioStreamStats, which contains mixer jiffer buffer stats and early/late/lost sequence numbers stats. Code was added in AudioMixer to send these out to every node once per second. On the Application side, these stats have been added to the stats display (in expanded mode).

Testing: debug prints were added in the AudioMixer side and Application side to ensure correct data was being sent, received, and displayed.


Issue 5: audio packets do not contain a sequence number, so packet loss cannot be tracked.

Fix: quint16 sequence numbers were added to all audio packet types immediately after the header.  SequenceNumberStats class was created (as well as a unit test) to track these numbers and collect stats similar to how OctreeSceneStats did it.  The previous seq tracking code in OctreeSceneStats and OctreeInboundPacketProcessor have been replaced with instances of SequenceNumberStats.  Instances of SequenceNumberStats have also been added to whereever audio packets are received, which includes Audio.cpp, AudioMixerClientData.cpp, and Agent.cpp.

Testing: debug prints were added to follow the sending/receiving of audio packets on client and server sides.
Why did you remove this?