From a5844ba09183475fb706be592f4740259d33a5ca Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.net>
Date: Mon, 19 Oct 2009 15:34:39 -0400
Subject: [PATCH] [#2308] Stop pulseaudio stream when peer hungup

Signed-off-by: Alexandre Savard <alexandre.savard@savoirfairelinux.net>
---
 sflphone-common/src/managerimpl.cpp | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index 7e977e432a..74b9f0d157 100644
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -427,10 +427,12 @@ ManagerImpl::hangupCall (const CallID& call_id)
 
     int nbCalls = getCallList().size();
 
+    // _debug("nbCalls: %i\n", nbCalls);
+
     audiolayer = getAudioDriver();
 
     // stop streams
-    if (! (nbCalls >= 1))
+    if (nbCalls <= 1)
     {
 	_debug("    hangupCall: stop audio stream, ther is only %i call(s) remaining\n", nbCalls);
         audiolayer->stopStream();
@@ -1895,6 +1897,18 @@ ManagerImpl::peerHungupCall (const CallID& call_id)
 	if (isCurrentCall(call_id)) 
 	{
 	    stopTone (true);
+
+	    int nbCalls = getCallList().size();
+
+	    // stop streams
+	    if (nbCalls <= 1)
+	    {
+		_debug("    hangupCall: stop audio stream, ther is only %i call(s) remaining\n", nbCalls);
+		
+		AudioLayer* audiolayer = getAudioDriver();
+		audiolayer->stopStream();
+	    }
+	    
 	    switchCall ("");
 	}
     }
-- 
GitLab