avoid freezes reading incomplete mp3 files

This commit is contained in:
Nick Shaforostov 2018-03-02 16:39:30 +01:00 committed by Nick Shaforostoff
parent 91b00b17b2
commit 7db76720bb

View File

@ -109,7 +109,7 @@ bool MPEG::File::isSupported(IOStream *stream)
const ByteVector buffer = Utils::readHeader(stream, bufferSize(), true, &headerOffset);
if(buffer.isEmpty())
return false;
return false;
const long originalPosition = stream->tell();
AdapterFile file(stream);
@ -476,6 +476,9 @@ long MPEG::File::lastFrameOffset()
else
position = length();
if (position > length()) //if the file is incomplete
position = length();
return previousFrameOffset(position);
}