diff options
author | Max Kellermann <max@duempel.org> | 2014-08-19 20:28:50 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-19 20:44:29 +0200 |
commit | 7a929fcd2738c27455286b170f7ef058622ef39d (patch) | |
tree | bb05e094b04d0cc116d0cb652f7736d4e275fbe9 /src | |
parent | 7087fdf6c0d2beb021bb2de59cb5ddfd28cc425e (diff) | |
download | mpd-7a929fcd2738c27455286b170f7ef058622ef39d.tar.gz mpd-7a929fcd2738c27455286b170f7ef058622ef39d.tar.xz mpd-7a929fcd2738c27455286b170f7ef058622ef39d.zip |
decoder/faad: call GetSize() only when needed
Diffstat (limited to 'src')
-rw-r--r-- | src/decoder/plugins/FaadDecoderPlugin.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/decoder/plugins/FaadDecoderPlugin.cxx b/src/decoder/plugins/FaadDecoderPlugin.cxx index 6a415bb53..af63553eb 100644 --- a/src/decoder/plugins/FaadDecoderPlugin.cxx +++ b/src/decoder/plugins/FaadDecoderPlugin.cxx @@ -166,9 +166,6 @@ adts_song_duration(DecoderBuffer *buffer) static float faad_song_duration(DecoderBuffer *buffer, InputStream &is) { - const auto size = is.GetSize(); - const size_t fileread = size >= 0 ? size : 0; - auto data = ConstBuffer<uint8_t>::FromVoid(decoder_buffer_need(buffer, 5)); if (data.IsNull()) return -1; @@ -217,6 +214,8 @@ faad_song_duration(DecoderBuffer *buffer, InputStream &is) (data.data[6 + skip_size] << 3) | (data.data[7 + skip_size] & 0xE0); + const auto size = is.GetSize(); + const size_t fileread = size >= 0 ? size : 0; if (fileread != 0 && bit_rate != 0) return fileread * 8.0 / bit_rate; else |