Skip to content

Commit

Permalink
avcodec: use util function to decode H.264 STAP-A
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh authored and sreimers committed Mar 27, 2024
1 parent 855c9af commit 50b70b4
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions modules/avcodec/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,27 +413,9 @@ int avcodec_decode_h264(struct viddec_state *st, struct vidframe *frame,
}
else if (H264_NALU_STAP_A == h264_hdr.type) {

while (mbuf_get_left(src) >= 2) {

const uint16_t len = ntohs(mbuf_read_u16(src));
struct h264_nal_header lhdr;

if (mbuf_get_left(src) < len)
return EBADMSG;

err = h264_nal_header_decode(&lhdr, src);
if (err)
return err;

--src->pos;

err = mbuf_write_mem(st->mb, nal_seq, 3);
err |= mbuf_write_mem(st->mb, mbuf_buf(src), len);
if (err)
goto out;

src->pos += len;
}
err = h264_stap_decode_annexb(st->mb, src);
if (err)
goto out;
}
else {
warning("avcodec: decode: unknown NAL type %u\n",
Expand Down

0 comments on commit 50b70b4

Please sign in to comment.