summaryrefslogtreecommitdiff
path: root/toxav/toxav.c
diff options
context:
space:
mode:
authormannol <eniz_vukovic@hotmail.com>2015-04-11 02:07:54 +0200
committermannol <eniz_vukovic@hotmail.com>2015-04-11 02:07:54 +0200
commitb2d88a4544a81a217db18b60d91a44d85821db3d (patch)
tree29eb1dc55848187b78e91cdb8dc59f6cf2ef89c2 /toxav/toxav.c
parent4fa31d14cf53dd54b182508df31b5524b1f24cb6 (diff)
Random fixes
Diffstat (limited to 'toxav/toxav.c')
-rw-r--r--toxav/toxav.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/toxav/toxav.c b/toxav/toxav.c
index 12f8b561..bd788d7d 100644
--- a/toxav/toxav.c
+++ b/toxav/toxav.c
@@ -237,7 +237,8 @@ void toxav_iterate(ToxAV* av)
237 } 237 }
238 LOGGED_UNLOCK(av->mutex); 238 LOGGED_UNLOCK(av->mutex);
239 239
240 av->interval = rc < av->dmssa ? 0 : (rc - av->dmssa); 240// av->interval = rc < av->dmssa ? 0 : (rc - av->dmssa);
241 av->interval = rc < 5 ? 1: rc - 5;
241 av->dmsst += current_time_monotonic() - start; 242 av->dmsst += current_time_monotonic() - start;
242 243
243 if (++av->dmssc == 3) { 244 if (++av->dmssc == 3) {
@@ -712,21 +713,22 @@ bool toxav_send_audio_frame(ToxAV* av, uint32_t friend_number, const int16_t* pc
712 goto END; 713 goto END;
713 } 714 }
714 715
715 uint8_t dest[sample_count * channels + sizeof(sampling_rate)]; /* This is more than enough always */ 716 uint8_t dest[sample_count + sizeof(sampling_rate)]; /* This is more than enough always */
716 717
717 sampling_rate = htonl(sampling_rate); 718 sampling_rate = htonl(sampling_rate);
718 memcpy(dest, &sampling_rate, sizeof(sampling_rate)); 719 memcpy(dest, &sampling_rate, sizeof(sampling_rate));
719 int vrc = opus_encode(call->cs->audio_encoder, pcm, sample_count, dest + sizeof(sampling_rate), sizeof(dest) - sizeof(sampling_rate)); 720 int vrc = opus_encode(call->cs->audio_encoder, pcm, sample_count,
721 dest + sizeof(sampling_rate), sizeof(dest) - sizeof(sampling_rate));
720 722
721 if (vrc < 0) { 723 if (vrc < 0) {
722 LOGGER_WARNING("Failed to encode frame"); 724 LOGGER_WARNING("Failed to encode frame %s", opus_strerror(vrc));
723 LOGGED_UNLOCK(call->mutex_audio_sending); 725 LOGGED_UNLOCK(call->mutex_audio_sending);
724 rc = TOXAV_ERR_SEND_FRAME_INVALID; 726 rc = TOXAV_ERR_SEND_FRAME_INVALID;
725 goto END; 727 goto END;
726 } 728 }
727 729
728 LOGGER_DEBUG("Sending encoded audio frame size: %d; channels: %d; srate: %d", vrc, channels, 730// LOGGER_DEBUG("Sending encoded audio frame size: %d; channels: %d; srate: %d", vrc, channels,
729 ntohl(sampling_rate)); 731// ntohl(sampling_rate));
730 732
731 if (rtp_send_msg(call->rtps[audio_index], dest, vrc + sizeof(sampling_rate)) != 0) { 733 if (rtp_send_msg(call->rtps[audio_index], dest, vrc + sizeof(sampling_rate)) != 0) {
732 LOGGER_WARNING("Failed to send audio packet"); 734 LOGGER_WARNING("Failed to send audio packet");