diff --git a/NEWS b/NEWS index f39025288..75ce69e6d 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.23.17 (not yet released) +* protocol + - "albumart" tries to send larger chunks if available * storage - nfs: require libnfs 4.0 or later * database diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx index e28cc2eb5..fbf2ee70a 100644 --- a/src/command/FileCommands.cxx +++ b/src/command/FileCommands.cxx @@ -215,7 +215,20 @@ read_stream_art(Response &r, const std::string_view art_directory, if (buffer_size > 0) { std::unique_lock lock(is->mutex); is->Seek(lock, offset); + + const bool was_ready = is->IsReady(); + read_size = is->Read(lock, buffer.get(), buffer_size); + + if (was_ready && read_size < buffer_size / 2) + /* the InputStream was ready before, but we + got only very little data; probably just + some data left in the buffer without doing + any I/O; let's wait for the next low-level + read to complete to get more data for the + client */ + read_size += is->Read(lock, buffer.get() + read_size, + buffer_size - read_size); } r.Fmt("size: {}\n", art_file_size);