input/mms: limit the mmsx_read() size

This commit is contained in:
Max Kellermann 2014-12-23 20:34:45 +01:00
parent b9c7771830
commit 43da4c0eca
2 changed files with 9 additions and 0 deletions

2
NEWS
View File

@ -1,4 +1,6 @@
ver 0.19.8 (not yet released)
* input
- mms: reduce delay at the beginning of playback
* decoder
- dsdiff, dsf: allow ID3 tags larger than 4 kB

View File

@ -92,6 +92,13 @@ input_mms_open(const char *url,
size_t
MmsInputStream::ThreadRead(void *ptr, size_t read_size, Error &error)
{
/* unfortunately, mmsx_read() blocks until the whole buffer
has been filled; to avoid big latencies, limit the size of
each chunk we read to a reasonable size */
constexpr size_t MAX_CHUNK = 16384;
if (read_size > MAX_CHUNK)
read_size = MAX_CHUNK;
int nbytes = mmsx_read(nullptr, mms, (char *)ptr, read_size);
if (nbytes <= 0) {
if (nbytes < 0)