summaryrefslogtreecommitdiff
path: root/toxav/toxav.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2017-01-20 21:16:55 +0000
committeriphydf <iphydf@users.noreply.github.com>2017-01-28 20:49:12 +0000
commit6ae33c16cf9e37fda85d70c78b3c2779eb8ca21a (patch)
tree99c3a8c26e02039b515bb6f57d2797d1cdf77c1d /toxav/toxav.c
parent895de7ef26e7617769f2271345e414545c2581f8 (diff)
Add VLA compatibility macro for C89-ish compilers.
Diffstat (limited to 'toxav/toxav.c')
-rw-r--r--toxav/toxav.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toxav/toxav.c b/toxav/toxav.c
index 1710f2a4..58db4597 100644
--- a/toxav/toxav.c
+++ b/toxav/toxav.c
@@ -704,12 +704,12 @@ bool toxav_audio_send_frame(ToxAV *av, uint32_t friend_number, const int16_t *pc
704 goto END; 704 goto END;
705 } 705 }
706 706
707 uint8_t dest[sample_count + sizeof(sampling_rate)]; /* This is more than enough always */ 707 VLA(uint8_t, dest, sample_count + sizeof(sampling_rate)); /* This is more than enough always */
708 708
709 sampling_rate = htonl(sampling_rate); 709 sampling_rate = htonl(sampling_rate);
710 memcpy(dest, &sampling_rate, sizeof(sampling_rate)); 710 memcpy(dest, &sampling_rate, sizeof(sampling_rate));
711 int vrc = opus_encode(call->audio.second->encoder, pcm, sample_count, 711 int vrc = opus_encode(call->audio.second->encoder, pcm, sample_count,
712 dest + sizeof(sampling_rate), sizeof(dest) - sizeof(sampling_rate)); 712 dest + sizeof(sampling_rate), SIZEOF_VLA(dest) - sizeof(sampling_rate));
713 713
714 if (vrc < 0) { 714 if (vrc < 0) {
715 LOGGER_WARNING(av->m->log, "Failed to encode frame %s", opus_strerror(vrc)); 715 LOGGER_WARNING(av->m->log, "Failed to encode frame %s", opus_strerror(vrc));