tests: Add tests for Buffer.
buffer: Refacor the basic buffer.

This change improves the read/write perfomance of Buffer
by at least 100x and eliminates a nasty performance hit when
large ringbuffers are used.

This often caused unnecessary cache drops in players since
the reads could become very slow if the buffer had grown a bit.
Change default ringbuffer size to 16MB.

This helps performance on segmented stream types and
VOD's where it's common to be able to access data faster
than needed.

By allowing more data to be stored in the ringbuffer we
will have less cache drops in the player when we encounter
spikes in the download speed.