Commit 350f858f authored by Alexandre Savard's avatar Alexandre Savard

[#1314] Add some return values to audio init functions

parent 780b74d2
......@@ -50,7 +50,7 @@ AlsaLayer::~AlsaLayer (void)
closeLayer();
}
void
bool
AlsaLayer::closeLayer()
{
_debugAlsa("Close ALSA streams\n");
......@@ -73,6 +73,8 @@ AlsaLayer::closeLayer()
_CaptureHandle = 0;
_PlaybackHandle = 0;
return true;
}
bool
......
......@@ -48,7 +48,7 @@ class AlsaLayer : public AudioLayer {
*/
~AlsaLayer(void);
void closeLayer( void );
bool closeLayer( void );
/**
* Check if no devices are opened, otherwise close them.
......
......@@ -76,7 +76,7 @@ class AudioLayer {
*/
virtual ~AudioLayer(void) {}
virtual void closeLayer( void ) = 0;
virtual bool closeLayer( void ) = 0;
/**
* Check if no devices are opened, otherwise close them.
......
......@@ -52,7 +52,7 @@ PulseLayer::~PulseLayer (void)
pa_context_unref( context );
}
void
bool
PulseLayer::closeLayer( void )
{
_debug("PulseLayer::closeLayer :: Destroy pulselayer\n");
......@@ -66,6 +66,10 @@ PulseLayer::closeLayer( void )
//TODO Remove this ugly hack
sleep(2);
return true;
}
void
......@@ -123,7 +127,7 @@ void PulseLayer::context_state_callback( pa_context* c, void* user_data )
}
}
void PulseLayer::disconnectPulseAudioServer( void )
bool PulseLayer::disconnectPulseAudioServer( void )
{
_debug(" PulseLayer::disconnectPulseAudioServer( void ) \n");
if( playback )
......@@ -131,6 +135,11 @@ void PulseLayer::disconnectPulseAudioServer( void )
if( record )
delete record; record=NULL;
if (!playback && !record)
return true;
else
return false;
}
......
......@@ -37,7 +37,7 @@ class PulseLayer : public AudioLayer {
PulseLayer(ManagerImpl* manager);
~PulseLayer(void);
void closeLayer( void );
bool closeLayer( void );
/**
* Check if no devices are opened, otherwise close them.
......@@ -168,7 +168,7 @@ class PulseLayer : public AudioLayer {
/**
* Close the connection with the local pulseaudio server
*/
void disconnectPulseAudioServer( void );
bool disconnectPulseAudioServer( void );
/**
* Get some information about the pulseaudio server
......
......@@ -1843,7 +1843,7 @@ int ManagerImpl::app_is_running( std::string process )
/**
* Initialization: Main Thread
*/
void
bool
ManagerImpl::initAudioDriver(void)
{
......@@ -1871,13 +1871,17 @@ ManagerImpl::initAudioDriver(void)
if (_audiodriver == 0) {
_debug("Init audio driver error\n");
return false;
} else {
error = getAudioDriver()->getErrorMessage();
if (error == -1) {
_debug("Init audio driver: %i\n", error);
return false;
}
}
return true;manager
}
/**
......@@ -1974,7 +1978,7 @@ void ManagerImpl::switchAudioManager (void)
// need to stop audio streams if there is currently no call
if( (type != PULSEAUDIO) && (!hasCurrentCall())) {
_debug("There is currently a call!!\n");
// _debug("There is currently a call!!\n");
_audiodriver->stopStream();
}
......
......@@ -880,6 +880,11 @@ class ManagerImpl {
*/
AccountMap getSipAccountMap( void );
/*
* Initialize audiodriver
*/
bool initAudioDriver(void);
private:
/**
......@@ -905,11 +910,7 @@ class ManagerImpl {
*/
void initAudioCodec(void);
/*
* Initialize audiodriver
*/
void initAudioDriver(void);
/*
* Initialize zeroconf module and scanning
*/
......
include ../globals.mak
bin_PROGRAMS = numbercleanerTester pluginmanagerTester hookmanagerTester
bin_PROGRAMS = numbercleanerTester pluginmanagerTester hookmanagerTester audiolayerTester
OBJECT_FILES= \
../src/sflphoned-managerimpl.o \
......@@ -78,3 +78,21 @@ hookmanagerTester_LDADD = \
-luuid \
$(OBJECT_FILES)
audiolayerTester_SOURCES = \
audiolayerTest.h \
audiolayerTest.cpp \
TestMain.cpp
audiolayerTester_LDADD = \
../src/libsflphone.la \
$(SFLPHONE_LIBS) $(ZEROCONFLIB) $(LIB_DNSSD) \
@ALSA_LIBS@ \
@PULSEAUDIO_LIBS@ \
@CPPUNIT_LIBS@ \
@CCEXT2_LIBS@ \
@CCGNU2_LIBS@ \
@CCRTP_LIBS@ \
@SAMPLERATE_LIBS@ \
$(PJSIP_LIBS) \
-luuid \
$(OBJECT_FILES)
\ No newline at end of file
......@@ -13,7 +13,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software-
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
......
x/*
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
......
Markdown is supported
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