[FFmpeg-devel] [PATCH] lavc/ac3_parser: avoid zeroing codec parameters if we haven't parsed a frame

Michael Niedermayer michaelni at gmx.at
Wed Nov 25 02:12:27 CET 2015


On Tue, Nov 24, 2015 at 03:23:17AM -0600, Rodger Combs wrote:
> This caused issues when seeking in some unusual MPEGTS files
> ---
>  libavcodec/aac_ac3_parser.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
> index 2f7d568..b01d5a5 100644
> --- a/libavcodec/aac_ac3_parser.c
> +++ b/libavcodec/aac_ac3_parser.c
> @@ -34,6 +34,7 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
>      ParseContext *pc = &s->pc;
>      int len, i;
>      int new_frame_start;
> +    int got_frame = 0;
>  
>  get_next:
>      i=END_NOT_FOUND;
> @@ -51,6 +52,7 @@ get_next:
>              if(len<=0){
>                  i=END_NOT_FOUND;
>              }else{
> +                got_frame = 1;
>                  s->state=0;
>                  i-= s->header_size -1;
>                  s->remaining_size = len;
> @@ -80,7 +82,7 @@ get_next:
>         and total number of samples found in an AAC ADTS header are not
>         reliable. Bit rate is still accurate because the total frame duration in
>         seconds is still correct (as is the number of bits in the frame). */
> -    if (avctx->codec_id != AV_CODEC_ID_AAC) {
> +    if (avctx->codec_id != AV_CODEC_ID_AAC && got_frame) {

is this not also needed for bitrate ?

and patch should be ok


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151125/836dff76/attachment.sig>


More information about the ffmpeg-devel mailing list