diff --git a/src/audio/alsalayer.cpp b/src/audio/alsalayer.cpp index b1b0dd69a6eef9e913d7b7d9fd7cdee912230a9d..2d2811b363722e41d4a2d774182eec2ef21681e4 100644 --- a/src/audio/alsalayer.cpp +++ b/src/audio/alsalayer.cpp @@ -194,9 +194,9 @@ void AlsaLayer::stopCaptureStream (void) if(_CaptureHandle){ err = snd_pcm_drop (_CaptureHandle); - _debug("AlsaLayer::stopCaptureStream snd_pcm_drop returned vaue : %i\n",err); + stop_capture (); - _debug("Wroking here !!!!!!!!!!!!!!!\n"); + } } diff --git a/src/audio/audiostream.cpp b/src/audio/audiostream.cpp index 778192643d5ee2ad3b2e2ba8540e2266a8cb370f..c031b4ac0d4a5119a7444736eb26a417d21d869f 100644 --- a/src/audio/audiostream.cpp +++ b/src/audio/audiostream.cpp @@ -66,6 +66,7 @@ AudioStream::stream_state_callback( pa_stream* s, void* user_data UNUSED ) case PA_STREAM_READY: _debug("Stream successfully created, connected to %s\n", pa_stream_get_device_name( s )); + pa_stream_cork( s, 0, NULL, NULL); break; case PA_STREAM_UNCONNECTED: _debug("Stream unconnected\n"); diff --git a/src/audio/pulselayer.cpp b/src/audio/pulselayer.cpp index 40de7e886fa86a6282b40e5870c402d3af0b4a18..8101e5e23839497707a618fe7f7afd1c08c533a2 100644 --- a/src/audio/pulselayer.cpp +++ b/src/audio/pulselayer.cpp @@ -140,12 +140,12 @@ void PulseLayer::createStreams( pa_context* c ) playback = new AudioStream(c, PLAYBACK_STREAM, PLAYBACK_STREAM_NAME, _manager->getSpkrVolume()); pa_stream_set_write_callback( playback->pulseStream(), audioCallback, this); - //pa_stream_set_overflow_callback( playback->pulseStream() , overflow , this); + // pa_stream_set_overflow_callback( playback->pulseStream() , overflow , this); // pa_stream_set_suspended_callback( playback->pulseStream(), stream_suspended_callback, this); record = new AudioStream(c, CAPTURE_STREAM, CAPTURE_STREAM_NAME , _manager->getMicVolume()); pa_stream_set_read_callback( record->pulseStream() , audioCallback, this); - //pa_stream_set_underflow_callback( record->pulseStream() , underflow , this); + // pa_stream_set_underflow_callback( record->pulseStream() , underflow , this); // pa_stream_set_suspended_callback(record->pulseStream(), stream_suspended_callback, this); @@ -173,6 +173,8 @@ bool PulseLayer::openDevice(int indexIn UNUSED, int indexOut UNUSED, int sampleR assert(context); connectPulseAudioServer(); + + startStream(); _debug("Connection Done!! \n"); return true; @@ -254,8 +256,6 @@ void PulseLayer::stream_suspended_callback(pa_stream *s, void *userdata UNUSED ) void PulseLayer::processData( void ) { - _debug("PulseLayer::processData() \n"); - // Handle the mic // We check if the stream is ready if( (record->pulseStream()) && (pa_stream_get_state( record->pulseStream()) == PA_STREAM_READY)) diff --git a/src/iaxvoiplink.cpp b/src/iaxvoiplink.cpp index 231e024d4619433cbc8ad291411a1155a1183150..79466dc5028ab6093d3c3565d0d2ed8818162977 100644 --- a/src/iaxvoiplink.cpp +++ b/src/iaxvoiplink.cpp @@ -74,6 +74,8 @@ IAXVoIPLink::~IAXVoIPLink() audiolayer = NULL; + delete converter; + delete [] micData; micData = NULL; delete [] micDataConverted; micDataConverted = NULL; delete [] micDataEncoded; micDataEncoded = NULL; diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index c24affc647efee0a88119fc1d99cf61bd7dd42db..70dd45a8105909d67cb3e55d93f3e897001d30e8 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -124,7 +124,7 @@ ManagerImpl::init() AudioLayer *audiolayer = getAudioDriver(); - if (audiolayer!=0) { + if (audiolayer != 0) { unsigned int sampleRate = audiolayer->getSampleRate(); _debugInit("Load Telephone Tone"); @@ -134,6 +134,9 @@ ManagerImpl::init() _debugInit("Loading DTMF key"); _dtmfKey = new DTMF(sampleRate); } + + if (audiolayer == 0) + audiolayer->stopStream(); } void ManagerImpl::terminate() @@ -190,6 +193,9 @@ ManagerImpl::outgoingCall(const std::string& accountid, const CallID& id, const { _debug("ManagerImpl::outgoingCall() method \n"); + stopTone(false); + playTone(); + if (!accountExists(accountid)) { _debug("! Manager Error: Outgoing Call: account doesn't exist\n"); return false; @@ -313,7 +319,7 @@ ManagerImpl::cancelCall (const CallID& id) bool ManagerImpl::onHoldCall(const CallID& id) { - _debug("*************** ON HOLD ***********************************\n"); + stopTone(true); AccountID accountid = getAccountFromCall( id ); if (accountid == AccountNULL) { @@ -336,7 +342,7 @@ ManagerImpl::onHoldCall(const CallID& id) bool ManagerImpl::offHoldCall(const CallID& id) { - _debug("*************** OFF HOLD ***********************************\n"); + stopTone(false); AccountID accountid = getAccountFromCall( id ); if (accountid == AccountNULL) { @@ -1592,6 +1598,8 @@ void ManagerImpl::setAudioManager( const int32_t& api ) { int manager; + _debug(" ManagerImpl::setAudioManager :: %i \n",api); + manager = api; if( manager == PULSEAUDIO ) { @@ -1705,8 +1713,8 @@ ManagerImpl::initAudioDriver(void) if (error == -1) { _debug("Init audio driver: %i\n", error); } - } - + } + } /** @@ -1756,6 +1764,7 @@ ManagerImpl::selectAudioDriver (void) /* Notify the error if there is one */ if( _audiodriver -> getErrorMessage() != -1 ) notifyErrClient( _audiodriver -> getErrorMessage()); + } void ManagerImpl::switchAudioManager (void) @@ -1796,6 +1805,16 @@ void ManagerImpl::switchAudioManager (void) _audiodriver->openDevice( numCardIn , numCardOut, samplerate, framesize, SFL_PCM_BOTH, alsaPlugin ); if( _audiodriver -> getErrorMessage() != -1 ) notifyErrClient( _audiodriver -> getErrorMessage()); + + _debug("Current device: %i \n", type); + _debug("has current call: %i \n", hasCurrentCall()); + + // need to stop audio streams if there is currently no call + if( (type != PULSEAUDIO) && (!hasCurrentCall())) { + _debug("There is currently a call!!\n"); + _audiodriver->stopStream(); + + } } /**