diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-05-28 10:20:54 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-05-28 10:44:06 +0200 |
commit | 5912848d2edbf61158ac7edc72c2302649a0d9ed (patch) | |
tree | de76a2a48b98730f5cb92af44410e47761d0e61d /src/pq_rtp.c | |
parent | 62688b60c29225d557da8844d7259ce3eee962c5 (diff) |
prepare gapk for dealing with variable-length frames
The existing architecture was modelled around fixed-length codec frame
sizes, which of course fails with multi-rate codecs such as AMR.
Diffstat (limited to 'src/pq_rtp.c')
-rw-r--r-- | src/pq_rtp.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pq_rtp.c b/src/pq_rtp.c index 1a7edde..99e77bc 100644 --- a/src/pq_rtp.c +++ b/src/pq_rtp.c @@ -88,7 +88,7 @@ struct pq_state_rtp { static int -pq_cb_rtp_input(void *_state, uint8_t *out, const uint8_t *in) +pq_cb_rtp_input(void *_state, uint8_t *out, const uint8_t *in, unsigned int in_len) { struct pq_state_rtp *state = _state; uint8_t buf[state->blk_len+256]; @@ -153,14 +153,14 @@ pq_cb_rtp_input(void *_state, uint8_t *out, const uint8_t *in) memcpy(out, payload, payload_len); - return 0; + return payload_len; } static int -pq_cb_rtp_output(void *_state, uint8_t *out, const uint8_t *in) +pq_cb_rtp_output(void *_state, uint8_t *out, const uint8_t *in, unsigned int in_len) { struct pq_state_rtp *state = _state; - int len = state->blk_len + sizeof(struct rtp_hdr); + int len = in_len + sizeof(struct rtp_hdr); uint8_t buf[len]; struct rtp_hdr *rtph = (struct rtp_hdr *)buf; uint8_t *payload; @@ -178,7 +178,7 @@ pq_cb_rtp_output(void *_state, uint8_t *out, const uint8_t *in) rtph->ssrc = htonl(state->ssrc); payload = buf + sizeof(*rtph); - memcpy(payload, in, state->blk_len); + memcpy(payload, in, in_len); rv = write(state->fd, buf, len); return rv == len ? 0 : -1; |