Fixed video in call sometimes freezing.

This should not happen anymore.
This commit is contained in:
irungentoo 2014-06-30 15:41:52 -04:00
parent 8f7638da5c
commit bc5eafac20
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98

View File

@ -422,7 +422,7 @@ inline__ int toxav_send_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallTy
/* number of pieces - 1*/
uint8_t numparts = (length - 1) / VIDEOFRAME_PIECE_SIZE;
uint8_t load[3 + VIDEOFRAME_PIECE_SIZE];
uint8_t load[2 + VIDEOFRAME_PIECE_SIZE];
load[0] = av->calls[call_index].frame_outid++;
load[1] = 0;
@ -542,11 +542,11 @@ inline__ int toxav_recv_video ( ToxAv *av, int32_t call_index, vpx_image_t **out
call->frame_limit = 0;
if (rc != VPX_CODEC_OK) {
LOGGER_ERROR("Error decoding video: %s\n", vpx_codec_err_to_string(rc));
return ErrorInternal;
LOGGER_ERROR("Error decoding video: %u %s\n", i, vpx_codec_err_to_string(rc));
}
} else {
/* old packet, dont read */
LOGGER_DEBUG("Old packet: %u\n", i);
continue;
}
@ -556,12 +556,14 @@ inline__ int toxav_recv_video ( ToxAv *av, int32_t call_index, vpx_image_t **out
continue;
}
LOGGER_DEBUG("Video Packet: %u %u\n", packet[0], packet[1]);
memcpy(call->frame_buf + packet[1] * VIDEOFRAME_PIECE_SIZE, packet + VIDEOFRAME_HEADER_SIZE,
recved_size - VIDEOFRAME_HEADER_SIZE);
uint32_t limit = packet[1] * VIDEOFRAME_PIECE_SIZE + recved_size - VIDEOFRAME_HEADER_SIZE;
if (limit > call->frame_limit) {
call->frame_limit = limit;
LOGGER_DEBUG("Limit: %u\n", call->frame_limit);
}
}