From e9d359a39ae8581f4cdc42e8684e8a1028bb7b97 Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Wed, 11 Feb 2009 15:23:30 -0500
Subject: [PATCH] Fix PulseAudio latency when the peer picks up

---
 src/iaxvoiplink.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/iaxvoiplink.cpp b/src/iaxvoiplink.cpp
index 1afa870b65..e7f8ec5768 100644
--- a/src/iaxvoiplink.cpp
+++ b/src/iaxvoiplink.cpp
@@ -428,8 +428,8 @@ IAXVoIPLink::answer(const CallID& id)
     call->setState(Call::Active);
     call->setConnectionState(Call::Connected);
     // Start audio
-    audiolayer->flushMic();
     audiolayer->startStream();
+    audiolayer->flushMic();
 
     return true;
 }
@@ -693,6 +693,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
             if (call->getConnectionState() != Call::Connected){
                 call->setConnectionState(Call::Connected);
                 call->setState(Call::Active);
+                audiolayer->startStream();
 
                 if (event->ies.format) {
                     // Should not get here, should have been set in EVENT_ACCEPT
@@ -701,7 +702,6 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
 
                 Manager::instance().peerAnsweredCall(id);
                 audiolayer->flushMic();
-                audiolayer->startStream();
                 // start audio here?
             } else {
                 // deja connecté ?
-- 
GitLab