Commit 8ade6da0 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2165] Finish recording refactoring for call (not for conference)

parent 88ed86c6
......@@ -930,20 +930,39 @@ sflphone_conference_off_hold(const conference_obj_t * c)
sflphone_rec_call()
{
callable_obj_t * selectedCall = calltab_get_selected_call(current_calls);
dbus_set_record(selectedCall);
conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls);
switch(selectedCall->_state)
if(selectedCall)
{
case CALL_STATE_CURRENT:
selectedCall->_state = CALL_STATE_RECORD;
break;
case CALL_STATE_RECORD:
selectedCall->_state = CALL_STATE_CURRENT;
break;
default:
WARN("Should not happen in sflphone_off_hold ()!");
break;
dbus_set_record(selectedCall->_callID);
switch(selectedCall->_state)
{
case CALL_STATE_CURRENT:
selectedCall->_state = CALL_STATE_RECORD;
break;
case CALL_STATE_RECORD:
selectedCall->_state = CALL_STATE_CURRENT;
break;
default:
WARN("Should not happen in sflphone_off_hold ()!");
break;
}
}
else if(selectedConf)
{
dbus_set_record(selectedConf->_confID);
switch(selectedConf->_state)
{
case CONFERENCE_STATE_ACTIVE_ATACHED:
selectedCall->_state = CONFERENCE_STATE_RECORD;
break;
case CONFERENCE_STATE_RECORD:
selectedCall->_state = CONFERENCE_STATE_ACTIVE_ATACHED;
break;
default:
WARN("Should not happen in sflphone_off_hold ()!");
break;
}
}
calltree_update_call(current_calls, selectedCall, NULL);
update_menus();
......
......@@ -28,6 +28,7 @@
#include <codeclist.h>
#include <sflphone_const.h>
#include <errors.h>
#include <conference_obj.h>
/** @file actions.h
* @brief General functions that change the state of the application.
......
......@@ -34,6 +34,7 @@ typedef enum
{
CONFERENCE_STATE_ACTIVE_ATACHED = 0,
CONFERENCE_STATE_ACTIVE_DETACHED,
CONFERENCE_STATE_RECORD,
CONFERENCE_STATE_HOLD
} conference_state_t;
......
......@@ -1366,7 +1366,7 @@ dbus_set_volume_controls( )
}
}
void
dbus_join_participant(const gchar* sel_callID, const gchar* drag_callID)
{
......@@ -1386,7 +1386,7 @@ dbus_join_participant(const gchar* sel_callID, const gchar* drag_callID)
}
void
dbus_add_participant(const gchar* callID, const gchar* confID)
{
......@@ -1406,6 +1406,7 @@ dbus_add_participant(const gchar* callID, const gchar* confID)
}
void
dbus_add_main_participant(const gchar* confID)
{
DEBUG("dbus_add_participant %s\n", confID);
......@@ -1464,14 +1465,14 @@ dbus_join_conference(const gchar* sel_confID, const gchar* drag_confID)
void
dbus_set_record(const callable_obj_t * c)
dbus_set_record(const gchar* id)
{
DEBUG("dbus_set_record %s\n", c->_callID);
DEBUG("dbus_set_record %s\n", id);
GError* error = NULL;
org_sflphone_SFLphone_CallManager_set_recording (
callManagerProxy,
c->_callID,
id,
&error);
if(error)
{
......
......@@ -451,7 +451,7 @@ void dbus_enable_stun (void);
void dbus_add_participant(const gchar* callID, const gchar* confID);
void dbus_set_record (const callable_obj_t * c);
void dbus_set_record (const gchar * id);
void dbus_set_record_path (const gchar *path);
gchar* dbus_get_record_path (void);
......
......@@ -329,6 +329,7 @@ toolbar_update_buttons ()
gtk_signal_handler_unblock(transfertButton, transfertButtonConnId);
callable_obj_t * selectedCall = calltab_get_selected_call(active_calltree);
conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree);
if (selectedCall)
{
switch(selectedCall->_state)
......@@ -396,6 +397,26 @@ toolbar_update_buttons ()
break;
}
}
else if(selectedConf)
{
switch(selectedConf->_state)
{
case CONFERENCE_STATE_ACTIVE_ATACHED:
gtk_widget_set_sensitive( GTK_WIDGET(recButton), FALSE);
break;
case CONFERENCE_STATE_ACTIVE_DETACHED:
gtk_widget_set_sensitive( GTK_WIDGET(recButton), FALSE);
break;
case CONFERENCE_STATE_RECORD:
gtk_widget_set_sensitive( GTK_WIDGET(recButton), FALSE);
break;
case CONFERENCE_STATE_HOLD:
gtk_widget_set_sensitive( GTK_WIDGET(recButton), FALSE);
break;
default:
break;
}
}
else
{
if( account_list_get_size() > 0 )
......
......@@ -59,7 +59,7 @@ class AudioLayer {
: _defaultVolume(100)
, _layerType( type )
, _manager(manager)
, _urgentRingBuffer( SIZEBUF, default_id )
, _urgentRingBuffer( SIZEBUF, default_id )
, _indexIn ( 0 )
, _indexOut ( 0 )
, _sampleRate ( 0 )
......@@ -218,7 +218,7 @@ class AudioLayer {
/**
* Set the audio recorder
*/
void setRecorderInstance(Recordable* rec) {_recorder = rec;}
void setRecorderInstance(Recordable* rec) {_recorder = NULL; _recorder = rec;}
/**
* Get the audio recorder
......
......@@ -136,6 +136,7 @@ AudioRtp::closeRtpSession ()
return true;
}
/*
void
AudioRtp::setRecording()
{
......@@ -144,6 +145,7 @@ AudioRtp::setRecording()
_RTXThread->_ca->setRecording();
}
*/
////////////////////////////////////////////////////////////////////////////////
// AudioRtpRTX Class //
......@@ -276,17 +278,6 @@ AudioRtpRTX::initBuffers()
spkrDataConverted = new SFLDataFormat[nbSamplesMax];
spkrDataDecoded = new SFLDataFormat[nbSamplesMax];
for(int i = 0; i < nbSamplesMax; i++)
{
micData = new SFLDataFormat[nbSamplesMax];
_debug("CREATE print micData address %p\n", micData);
micDataConverted = new SFLDataFormat[nbSamplesMax];
micDataEncoded = new unsigned char[nbSamplesMax];
spkrDataConverted = new SFLDataFormat[nbSamplesMax];
spkrDataDecoded = new SFLDataFormat[nbSamplesMax];
}
Manager::instance().addStream(_ca->getCallId());
// _audiolayer->getMainBuffer()->bindCallID(_ca->getCallId());
}
......@@ -647,15 +638,6 @@ AudioRtpRTX::run ()
while (!testCancel()) {
for(int i = 0; i < nbSamplesMax; i++)
{
micData[i] = 0;
micDataConverted[i] = 0;
micDataEncoded[i] = 0;
spkrDataConverted[i] = 0;
spkrDataDecoded[i] = 0;
}
// _debug("Main while loop for call: %s\n", _ca->getCallId().c_str());
// Send session
......@@ -670,7 +652,7 @@ AudioRtpRTX::run ()
// Let's wait for the next transmit cycle
/*
if (sessionWaiting == 1) {
// Record mic and speaker during conversation
_ca->recAudio.recData (spkrDataConverted,micData,_nSamplesSpkr,_nSamplesMic);
......@@ -678,7 +660,7 @@ AudioRtpRTX::run ()
// Record mic only while leaving a message
_ca->recAudio.recData (micData,_nSamplesMic);
}
*/
// Let's wait for the next transmit cycle
Thread::sleep (TimerPort::getTimer());
......
......@@ -81,15 +81,10 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
/** Thread associated method */
virtual void run ();
/**
* Audio recording object
*/
// AudioRecord recAudio;
/** A SIP call */
SIPCall* _ca;
/**
/**
* Update RTP session media info as received from SDP negociation
*/
void setRtpSessionMedia(void);
......@@ -275,7 +270,7 @@ class AudioRtp {
/**
* Start recording
*/
void setRecording ();
// void setRecording ();
friend class RtpTest;
......
......@@ -440,13 +440,17 @@ void PulseLayer::writeToSpeaker (void)
// _debug("PulseLayer::writeToSpeaker _mainBuffer.getData() toGet %i\n", toGet);
_mainBuffer.getData (out, toGet, 100);
file_spkr->write((const char*)out, toGet);
// file_spkr->write((const char*)out, toGet);
/*
if(_recorder != NULL)
{
_debug("RECORDING!!!\n");
// _debug("RECORDING!!!\n");
_recorder->recAudio.recData(out, toGet/sizeof(SFLDataFormat));
}
*/
pa_stream_write (playback->pulseStream(), out, toGet, NULL, 0, PA_SEEK_RELATIVE);
// _debug("PulseLayer::writeToSpeaker _mainBuffer.discard() toGet %i\n", toGet);
......@@ -477,7 +481,7 @@ void PulseLayer::readFromMic (void)
}
if (data) {
file_mic->write((char*)data, r);
// file_mic->write((char*)data, r);
_mainBuffer.putData ( (void*) data ,r, 100);
}
......
......@@ -173,27 +173,3 @@ Call::isAudioStarted()
return _audioStarted;
}
void
Call::setRecording()
{
recAudio.setRecording();
}
void
Call::initRecFileName()
{
recAudio.initFileName (_peerNumber);
}
void
Call::stopRecording()
{
recAudio.stopRecording();
}
bool
Call::isRecording()
{
return recAudio.isRecording();
}
......@@ -210,34 +210,10 @@ class Call: public Recordable{
*/
unsigned int getLocalAudioPort();
/**
* @return Return the file name for this call
*/
std::string getFileName() {return _filename;}
/**
* SetRecording
*/
void setRecording();
/**
* stopRecording, make sure the recording is stopped (whe transfering call)
*/
void stopRecording();
/**
* Return Recording state
*/
bool isRecording();
/**
*
*/
void initRecFileName();
std::string getRecFileId(){ return getPeerName(); }
std::string getFileName() { return _filename; }
protected:
/** Protect every attribute that can be changed by two threads */
ost::Mutex _callMutex;
......@@ -282,7 +258,7 @@ class Call: public Recordable{
/** Number of the peer */
std::string _peerNumber;
/** File name for his call : time YY-MM-DD */
/** File name for his call : time YY-MM-DD */
std::string _filename;
};
......
......@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <sstream>
......@@ -146,3 +146,4 @@ ParticipantSet Conference::getParticipantList()
{
return _participants;
}
......@@ -209,14 +209,37 @@ ManagerImpl::switchCall (const CallID& id)
_debug("------------------------- SWITCH %s ---------------------------\n", id.c_str());
_currentCallId2 = id;
// set the recordable instance in audiolayer
AccountID account_id = getAccountFromCall(id);
AudioLayer* al = getAudioDriver();
/*
AudioLayer *al = getAudioDriver();
Call* call = NULL;
call = getAccountLink (account_id)->getCall(id);
if (id != "") {
if(isConference(id)) {
Conference *conf;
ConferenceMap::iterator iter = _conferencemap.find(id);
if(iter != _conferencemap.end())
{
_debug(" set call recordable in audio layer\n");
conf = iter->second;
al->setRecorderInstance((Recordable*)conf);
}
}
else {
// set the recordable instance in audiolayer
AccountID account_id = getAccountFromCall(id);
Call *call = NULL;
call = getAccountLink (account_id)->getCall(id);
al->setRecorderInstance((Recordable*)call);
_debug(" set call recordable in audio layer\n");
al->setRecorderInstance((Recordable*)call);
}
}
*/
}
......
......@@ -2725,7 +2725,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
}
/*
* On incoming NOTIFY, notify application about call transfer progress.
* On incoming NOTIFY, notify application about callset transfer progress.
*/
else if (pjsip_evsub_get_state (sub) == PJSIP_EVSUB_STATE_ACTIVE ||
pjsip_evsub_get_state (sub) == PJSIP_EVSUB_STATE_TERMINATED) {
......
Supports Markdown
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