avcodec/h2645_parse: Use get_nalsize() in ff_h2645_packet_split()

This fixes several regressions in h.264

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/230/head
Michael Niedermayer 9 years ago
parent f10ea03df3
commit 528171ba84
  1. 13
      libavcodec/h2645_parse.c

@ -260,16 +260,15 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
int skip_trailing_zeros = 1;
if (buf == next_avc) {
int i;
for (i = 0; i < nal_length_size; i++)
extract_length = (extract_length << 8) | buf[i];
int i = 0;
extract_length = get_nalsize(nal_length_size,
buf, length, &i, logctx);
if (extract_length < 0)
return extract_length;
buf += nal_length_size;
length -= nal_length_size;
if (extract_length > length) {
av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit size.\n");
return AVERROR_INVALIDDATA;
}
next_avc = buf + extract_length;
} else {
if (buf > next_avc)

Loading…
Cancel
Save