diff options
author | FRIGN <dev@frign.de> | 2014-10-05 21:01:50 +0200 |
---|---|---|
committer | sin <sin@2f30.org> | 2014-10-05 20:04:14 +0100 |
commit | 5488641c58da2fe196612eaf35af3534b62867f7 (patch) | |
tree | 3d34a4c5899758557233ef61cbcee3874440d2f2 /ratox.c | |
parent | d8013df97d768878472acca26cc67c58b2b33b4f (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. ;)
Diffstat (limited to 'ratox.c')
-rw-r--r-- | ratox.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); } |