aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-23 20:43:15 +0100
committerMax Kellermann <max@duempel.org>2014-12-23 20:43:15 +0100
commitea96919b800af8b4d87e73d775b71fa126dc7fd9 (patch)
treec2cf1e14da49ebbfbde47d0ec4f5ea61f12bf312 /src/input/plugins
parent5835afb849f929661d9a5c1f746f4765d567b8ad (diff)
parent43da4c0ecaf23ebb7b282bdfe3b5c6bfc3ab6c41 (diff)
downloadmpd-ea96919b800af8b4d87e73d775b71fa126dc7fd9.tar.gz
mpd-ea96919b800af8b4d87e73d775b71fa126dc7fd9.tar.xz
mpd-ea96919b800af8b4d87e73d775b71fa126dc7fd9.zip
Merge branch 'v0.19.x'
Diffstat (limited to 'src/input/plugins')
-rw-r--r--src/input/plugins/MmsInputPlugin.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/input/plugins/MmsInputPlugin.cxx b/src/input/plugins/MmsInputPlugin.cxx
index 1aed9c662..df291bc84 100644
--- a/src/input/plugins/MmsInputPlugin.cxx
+++ b/src/input/plugins/MmsInputPlugin.cxx
@@ -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)