Mercurial > libavcodec.hg
diff h264.c @ 5174:2e038003cdfb libavcodec
Do not reuse the rbsp de-escape buffer if both
the intra and inter -nal units are escaped
patch by Andreas ªÓman: \andreas olebyn nu/
original thread:
[FFmpeg-devel] [PATCH] h264: rbsp de-escape and data partitioning..
date: 06/20/2007 09:32 AM
author | benoit |
---|---|
date | Wed, 20 Jun 2007 08:53:53 +0000 |
parents | 60a4f209838b |
children | ea61020e5e87 |
line wrap: on
line diff
--- a/h264.c Wed Jun 20 07:08:00 2007 +0000 +++ b/h264.c Wed Jun 20 08:53:53 2007 +0000 @@ -1392,6 +1392,7 @@ static uint8_t *decode_nal(H264Context *h, uint8_t *src, int *dst_length, int *consumed, int length){ int i, si, di; uint8_t *dst; + int bufidx; // src[0]&0x80; //forbidden bit h->nal_ref_idc= src[0]>>5; @@ -1420,8 +1421,9 @@ return src; } - h->rbsp_buffer= av_fast_realloc(h->rbsp_buffer, &h->rbsp_buffer_size, length); - dst= h->rbsp_buffer; + bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; // use second escape buffer for inter data + h->rbsp_buffer[bufidx]= av_fast_realloc(h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length); + dst= h->rbsp_buffer[bufidx]; if (dst == NULL){ return NULL; @@ -8237,7 +8239,8 @@ H264Context *h = avctx->priv_data; MpegEncContext *s = &h->s; - av_freep(&h->rbsp_buffer); + av_freep(&h->rbsp_buffer[0]); + av_freep(&h->rbsp_buffer[1]); free_tables(h); //FIXME cleanup init stuff perhaps MPV_common_end(s);