mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Split video payload into multiple packets when >65k
This is the implementation of the [proposed fix](https://github.com/TokTok/c-toxcore/issues/620#issuecomment-346902071) for [this issue](https://github.com/TokTok/c-toxcore/issues/620).
This commit is contained in:
parent
57115f0e75
commit
e996a030f0
|
@ -814,14 +814,23 @@ bool toxav_video_send_frame(ToxAV *av, uint32_t friend_number, uint16_t width, u
|
||||||
const vpx_codec_cx_pkt_t *pkt;
|
const vpx_codec_cx_pkt_t *pkt;
|
||||||
|
|
||||||
while ((pkt = vpx_codec_get_cx_data(call->video.second->encoder, &iter))) {
|
while ((pkt = vpx_codec_get_cx_data(call->video.second->encoder, &iter))) {
|
||||||
if (pkt->kind == VPX_CODEC_CX_FRAME_PKT &&
|
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) {
|
const uint8_t *buf = (const uint8_t *)pkt->data.frame.buf;
|
||||||
|
const uint8_t *end = buf + pkt->data.frame.sz;
|
||||||
|
|
||||||
|
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);
|
pthread_mutex_unlock(call->mutex_video);
|
||||||
LOGGER_WARNING(av->m->log, "Could not send video frame: %s\n", strerror(errno));
|
LOGGER_WARNING(av->m->log, "Could not send video frame: %s\n", strerror(errno));
|
||||||
rc = TOXAV_ERR_SEND_FRAME_RTP_FAILED;
|
rc = TOXAV_ERR_SEND_FRAME_RTP_FAILED;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf += size;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user