Commit 96f64a4f authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[2308] Fix latency at the beginning of a call, when playing DTMF and wehn starting tone

parent f372439b
......@@ -24,13 +24,13 @@ void AudioLayer::flushMain (void)
ost::MutexLock guard (_mutex);
// should pass call id
_mainBuffer.flush();
_mainBuffer.flushAllBuffers();
}
void AudioLayer::flushUrgent (void)
{
ost::MutexLock guard (_mutex);
_urgentRingBuffer.flush();
_urgentRingBuffer.flushAll();
}
void AudioLayer::flushMic (void)
......
......@@ -498,10 +498,12 @@ namespace sfl {
}
_ca->setRecordingSmplRate(_audiocodec->getClockRate());
_audiolayer->startStream();
static_cast<D*>(this)->startRunning();
_audiolayer->flushUrgent();
_debug ("Entering RTP mainloop for callid %s\n",_ca->getCallId().c_str());
while (!testCancel()) {
......
......@@ -372,6 +372,7 @@ ManagerImpl::answerCall (const CallID& call_id)
}
if (!getAccountLink (account_id)->answer (call_id)) {
// error when receiving...
removeCallAccount (call_id);
......@@ -777,7 +778,7 @@ ManagerImpl::refuseCall (const CallID& id)
AccountID accountid;
bool returnValue;
stopTone (true);
stopTone (false);
int nbCalls = getCallList().size();
......@@ -1700,6 +1701,8 @@ ManagerImpl::playDtmf (char code, bool isTalking)
// Put buffer to urgentRingBuffer
// put the size in bytes...
// so size * 1 channel (mono) * sizeof (bytes for the data)
audiolayer->flushUrgent();
audiolayer->startStream();
audiolayer->putUrgent (buf, size * sizeof (SFLDataFormat));
}
......@@ -2030,6 +2033,8 @@ bool ManagerImpl::playATone (Tone::TONEID toneId)
if (audiolayer)
audiolayer->startStream();
audiolayer->flushUrgent();
if (_telephoneTone != 0) {
_toneMutex.enterMutex();
_telephoneTone->setCurrentTone (toneId);
......@@ -2039,6 +2044,7 @@ bool ManagerImpl::playATone (Tone::TONEID toneId)
nbSamples = audioloop->getSize();
SFLDataFormat buf[nbSamples];
if (audiolayer) {
audiolayer->putUrgent (buf, nbSamples);
} else
......@@ -2218,6 +2224,7 @@ void ManagerImpl::notificationIncomingCall (void)
SFLDataFormat buf[nbSampling];
tone.getNext (buf, tone.getSize());
/* Put the data in the urgent ring buffer */
audiolayer->flushUrgent();
audiolayer->putUrgent (buf, sizeof (SFLDataFormat) *nbSampling);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment