diff options
author | ace20022 <ace20022@ymail.com> | 2014-03-07 21:20:25 +0100 |
---|---|---|
committer | ace20022 <ace20022@ymail.com> | 2014-03-07 21:24:49 +0100 |
commit | 260a93f55c71ef705170b12a8ef62a6e6ef4b8c8 (patch) | |
tree | efb53964e57a39944fa899a0a63efd92db2e96fd | |
parent | 1cba4792eb65ca760f9a50bdc21ab7893898d41d (diff) |
[paplayer] Prevent possible division by zero in MP3Codec.
-rw-r--r-- | xbmc/cores/paplayer/MP3codec.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/xbmc/cores/paplayer/MP3codec.cpp b/xbmc/cores/paplayer/MP3codec.cpp index 7db7a15e6c..a6f663a4cd 100644 --- a/xbmc/cores/paplayer/MP3codec.cpp +++ b/xbmc/cores/paplayer/MP3codec.cpp @@ -886,13 +886,14 @@ int MP3Codec::ReadDuration() double tpfbs[] = { 0, 384.0f, 1152.0f, 1152.0f }; frequency = freqtab[version][freqindex]; - tpf = tpfbs[layer] / (double) frequency; - if (version == MPEG_VERSION2_5 || version == MPEG_VERSION2) - tpf /= 2; if (frequency == 0) return 0; + tpf = tpfbs[layer] / (double) frequency; + if (version == MPEG_VERSION2_5 || version == MPEG_VERSION2) + tpf /= 2; + /* Channel mode (stereo/mono) */ int chmode = (mpegheader & 0xc0) >> 6; /* calculate position of Xing VBR header */ |