Allow partial reads

Traditionally we've always had RingBuffer::Read() return the number of bytes requested unless we are at the end of the file. But this blocks libav which expects the read to complete fairly quickly even if it is a blocking read. Instead we should block for only a short time waiting for more data and then return what data we do have as long as we have at least 1 byte of data.

Based on a patch by DanielK
Fixes #12179
Ref #10658