diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index 8e0839237eedfea8ed94d1804744bb51cf539dcb..9bd34bd59445b3e889e486c8b7343719f8ad0fa3 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -259,6 +259,7 @@ sflphone_hang_up() case CALL_STATE_HOLD: case CALL_STATE_BUSY: case CALL_STATE_FAILURE: + case CALL_STATE_RECORDING: dbus_hang_up (selectedCall); selectedCall->state = CALL_STATE_DIALING; (void) time(&selectedCall->_stop); @@ -330,6 +331,10 @@ sflphone_on_hold () case CALL_STATE_CURRENT: dbus_hold (selectedCall); break; + case CALL_STATE_RECORD: + dbus_hold (selectedCall); + break; + default: g_warning("Should not happen in sflphone_on_hold!"); break; @@ -714,17 +719,16 @@ sflphone_rec_call() { case CALL_STATE_CURRENT: selectedCall->state = CALL_STATE_RECORD; - update_call_tree(current_calls,selectedCall); - update_menus(); break; case CALL_STATE_RECORD: selectedCall->state = CALL_STATE_CURRENT; - update_call_tree(current_calls,selectedCall); - update_menus(); break; default: + g_warning("Should not happen in sflphone_off_hold ()!"); break; } + update_call_tree(current_calls,selectedCall); + update_menus(); } /* Internal to action - set the __CURRENT_ACCOUNT variable */ @@ -761,7 +765,7 @@ sflphone_fill_codec_list() c->_bandwidth = atof(details[3]); codec_list_add(c); } - + for(pl=codecs; *codecs; codecs++) { details = (gchar **)dbus_codec_details(atoi(*codecs)); diff --git a/src/audio/audiortp.cpp b/src/audio/audiortp.cpp index b4c1bd0d095329b65d1b3e80cb74ca59ef299c6f..785078c0c8c18eafe02286f71da6689dbb2c73c7 100644 --- a/src/audio/audiortp.cpp +++ b/src/audio/audiortp.cpp @@ -101,7 +101,8 @@ void AudioRtp::setRecording() { _debug("AudioRtp::setRecording"); - _RTXThread->recAudio.setRecording(); + // _RTXThread->recAudio.setRecording(); + _RTXThread->_ca->setRecording(); } @@ -203,7 +204,11 @@ AudioRtpRTX::initAudioRtpSession (void) FILE_TYPE ft = FILE_WAV; SOUND_FORMAT sf = INT16; recAudio.setSndSamplingRate(44100); - recAudio.openFile(_ca->getFileName(),ft,sf,_ca->getCallId()); + recAudio.openFile(_ca->getFileName(),ft,sf); + + //_debug("Opening the wave file in call nstance\n"); + //_ca->recAudio.setSndSamplingRate(44100); + //_ca->recAudio.openFile("testRecFromCall",ft,sf,_ca->getCallId()); if (!_sym) { @@ -459,13 +464,17 @@ AudioRtpRTX::run () { // Let's wait for the next transmit cycle recAudio.recData(spkrDataConverted,micData,_nSamplesSpkr,_nSamplesMic); - + _ca->recAudio.recData(spkrDataConverted,micData,_nSamplesSpkr,_nSamplesMic); + Thread::sleep(TimerPort::getTimer()); TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms } _debug("Close wave file\n"); recAudio.closeFile(); + + //_debug("Close wave file in call instance\n"); + //_ca->recAudio.closeFile(); // _debug("stop stream for audiortp loop\n"); audiolayer->stopStream(); @@ -475,6 +484,9 @@ AudioRtpRTX::run () { _debug("! Close wave file\n"); recAudio.closeFile(); + + //_debug("Close wave file in call instance\n"); + //_ca->recAudio.closeFile(); throw; } catch(...) { @@ -482,6 +494,9 @@ AudioRtpRTX::run () { _debugException("* ARTP Action: Stop"); _debug("* Close wave file\n"); recAudio.closeFile(); + + //_debug("Close wave file in call instance\n"); + //_ca->recAudio.closeFile(); throw; } diff --git a/src/audio/audiortp.h b/src/audio/audiortp.h index 30e2333901aea0af455291dd978240b860bcab93..89b0f257905823cb8954e20c8f7c92c862fa9f60 100644 --- a/src/audio/audiortp.h +++ b/src/audio/audiortp.h @@ -29,7 +29,7 @@ #include <cc++/numbers.h> #include "../global.h" -#include "plug-in/audiorecorder/audiorecord.h" +// #include "plug-in/audiorecorder/audiorecord.h" #include "../samplerateconverter.h" #define UP_SAMPLING 0 @@ -71,6 +71,9 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort { */ AudioRecord recAudio; + /** A SIP call */ + SIPCall* _ca; + private: // copy constructor @@ -79,9 +82,6 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort { // assignment operator AudioRtpRTX& operator=(const AudioRtpRTX& rh); - /** A SIP call */ - SIPCall* _ca; - /** RTP session to send data */ ost::RTPSession *_sessionSend; diff --git a/src/call.cpp b/src/call.cpp index dc74fcc3f4e022c7332159b27d6a3dfd59b3a58c..3e0074532594260036b28a3748f5ee7dde0b2f65 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -55,11 +55,21 @@ Call::Call(const CallID& id, Call::CallType type) _filename = out.str(); printf("Call::constructor filename for tis call %s \n",_filename.c_str()); + + + + FILE_TYPE ft = FILE_WAV; + SOUND_FORMAT sf = INT16; + _debug("CALL::Opening the wave file in call nstance\n"); + recAudio.setSndSamplingRate(44100); + recAudio.openFile("testRecFromCall",ft,sf); } Call::~Call() { + _debug("CALL::Close wave file in call instance\n"); + recAudio.closeFile(); } void @@ -146,3 +156,8 @@ Call::isAudioStarted() return _audioStarted; } +void +Call::setRecording() +{ + recAudio.setRecording(); +} diff --git a/src/call.h b/src/call.h index 2de79c722f7db181ef938548d8163146270ae5b3..e14e01712e664fc2e388ffdb1d24ba914f25c655 100644 --- a/src/call.h +++ b/src/call.h @@ -218,7 +218,13 @@ class Call{ /** * A recorder fro this call */ - AudioRecord audioRec; + AudioRecord recAudio; + + /** + * SetRecording + */ + void setRecording(); + protected: /** Protect every attribute that can be changed by two threads */ diff --git a/src/plug-in/audiorecorder/audiorecord.cpp b/src/plug-in/audiorecorder/audiorecord.cpp index 6921bf60dd878d9046786a412de960e57d8325ff..e05f3af1a1784c42994c338da2813a54f9c82b99 100644 --- a/src/plug-in/audiorecorder/audiorecord.cpp +++ b/src/plug-in/audiorecorder/audiorecord.cpp @@ -36,7 +36,7 @@ void AudioRecord::setSndSamplingRate(int smplRate){ } -void AudioRecord::openFile(std::string name, FILE_TYPE type, SOUND_FORMAT format, CallID& id){ +void AudioRecord::openFile(std::string name, FILE_TYPE type, SOUND_FORMAT format){ _debug("AudioRecord::openFile()\n"); diff --git a/src/plug-in/audiorecorder/audiorecord.h b/src/plug-in/audiorecorder/audiorecord.h index e1f6c79c867537686ca3d9d8c6610490a3a74da7..a15e8a1c78093893ed7e812e86e28ac416db36bf 100644 --- a/src/plug-in/audiorecorder/audiorecord.h +++ b/src/plug-in/audiorecorder/audiorecord.h @@ -61,7 +61,7 @@ public: * @param type The sound file format (FILE_RAW, FILE_WAVE) * @param format Internal sound format (INT16 / INT32) */ - void openFile(std::string fileName, FILE_TYPE type, SOUND_FORMAT format, CallID& id); + void openFile(std::string fileName, FILE_TYPE type, SOUND_FORMAT format); /** * Close the opend recording file. If wave: cout the number of byte