From 1ca1269a59e36fc4c91fa9aca93ac6067d9274bf Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 14 Jun 2018 17:31:08 +0200 Subject: [PATCH] input/curl: use class MaybeBufferedInputStream For remote files (not streams), this downloads as quickly as possible to a large buffer instead of throttling the stream during playback. Throttling can make the server impatient and it may then disconnect. This is what Qobuz and Tidal do, and this commit attempts to solve this by not letting the Qobuz/Tidal server wait (closes #241). --- NEWS | 1 + src/input/plugins/CurlInputPlugin.cxx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 67b94eaea..c544808f1 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ ver 0.21 (not yet released) * player - "one-shot" single mode * input + - curl: download to buffer instead of throttling transfer - qobuz: new plugin to play Qobuz streams - tidal: new plugin to play Tidal streams * tags diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx index 1cca33aa6..f808a5c21 100644 --- a/src/input/plugins/CurlInputPlugin.cxx +++ b/src/input/plugins/CurlInputPlugin.cxx @@ -25,6 +25,7 @@ #include "lib/curl/Request.hxx" #include "lib/curl/Handler.hxx" #include "lib/curl/Slist.hxx" +#include "../MaybeBufferedInputStream.hxx" #include "../AsyncInputStream.hxx" #include "../IcyInputStream.hxx" #include "IcyMetaDataParser.hxx" @@ -458,7 +459,7 @@ CurlInputStream::Open(const char *url, c->StartRequest(); }); - return std::make_unique(std::move(c), std::move(icy)); + return std::make_unique(std::make_unique(std::move(c), std::move(icy))); } InputStreamPtr