From 51cda0be2a82a4557b7c5944f268edc28745fae8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 19 Aug 2014 20:32:48 +0200 Subject: decoder/mad: check InputStream::KnownSize() --- src/decoder/plugins/MadDecoderPlugin.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/decoder/plugins') diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx index 886aa1795..e38fe3f29 100644 --- a/src/decoder/plugins/MadDecoderPlugin.cxx +++ b/src/decoder/plugins/MadDecoderPlugin.cxx @@ -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; -- cgit v1.2.3