decoder/audiofile: check InputStream::KnownSize()

The plugin assumes that the size is known, but does not verify it at
runtime.
This commit is contained in:
Max Kellermann 2014-08-19 11:57:55 +02:00
parent e6e9c21275
commit b924568f79

View File

@ -184,7 +184,7 @@ audiofile_setup_sample_format(AFfilehandle af_fp)
static void static void
audiofile_stream_decode(Decoder &decoder, InputStream &is) audiofile_stream_decode(Decoder &decoder, InputStream &is)
{ {
if (!is.IsSeekable()) { if (!is.IsSeekable() || !is.KnownSize()) {
LogWarning(audiofile_domain, "not seekable"); LogWarning(audiofile_domain, "not seekable");
return; return;
} }
@ -250,7 +250,7 @@ gcc_pure
static int static int
audiofile_get_duration(InputStream &is) audiofile_get_duration(InputStream &is)
{ {
if (!is.IsSeekable()) if (!is.IsSeekable() || !is.KnownSize())
return -1; return -1;
AudioFileInputStream afis{nullptr, is}; AudioFileInputStream afis{nullptr, is};