Commit efe07d8c authored by alexandresavard's avatar alexandresavard
Browse files

Record now implemented in Call class

parent 2c49fa13
......@@ -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));
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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();
}
......@@ -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 */
......
......@@ -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");
......
......@@ -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
......
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