comparison h264.c @ 8396:11b1f7762830 libavcodec

Clear FF_INPUT_BUFFER_PADDING_SIZE bytes at the end of NALs in rbsp_buffer. Fixes valgrind uninitialized value warnings at the end of decoding H.264 frames.
author astrange
date Fri, 19 Dec 2008 01:11:52 +0000
parents 195cba8f6257
children 81c6cec28a62
comparison
equal deleted inserted replaced
8395:195cba8f6257 8396:11b1f7762830
1404 *consumed= length+1; //+1 for the header 1404 *consumed= length+1; //+1 for the header
1405 return src; 1405 return src;
1406 } 1406 }
1407 1407
1408 bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; // use second escape buffer for inter data 1408 bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; // use second escape buffer for inter data
1409 h->rbsp_buffer[bufidx]= av_fast_realloc(h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length); 1409 h->rbsp_buffer[bufidx]= av_fast_realloc(h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+FF_INPUT_BUFFER_PADDING_SIZE);
1410 dst= h->rbsp_buffer[bufidx]; 1410 dst= h->rbsp_buffer[bufidx];
1411 1411
1412 if (dst == NULL){ 1412 if (dst == NULL){
1413 return NULL; 1413 return NULL;
1414 } 1414 }
1427 break; 1427 break;
1428 } 1428 }
1429 1429
1430 dst[di++]= src[si++]; 1430 dst[di++]= src[si++];
1431 } 1431 }
1432
1433 memset(dst+di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
1432 1434
1433 *dst_length= di; 1435 *dst_length= di;
1434 *consumed= si + 1;//+1 for the header 1436 *consumed= si + 1;//+1 for the header
1435 //FIXME store exact number of bits in the getbitcontext (it is needed for decoding) 1437 //FIXME store exact number of bits in the getbitcontext (it is needed for decoding)
1436 return dst; 1438 return dst;