Permalink
Browse files

Split video payload into multiple packets when >65k

This is the implementation of the [proposed fix](#620 (comment)) for [this issue](#620).
  • Loading branch information...
mannol authored and robinlinden committed Nov 25, 2017
1 parent 57115f0 commit e996a030f09052928c8484771c476778ca321e4a
Showing with 15 additions and 6 deletions.
  1. +15 −6 toxav/toxav.c
View
@@ -814,13 +814,22 @@ bool toxav_video_send_frame(ToxAV *av, uint32_t friend_number, uint16_t width, u
const vpx_codec_cx_pkt_t *pkt;
while ((pkt = vpx_codec_get_cx_data(call->video.second->encoder, &iter))) {
if (pkt->kind == VPX_CODEC_CX_FRAME_PKT &&
rtp_send_data(call->video.first, (const uint8_t *)pkt->data.frame.buf, pkt->data.frame.sz, av->m->log) < 0) {
if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
const uint8_t *buf = (const uint8_t *)pkt->data.frame.buf;
const uint8_t *end = buf + pkt->data.frame.sz;
pthread_mutex_unlock(call->mutex_video);
LOGGER_WARNING(av->m->log, "Could not send video frame: %s\n", strerror(errno));
rc = TOXAV_ERR_SEND_FRAME_RTP_FAILED;
goto END;
while (buf < end) {
uint16_t size = MIN(UINT16_MAX, end - buf);
if (rtp_send_data(call->video.first, buf, size, av->m->log) < 0) {
pthread_mutex_unlock(call->mutex_video);
LOGGER_WARNING(av->m->log, "Could not send video frame: %s\n", strerror(errno));
rc = TOXAV_ERR_SEND_FRAME_RTP_FAILED;
goto END;
}
buf += size;
}
}
}
}

0 comments on commit e996a03

Please sign in to comment.