Commit 5346b57e authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '7650caf0'

* commit '7650caf0':
  rtpdec_h264: Use av_realloc instead of av_malloc+mempcy
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 2130ed33 7650caf0
...@@ -115,7 +115,8 @@ static int parse_sprop_parameter_sets(AVFormatContext *s, ...@@ -115,7 +115,8 @@ static int parse_sprop_parameter_sets(AVFormatContext *s,
packet_size = av_base64_decode(decoded_packet, base64packet, packet_size = av_base64_decode(decoded_packet, base64packet,
sizeof(decoded_packet)); sizeof(decoded_packet));
if (packet_size > 0) { 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 + codec->extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE); FF_INPUT_BUFFER_PADDING_SIZE);
if (!dest) { if (!dest) {
...@@ -123,10 +124,7 @@ static int parse_sprop_parameter_sets(AVFormatContext *s, ...@@ -123,10 +124,7 @@ static int parse_sprop_parameter_sets(AVFormatContext *s,
"Unable to allocate memory for extradata!\n"); "Unable to allocate memory for extradata!\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
if (codec->extradata_size) { codec->extradata = dest;
memcpy(dest, codec->extradata, codec->extradata_size);
av_free(codec->extradata);
}
memcpy(dest + codec->extradata_size, start_sequence, memcpy(dest + codec->extradata_size, start_sequence,
sizeof(start_sequence)); sizeof(start_sequence));
...@@ -135,7 +133,6 @@ static int parse_sprop_parameter_sets(AVFormatContext *s, ...@@ -135,7 +133,6 @@ static int parse_sprop_parameter_sets(AVFormatContext *s,
memset(dest + codec->extradata_size + sizeof(start_sequence) + memset(dest + codec->extradata_size + sizeof(start_sequence) +
packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
codec->extradata = dest;
codec->extradata_size += sizeof(start_sequence) + packet_size; codec->extradata_size += sizeof(start_sequence) + packet_size;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment