diff --git a/src/input/ThreadInputStream.cxx b/src/input/ThreadInputStream.cxx
index 1de8863a7..5491cb4ed 100644
--- a/src/input/ThreadInputStream.cxx
+++ b/src/input/ThreadInputStream.cxx
@@ -76,7 +76,7 @@ ThreadInputStream::ThreadFunc() noexcept
 
 			try {
 				const ScopeUnlock unlock(mutex);
-				nbytes = ThreadRead(w.data(), w.size());
+				nbytes = ThreadRead(w);
 			} catch (...) {
 				postponed_exception = std::current_exception();
 				InvokeOnAvailable();
diff --git a/src/input/ThreadInputStream.hxx b/src/input/ThreadInputStream.hxx
index b980e636b..1a9898f69 100644
--- a/src/input/ThreadInputStream.hxx
+++ b/src/input/ThreadInputStream.hxx
@@ -116,7 +116,7 @@ protected:
 	 *
 	 * @return 0 on end-of-file
 	 */
-	virtual size_t ThreadRead(void *ptr, size_t size) = 0;
+	virtual std::size_t ThreadRead(std::span<std::byte> dest) = 0;
 
 	/**
 	 * Optional deinitialization before leaving the thread.
diff --git a/src/input/plugins/MmsInputPlugin.cxx b/src/input/plugins/MmsInputPlugin.cxx
index 727820e5c..c71a6f89c 100644
--- a/src/input/plugins/MmsInputPlugin.cxx
+++ b/src/input/plugins/MmsInputPlugin.cxx
@@ -30,7 +30,7 @@ public:
 
 protected:
 	void Open() override;
-	size_t ThreadRead(void *ptr, size_t size) override;
+	std::size_t ThreadRead(std::span<std::byte> dest) override;
 
 	void Close() noexcept override {
 		mmsx_close(mms);
@@ -62,17 +62,17 @@ input_mms_open(const char *url,
 	return m;
 }
 
-size_t
-MmsInputStream::ThreadRead(void *ptr, size_t read_size)
+std::size_t
+MmsInputStream::ThreadRead(std::span<std::byte> dest)
 {
 	/* 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;
+	if (dest.size() > MAX_CHUNK)
+		dest = dest.first(MAX_CHUNK);
 
-	int nbytes = mmsx_read(nullptr, mms, (char *)ptr, read_size);
+	int nbytes = mmsx_read(nullptr, mms, reinterpret_cast<char *>(dest.data()), dest.size());
 	if (nbytes <= 0) {
 		if (nbytes < 0)
 			throw MakeErrno("mmsx_read() failed");