@ -1631,12 +1631,12 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
header = AV_RB32 ( buf ) ;
header = AV_RB32 ( buf ) ;
if ( ff_mpa_check_header ( header ) < 0 ) {
ret = avpriv_mpegaudio_decode_header ( ( MPADecodeHeader * ) s , header ) ;
if ( ret < 0 ) {
av_log ( avctx , AV_LOG_ERROR , " Header missing \n " ) ;
av_log ( avctx , AV_LOG_ERROR , " Header missing \n " ) ;
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
}
} else if ( ret = = 1 ) {
if ( avpriv_mpegaudio_decode_header ( ( MPADecodeHeader * ) s , header ) = = 1 ) {
/* free format: prepare to compute frame size */
/* free format: prepare to compute frame size */
s - > frame_size = - 1 ;
s - > frame_size = - 1 ;
return AVERROR_INVALIDDATA ;
return AVERROR_INVALIDDATA ;
@ -1706,12 +1706,11 @@ static int decode_frame_adu(AVCodecContext *avctx, void *data,
// Get header and restore sync word
// Get header and restore sync word
header = AV_RB32 ( buf ) | 0xffe00000 ;
header = AV_RB32 ( buf ) | 0xffe00000 ;
if ( ff_mpa_check_header ( header ) < 0 ) { // Bad header, discard frame
ret = avpriv_mpegaudio_decode_header ( ( MPADecodeHeader * ) s , header ) ;
if ( ret < 0 ) {
av_log ( avctx , AV_LOG_ERROR , " Invalid frame header \n " ) ;
av_log ( avctx , AV_LOG_ERROR , " Invalid frame header \n " ) ;
return AVERROR_INVALIDDATA ;
return ret ;
}
}
avpriv_mpegaudio_decode_header ( ( MPADecodeHeader * ) s , header ) ;
/* update codec info */
/* update codec info */
avctx - > sample_rate = s - > sample_rate ;
avctx - > sample_rate = s - > sample_rate ;
avctx - > channels = s - > nb_channels ;
avctx - > channels = s - > nb_channels ;
@ -1903,11 +1902,10 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data,
}
}
header = ( AV_RB32 ( buf ) & 0x000fffff ) | s - > syncword ; // patch header
header = ( AV_RB32 ( buf ) & 0x000fffff ) | s - > syncword ; // patch header
if ( ff_mpa_check_header ( header ) < 0 ) // Bad header, discard block
ret = avpriv_mpegaudio_decode_header ( ( MPADecodeHeader * ) m , header ) ;
if ( ret < 0 ) // Bad header, discard block
break ;
break ;
avpriv_mpegaudio_decode_header ( ( MPADecodeHeader * ) m , header ) ;
if ( ch + m - > nb_channels > avctx - > channels | |
if ( ch + m - > nb_channels > avctx - > channels | |
s - > coff [ fr ] + m - > nb_channels > avctx - > channels ) {
s - > coff [ fr ] + m - > nb_channels > avctx - > channels ) {
av_log ( avctx , AV_LOG_ERROR , " frame channel count exceeds codec "
av_log ( avctx , AV_LOG_ERROR , " frame channel count exceeds codec "