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).
This commit is contained in:
Max Kellermann 2018-06-14 17:31:08 +02:00
parent 6681b14b71
commit 1ca1269a59
2 changed files with 3 additions and 1 deletions

1
NEWS
View File

@ -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

View File

@ -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<IcyInputStream>(std::move(c), std::move(icy));
return std::make_unique<MaybeBufferedInputStream>(std::make_unique<IcyInputStream>(std::move(c), std::move(icy)));
}
InputStreamPtr