decoder/mad: check InputStream::KnownSize()

This commit is contained in:
Max Kellermann 2014-08-19 20:32:48 +02:00
parent 4da3291157
commit 51cda0be2a

View File

@ -769,9 +769,9 @@ MadDecoder::RestIncludingThisFrame() const
inline void
MadDecoder::FileSizeToSongLength()
{
InputStream::offset_type rest = RestIncludingThisFrame();
if (input_stream.KnownSize()) {
InputStream::offset_type rest = RestIncludingThisFrame();
if (rest > 0) {
float frame_duration = mp3_frame_duration(&frame);
total_time = (rest * 8.0) / frame.header.bitrate;