Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

av1: remove old packetizer #645

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions include/re_av1.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ typedef int (av1_packet_h)(bool marker, uint64_t rtp_ts,
const uint8_t *pld, size_t pld_len,
void *arg);

int av1_packetize(bool *newp, bool marker, uint64_t rtp_ts,
const uint8_t *buf, size_t len, size_t maxlen,
av1_packet_h *pkth, void *arg);
int av1_packetize_high(bool *newp, bool marker, uint64_t rtp_ts,
const uint8_t *buf, size_t len, size_t maxlen,
av1_packet_h *pkth, void *arg);
Expand Down
63 changes: 14 additions & 49 deletions src/av1/pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,55 +24,6 @@ static void hdr_encode(uint8_t hdr[AV1_AGGR_HDR_SIZE],
}


/**
* Packetize an AV1 bitstream with one or more OBUs
*
* @param newp Pointer to new stream flag
* @param marker Set marker bit
* @param rtp_ts RTP timestamp
* @param buf Input buffer
* @param len Buffer length
* @param maxlen Maximum RTP packet size
* @param pkth Packet handler
* @param arg Handler argument
*
* @return 0 if success, otherwise errorcode
*/
int av1_packetize(bool *newp, bool marker, uint64_t rtp_ts,
const uint8_t *buf, size_t len, size_t maxlen,
av1_packet_h *pkth, void *arg)
{
uint8_t hdr[AV1_AGGR_HDR_SIZE];
bool cont = false;
uint8_t w = 0; /* variable OBU count */
int err = 0;

if (!newp || !buf || !len || maxlen < (AV1_AGGR_HDR_SIZE + 1) || !pkth)
return EINVAL;

maxlen -= sizeof(hdr);

while (len > maxlen) {

hdr_encode(hdr, cont, true, w, *newp);
*newp = false;

err |= pkth(false, rtp_ts, hdr, sizeof(hdr), buf, maxlen, arg);

buf += maxlen;
len -= maxlen;
cont = true;
}

hdr_encode(hdr, cont, false, w, *newp);
*newp = false;

err |= pkth(marker, rtp_ts, hdr, sizeof(hdr), buf, len, arg);

return err;
}


static struct mbuf *encode_obu(uint8_t type, const uint8_t *p, size_t len)
{
struct mbuf *mb = mbuf_alloc(len);
Expand Down Expand Up @@ -213,6 +164,20 @@ static int av1_packetize_internal(bool *newp, bool marker, uint64_t rtp_ts,
}


/**
* Packetize an AV1 bitstream with one or more OBUs
*
* @param newp Pointer to new stream flag
* @param marker Set marker bit
* @param rtp_ts RTP timestamp
* @param buf Input buffer
* @param len Buffer length
* @param maxlen Maximum RTP packet size
* @param pkth Packet handler
* @param arg Handler argument
*
* @return 0 if success, otherwise errorcode
*/
int av1_packetize_high(bool *newp, bool marker, uint64_t rtp_ts,
const uint8_t *buf, size_t len, size_t maxlen,
av1_packet_h *pkth, void *arg)
Expand Down