diff options
author | Max Kellermann <max@duempel.org> | 2014-07-11 23:12:08 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-07-11 23:12:08 +0200 |
commit | 6585e18571df900c4ffe862ec02cd7376af7bbbd (patch) | |
tree | 263867be69fc121a7396f9ecb1949ab430d0553a /src/decoder | |
parent | 6f1b4292f0d22067e2d8aa4ee86d5f0522906225 (diff) | |
download | mpd-6585e18571df900c4ffe862ec02cd7376af7bbbd.tar.gz mpd-6585e18571df900c4ffe862ec02cd7376af7bbbd.tar.xz mpd-6585e18571df900c4ffe862ec02cd7376af7bbbd.zip |
decoder/faad: check sample_rate, not frames_per_second
Checking the integer is faster, easier and more reliable.
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/FaadDecoderPlugin.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/decoder/FaadDecoderPlugin.cxx b/src/decoder/FaadDecoderPlugin.cxx index bca4ecd95..7279d7107 100644 --- a/src/decoder/FaadDecoderPlugin.cxx +++ b/src/decoder/FaadDecoderPlugin.cxx @@ -148,10 +148,12 @@ adts_song_duration(DecoderBuffer *buffer) decoder_buffer_consume(buffer, frame_length); } - float frames_per_second = (float)sample_rate / 1024.0; - if (frames_per_second <= 0) + if (sample_rate == 0) return -1; + float frames_per_second = (float)sample_rate / 1024.0; + assert(frames_per_second > 0); + return (float)frames / frames_per_second; } |