diff options
author | z3bra <contactatz3bradotorg> | 2016-11-18 23:29:47 +0100 |
---|---|---|
committer | z3bra <contactatz3bradotorg> | 2016-11-19 00:31:18 +0100 |
commit | e3995fbf95ce419183df5dac5d48a30d989e8e37 (patch) | |
tree | a6b7c183ed7951a44aa0462b5eabc1dd1ceeb496 /ratox.c | |
parent | 2adc007bf779afd2207f26d747c5683cd8a8d5e2 (diff) |
Get audio call to work properly
This commit puts back in place the settings that were previously set
regarding audio encoding, preparation of the frame, buffer and so on.
These settings used to work great and I modified them without having any
clue of how it was working.
Now I'm done playing, and it works properly. Hooray.
Diffstat (limited to 'ratox.c')
-rw-r--r-- | ratox.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -144,10 +144,10 @@ enum { }; struct call { - int state; - int16_t *frame; - ssize_t n; - struct timespec lastsent; + int state; + uint8_t *frame; + ssize_t n; + struct timespec lastsent; }; struct friend { @@ -407,7 +407,7 @@ cbcalldata(ToxAV *av, uint32_t fnum, const int16_t *data, size_t len, struct friend *f; ssize_t n, wrote; int fd; - int16_t *buf; + uint8_t *buf; TAILQ_FOREACH(f, &friendhead, entry) if (f->num == fnum) @@ -427,8 +427,8 @@ cbcalldata(ToxAV *av, uint32_t fnum, const int16_t *data, size_t len, } } - buf = (int16_t *)data; - len *= channels; + buf = (uint8_t *)data; + len *= 2; wrote = 0; while (len > 0) { n = write(f->fd[FCALL_OUT], &buf[wrote], len); @@ -505,7 +505,7 @@ sendfriendcalldata(struct friend *f) nanosleep(&diff, NULL); } clock_gettime(CLOCK_MONOTONIC, &f->av.lastsent); - if (!toxav_audio_send_frame(toxav, f->num, f->av.frame, + if (!toxav_audio_send_frame(toxav, f->num, (int16_t *)f->av.frame, framesize, AUDIOCHANNELS, AUDIOSAMPLERATE, &err)) weprintf("Failed to send audio frame: %s\n", callerr[err]); } @@ -1760,6 +1760,8 @@ loop(void) break; } f->av.n = 0; + f->av.lastsent.tv_sec = 0; + f->av.lastsent.tv_nsec = 0; f->av.state |= OUTGOING; f->av.frame = malloc(sizeof(int16_t) * framesize); if (!f->av.frame) |