1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

Merge commit '44127546b0a81dc9dd6190739a62d48f0044c6f3'

* commit '44127546b0a81dc9dd6190739a62d48f0044c6f3':
  Check if an mp3 header is using a reserved sample rate.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-06-23 03:05:02 +02:00
commit 2bcf34a0ef

View File

@ -24,6 +24,8 @@
* MPEG Audio header decoder. * MPEG Audio header decoder.
*/ */
#include "libavutil/common.h"
#include "avcodec.h" #include "avcodec.h"
#include "mpegaudio.h" #include "mpegaudio.h"
#include "mpegaudiodata.h" #include "mpegaudiodata.h"
@ -45,6 +47,8 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
s->layer = 4 - ((header >> 17) & 3); s->layer = 4 - ((header >> 17) & 3);
/* extract frequency */ /* extract frequency */
sample_rate_index = (header >> 10) & 3; sample_rate_index = (header >> 10) & 3;
if (sample_rate_index >= FF_ARRAY_ELEMS(avpriv_mpa_freq_tab))
sample_rate_index = 0;
sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25); sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
sample_rate_index += 3 * (s->lsf + mpeg25); sample_rate_index += 3 * (s->lsf + mpeg25);
s->sample_rate_index = sample_rate_index; s->sample_rate_index = sample_rate_index;