1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Properly pad H.264 extradata when taken from fmtp SDP attributes

This fixes some valgrind warnings.

Originally committed as revision 22182 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Martin Storsjö 2010-03-03 21:00:50 +00:00
parent bd8868e092
commit b9b8ed2a02

View File

@ -134,7 +134,9 @@ static void sdp_parse_fmtp_config_h264(AVStream * stream,
packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet));
if (packet_size) { if (packet_size) {
uint8_t *dest= av_malloc(packet_size+sizeof(start_sequence)+codec->extradata_size); uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) +
codec->extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
if(dest) if(dest)
{ {
if(codec->extradata_size) if(codec->extradata_size)
@ -146,6 +148,8 @@ static void sdp_parse_fmtp_config_h264(AVStream * stream,
memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence)); memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence));
memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size); memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);
memset(dest+codec->extradata_size+sizeof(start_sequence)+
packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
codec->extradata= dest; codec->extradata= dest;
codec->extradata_size+= sizeof(start_sequence)+packet_size; codec->extradata_size+= sizeof(start_sequence)+packet_size;