Merge commit '7650caf013f45ebebf128855735a0c6350836ea4'

* commit '7650caf013f45ebebf128855735a0c6350836ea4':
  rtpdec_h264: Use av_realloc instead of av_malloc+mempcy

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-02-20 21:30:01 +01:00
commit 5346b57ee7

View File

@ -115,7 +115,8 @@ static int parse_sprop_parameter_sets(AVFormatContext *s,
packet_size = av_base64_decode(decoded_packet, base64packet,
sizeof(decoded_packet));
if (packet_size > 0) {
uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) +
uint8_t *dest = av_realloc(codec->extradata,
packet_size + sizeof(start_sequence) +
codec->extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
if (!dest) {
@ -123,10 +124,7 @@ static int parse_sprop_parameter_sets(AVFormatContext *s,
"Unable to allocate memory for extradata!\n");
return AVERROR(ENOMEM);
}
if (codec->extradata_size) {
memcpy(dest, codec->extradata, codec->extradata_size);
av_free(codec->extradata);
}
codec->extradata = dest;
memcpy(dest + codec->extradata_size, start_sequence,
sizeof(start_sequence));
@ -135,7 +133,6 @@ static int parse_sprop_parameter_sets(AVFormatContext *s,
memset(dest + codec->extradata_size + sizeof(start_sequence) +
packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
codec->extradata = dest;
codec->extradata_size += sizeof(start_sequence) + packet_size;
}
}