Skip to content
Snippets Groups Projects
Commit efe07d8c authored by alexandresavard's avatar alexandresavard
Browse files

Record now implemented in Call class

parent 2c49fa13
No related branches found
No related tags found
No related merge requests found
...@@ -259,6 +259,7 @@ sflphone_hang_up() ...@@ -259,6 +259,7 @@ sflphone_hang_up()
case CALL_STATE_HOLD: case CALL_STATE_HOLD:
case CALL_STATE_BUSY: case CALL_STATE_BUSY:
case CALL_STATE_FAILURE: case CALL_STATE_FAILURE:
case CALL_STATE_RECORDING:
dbus_hang_up (selectedCall); dbus_hang_up (selectedCall);
selectedCall->state = CALL_STATE_DIALING; selectedCall->state = CALL_STATE_DIALING;
(void) time(&selectedCall->_stop); (void) time(&selectedCall->_stop);
...@@ -330,6 +331,10 @@ sflphone_on_hold () ...@@ -330,6 +331,10 @@ sflphone_on_hold ()
case CALL_STATE_CURRENT: case CALL_STATE_CURRENT:
dbus_hold (selectedCall); dbus_hold (selectedCall);
break; break;
case CALL_STATE_RECORD:
dbus_hold (selectedCall);
break;
default: default:
g_warning("Should not happen in sflphone_on_hold!"); g_warning("Should not happen in sflphone_on_hold!");
break; break;
...@@ -714,17 +719,16 @@ sflphone_rec_call() ...@@ -714,17 +719,16 @@ sflphone_rec_call()
{ {
case CALL_STATE_CURRENT: case CALL_STATE_CURRENT:
selectedCall->state = CALL_STATE_RECORD; selectedCall->state = CALL_STATE_RECORD;
update_call_tree(current_calls,selectedCall);
update_menus();
break; break;
case CALL_STATE_RECORD: case CALL_STATE_RECORD:
selectedCall->state = CALL_STATE_CURRENT; selectedCall->state = CALL_STATE_CURRENT;
update_call_tree(current_calls,selectedCall);
update_menus();
break; break;
default: default:
g_warning("Should not happen in sflphone_off_hold ()!");
break; break;
} }
update_call_tree(current_calls,selectedCall);
update_menus();
} }
/* Internal to action - set the __CURRENT_ACCOUNT variable */ /* Internal to action - set the __CURRENT_ACCOUNT variable */
......
...@@ -101,7 +101,8 @@ void ...@@ -101,7 +101,8 @@ void
AudioRtp::setRecording() { AudioRtp::setRecording() {
_debug("AudioRtp::setRecording"); _debug("AudioRtp::setRecording");
_RTXThread->recAudio.setRecording(); // _RTXThread->recAudio.setRecording();
_RTXThread->_ca->setRecording();
} }
...@@ -203,7 +204,11 @@ AudioRtpRTX::initAudioRtpSession (void) ...@@ -203,7 +204,11 @@ AudioRtpRTX::initAudioRtpSession (void)
FILE_TYPE ft = FILE_WAV; FILE_TYPE ft = FILE_WAV;
SOUND_FORMAT sf = INT16; SOUND_FORMAT sf = INT16;
recAudio.setSndSamplingRate(44100); 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) { if (!_sym) {
...@@ -459,6 +464,7 @@ AudioRtpRTX::run () { ...@@ -459,6 +464,7 @@ AudioRtpRTX::run () {
// Let's wait for the next transmit cycle // Let's wait for the next transmit cycle
recAudio.recData(spkrDataConverted,micData,_nSamplesSpkr,_nSamplesMic); recAudio.recData(spkrDataConverted,micData,_nSamplesSpkr,_nSamplesMic);
_ca->recAudio.recData(spkrDataConverted,micData,_nSamplesSpkr,_nSamplesMic);
Thread::sleep(TimerPort::getTimer()); Thread::sleep(TimerPort::getTimer());
TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms
...@@ -467,6 +473,9 @@ AudioRtpRTX::run () { ...@@ -467,6 +473,9 @@ AudioRtpRTX::run () {
_debug("Close wave file\n"); _debug("Close wave file\n");
recAudio.closeFile(); recAudio.closeFile();
//_debug("Close wave file in call instance\n");
//_ca->recAudio.closeFile();
// _debug("stop stream for audiortp loop\n"); // _debug("stop stream for audiortp loop\n");
audiolayer->stopStream(); audiolayer->stopStream();
} catch(std::exception &e) { } catch(std::exception &e) {
...@@ -476,6 +485,9 @@ AudioRtpRTX::run () { ...@@ -476,6 +485,9 @@ AudioRtpRTX::run () {
_debug("! Close wave file\n"); _debug("! Close wave file\n");
recAudio.closeFile(); recAudio.closeFile();
//_debug("Close wave file in call instance\n");
//_ca->recAudio.closeFile();
throw; throw;
} catch(...) { } catch(...) {
_start.post(); _start.post();
...@@ -483,6 +495,9 @@ AudioRtpRTX::run () { ...@@ -483,6 +495,9 @@ AudioRtpRTX::run () {
_debug("* Close wave file\n"); _debug("* Close wave file\n");
recAudio.closeFile(); recAudio.closeFile();
//_debug("Close wave file in call instance\n");
//_ca->recAudio.closeFile();
throw; throw;
} }
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <cc++/numbers.h> #include <cc++/numbers.h>
#include "../global.h" #include "../global.h"
#include "plug-in/audiorecorder/audiorecord.h" // #include "plug-in/audiorecorder/audiorecord.h"
#include "../samplerateconverter.h" #include "../samplerateconverter.h"
#define UP_SAMPLING 0 #define UP_SAMPLING 0
...@@ -71,6 +71,9 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort { ...@@ -71,6 +71,9 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
*/ */
AudioRecord recAudio; AudioRecord recAudio;
/** A SIP call */
SIPCall* _ca;
private: private:
// copy constructor // copy constructor
...@@ -79,9 +82,6 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort { ...@@ -79,9 +82,6 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
// assignment operator // assignment operator
AudioRtpRTX& operator=(const AudioRtpRTX& rh); AudioRtpRTX& operator=(const AudioRtpRTX& rh);
/** A SIP call */
SIPCall* _ca;
/** RTP session to send data */ /** RTP session to send data */
ost::RTPSession *_sessionSend; ost::RTPSession *_sessionSend;
......
...@@ -55,11 +55,21 @@ Call::Call(const CallID& id, Call::CallType type) ...@@ -55,11 +55,21 @@ Call::Call(const CallID& id, Call::CallType type)
_filename = out.str(); _filename = out.str();
printf("Call::constructor filename for tis call %s \n",_filename.c_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() Call::~Call()
{ {
_debug("CALL::Close wave file in call instance\n");
recAudio.closeFile();
} }
void void
...@@ -146,3 +156,8 @@ Call::isAudioStarted() ...@@ -146,3 +156,8 @@ Call::isAudioStarted()
return _audioStarted; return _audioStarted;
} }
void
Call::setRecording()
{
recAudio.setRecording();
}
...@@ -218,7 +218,13 @@ class Call{ ...@@ -218,7 +218,13 @@ class Call{
/** /**
* A recorder fro this call * A recorder fro this call
*/ */
AudioRecord audioRec; AudioRecord recAudio;
/**
* SetRecording
*/
void setRecording();
protected: protected:
/** Protect every attribute that can be changed by two threads */ /** Protect every attribute that can be changed by two threads */
......
...@@ -36,7 +36,7 @@ void AudioRecord::setSndSamplingRate(int smplRate){ ...@@ -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"); _debug("AudioRecord::openFile()\n");
......
...@@ -61,7 +61,7 @@ public: ...@@ -61,7 +61,7 @@ public:
* @param type The sound file format (FILE_RAW, FILE_WAVE) * @param type The sound file format (FILE_RAW, FILE_WAVE)
* @param format Internal sound format (INT16 / INT32) * @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 * Close the opend recording file. If wave: cout the number of byte
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment