Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Commit

Permalink
Bug fix for issue #113 toxav_iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuongv committed Aug 17, 2015
1 parent 467c01c commit 6d03991
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Classes/Private/Wrapper/OCTToxAV.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,7 @@ - (void)start
dispatch_queue_t queue = dispatch_queue_create("me.dvor.objcTox.OCTToxAVQueue", NULL);
self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);

/**
* Call quality is not great without dividing the interval by 1/20th. This can
* be removed once toxav fixes this issue.
*/
uint64_t interval = _toxav_iteration_interval(self.toxAV) * (NSEC_PER_SEC / 1000) / 20;
uint64_t interval = _toxav_iteration_interval(self.toxAV) * (NSEC_PER_SEC / 1000);
dispatch_source_set_timer(self.timer, dispatch_walltime(NULL, 0), interval, interval / 5);

__weak OCTToxAV *weakSelf = self;
Expand All @@ -123,6 +119,9 @@ - (void)start
}

_toxav_iterate(strongSelf.toxAV);

uint64_t nextIterate = _toxav_iteration_interval(strongSelf.toxAV) * (NSEC_PER_SEC / 1000);
dispatch_source_set_timer(strongSelf.timer, dispatch_walltime(NULL, nextIterate), DISPATCH_TIME_FOREVER, nextIterate / 5);
});

dispatch_resume(self.timer);
Expand Down

0 comments on commit 6d03991

Please sign in to comment.