Mercurial > libavcodec.hg
comparison aac.c @ 11746:818851623979 libavcodec
Make aac_decode_frame() consume zero padding at the end of a packet.
author | alexc |
---|---|
date | Wed, 19 May 2010 20:18:34 +0000 |
parents | db33423d99ac |
children | c3ca752c24ef |
comparison
equal
deleted
inserted
replaced
11745:0cb0697b7f57 | 11746:818851623979 |
---|---|
1952 GetBitContext gb; | 1952 GetBitContext gb; |
1953 enum RawDataBlockType elem_type, elem_type_prev = TYPE_END; | 1953 enum RawDataBlockType elem_type, elem_type_prev = TYPE_END; |
1954 int err, elem_id, data_size_tmp; | 1954 int err, elem_id, data_size_tmp; |
1955 int buf_consumed; | 1955 int buf_consumed; |
1956 int samples = 1024, multiplier; | 1956 int samples = 1024, multiplier; |
1957 int buf_offset; | |
1957 | 1958 |
1958 init_get_bits(&gb, buf, buf_size * 8); | 1959 init_get_bits(&gb, buf, buf_size * 8); |
1959 | 1960 |
1960 if (show_bits(&gb, 12) == 0xfff) { | 1961 if (show_bits(&gb, 12) == 0xfff) { |
1961 if (parse_adts_frame_header(ac, &gb) < 0) { | 1962 if (parse_adts_frame_header(ac, &gb) < 0) { |
2063 | 2064 |
2064 if (ac->output_configured) | 2065 if (ac->output_configured) |
2065 ac->output_configured = OC_LOCKED; | 2066 ac->output_configured = OC_LOCKED; |
2066 | 2067 |
2067 buf_consumed = (get_bits_count(&gb) + 7) >> 3; | 2068 buf_consumed = (get_bits_count(&gb) + 7) >> 3; |
2068 return buf_size > buf_consumed ? buf_consumed : buf_size; | 2069 for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++) |
2070 if (buf[buf_offset]) | |
2071 break; | |
2072 | |
2073 return buf_size > buf_offset ? buf_consumed : buf_size; | |
2069 } | 2074 } |
2070 | 2075 |
2071 static av_cold int aac_decode_close(AVCodecContext *avccontext) | 2076 static av_cold int aac_decode_close(AVCodecContext *avccontext) |
2072 { | 2077 { |
2073 AACContext *ac = avccontext->priv_data; | 2078 AACContext *ac = avccontext->priv_data; |