X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Faac_ac3_parser.c;h=f28f3f26782b382d15338878ce9759299a0354eb;hb=b339f0c6be5f4c15d8136ef180b148550f0071cf;hp=8d7e20c51652ce65368a132e6cb37a062cf8fbc8;hpb=133ac890fbe48b2989a257eb58bfc0b3690ee054;p=ffmpeg diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c index 8d7e20c5165..f28f3f26782 100644 --- a/libavcodec/aac_ac3_parser.c +++ b/libavcodec/aac_ac3_parser.c @@ -33,9 +33,10 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1, int len, i; int new_frame_start; +get_next: i=END_NOT_FOUND; if(s->remaining_size <= buf_size){ - if(s->remaining_size){ + if(s->remaining_size && !s->need_next_header){ i= s->remaining_size; s->remaining_size = 0; }else{ //we need a header first @@ -49,7 +50,11 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1, i=END_NOT_FOUND; }else{ i-= s->header_size -1; - s->remaining_size = len + i; + s->remaining_size = len; + if(!new_frame_start){ + s->remaining_size += i; + goto get_next; + } } } } @@ -64,20 +69,20 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1, *poutbuf = buf; *poutbuf_size = buf_size; - /* update codec info */ - avctx->sample_rate = s->sample_rate; - /* allow downmixing to stereo (or mono for AC3) */ - if(avctx->request_channels > 0 && - avctx->request_channels < s->channels && - (avctx->request_channels <= 2 || - (avctx->request_channels == 1 && - avctx->codec_id == CODEC_ID_AC3))) { - avctx->channels = avctx->request_channels; - } else { - avctx->channels = s->channels; - } - avctx->bit_rate = s->bit_rate; - avctx->frame_size = s->samples; + /* update codec info */ + avctx->sample_rate = s->sample_rate; + /* allow downmixing to stereo (or mono for AC3) */ + if(avctx->request_channels > 0 && + avctx->request_channels < s->channels && + (avctx->request_channels <= 2 || + (avctx->request_channels == 1 && + avctx->codec_id == CODEC_ID_AC3))) { + avctx->channels = avctx->request_channels; + } else { + avctx->channels = s->channels; + } + avctx->bit_rate = s->bit_rate; + avctx->frame_size = s->samples; return i; }