Skip to content

Commit

Permalink
test: use h264_stap_decode_annexb()
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Jul 4, 2024
1 parent 209919e commit 58985a9
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions test/h264.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,29 +635,12 @@ static int depack_handle_h264(struct state *st, bool marker,
}
else if (H264_NALU_STAP_A == h264_hdr.type) {

while (mbuf_get_left(src) >= 2) {

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,
st->long_startcode ? nal_seq4 : nal_seq3,
nal_seq_len);
err |= mbuf_write_mem(st->mb, mbuf_buf(src), len);
if (err)
goto out;

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

0 comments on commit 58985a9

Please sign in to comment.