Skip to content

Commit

Permalink
tweak tox_iterate() and toxav_iterate() intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Apr 28, 2023
1 parent cc3b9ce commit ddb0202
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,11 @@ void Core::process()
tolerance = 3 * CORE_DISCONNECT_TOLERANCE;
}

unsigned sleeptime =
qMin(tox_iteration_interval(tox.get()), getCoreFile()->corefileIterationInterval());
unsigned sleeptime_file = getCoreFile()->corefileIterationInterval();
unsigned sleeptime_toxcore = tox_iteration_interval(tox.get());
unsigned sleeptime = qMin(sleeptime_toxcore, sleeptime_file);
// qDebug() << "Core::process:sleeptime_file:" << sleeptime_file << "sleeptime_toxcore:" << sleeptime_toxcore << "sleeptime:" << sleeptime;
// TODO: check for active AV calls and lower iteration interval only when calls are active
if (sleeptime == 50) {
sleeptime = 20;
}
toxTimer->start(sleeptime);
}

Expand Down
8 changes: 7 additions & 1 deletion src/core/coreav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,13 @@ void CoreAV::process()
{
assert(QThread::currentThread() == coreavThread.get());
toxav_iterate(toxav.get());
iterateTimer->start(toxav_iteration_interval(toxav.get()));
uint32_t interval = toxav_iteration_interval(toxav.get());
if (interval <= 5)
{
interval = 10;
}
// qDebug() << "CoreAV:interval:" << interval;
iterateTimer->start(interval);
}

/**
Expand Down

0 comments on commit ddb0202

Please sign in to comment.