summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFRIGN <dev@frign.de>2014-10-05 21:01:50 +0200
committersin <sin@2f30.org>2014-10-05 20:04:14 +0100
commit5488641c58da2fe196612eaf35af3534b62867f7 (patch)
tree3d34a4c5899758557233ef61cbcee3874440d2f2
parentd8013df97d768878472acca26cc67c58b2b33b4f (diff)
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. ;)
-rw-r--r--ratox.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ratox.c b/ratox.c
index b57b2a0..4d31fb6 100644
--- a/ratox.c
+++ b/ratox.c
@@ -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);
}