tFix timing issue - ratox - FIFO based tox client
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 5488641c58da2fe196612eaf35af3534b62867f7
DIR parent d8013df97d768878472acca26cc67c58b2b33b4f
HTML Author: FRIGN <dev@frign.de>
Date: Sun, 5 Oct 2014 21:01:50 +0200
Fix timing issue
I don't know why I missed that
1) of course we have to check tv_sec, not tv_nsec
2) when we do a nanosleep, but use the "now"-val for the lastsent-
time, we obviously keep the wrong time.
This leads to the program thinking more time elapsed than really
has, leading to less nanosleep and thus higher playback-speed.
Now this is fixed, and apart from state-transition issues,
call-receiving now works perfectly. ;)
Diffstat:
M ratox.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
DIR diff --git a/ratox.c b/ratox.c
t@@ -600,11 +600,11 @@ sendfriendcalldata(struct friend *f)
clock_gettime(CLOCK_MONOTONIC, &now);
diff = timediff(f->av.lastsent, now);
- if (diff.tv_nsec == 0 && diff.tv_nsec < toxavconfig.audio_frame_duration * 1E6) {
+ if (diff.tv_sec == 0 && diff.tv_nsec < toxavconfig.audio_frame_duration * 1E6) {
diff.tv_nsec = toxavconfig.audio_frame_duration * 1E6 - diff.tv_nsec;
nanosleep(&diff, NULL);
}
- f->av.lastsent = now;
+ clock_gettime(CLOCK_MONOTONIC, &f->av.lastsent);
toxav_send_audio(toxav, f->av.num, f->av.payload, payloadsize);
}