Commit 85848246 authored by Tristan Matthews's avatar Tristan Matthews

* #6592: removed typedef std::string CallID

parent 1c8d3eaf
......@@ -64,7 +64,7 @@ int AudioLayer::putUrgent (void* buffer, int toCopy)
return 0;
}
int AudioLayer::putMain (void *buffer, int toCopy, CallID call_id)
int AudioLayer::putMain (void *buffer, int toCopy, std::string call_id)
{
int a;
......
......@@ -144,7 +144,7 @@ class AudioLayer
* @param toCopy The size of the buffer
* @return int The number of bytes copied
*/
int putMain (void* buffer, int toCopy, CallID call_id = default_id);
int putMain (void* buffer, int toCopy, std::string call_id = default_id);
void flushMain (void);
......
......@@ -36,8 +36,6 @@
#include "global.h"
typedef std::string CallID;
class AudioRecord
{
......
......@@ -225,7 +225,7 @@ class AudioRtpRecordHandler
private:
CallID& _id;
std::string& _id;
EchoSuppress echoCanceller;
......
......@@ -67,7 +67,7 @@ void MainBuffer::setInternalSamplingRate (int sr)
}
}
CallIDSet* MainBuffer::getCallIDSet (CallID call_id)
CallIDSet* MainBuffer::getCallIDSet (std::string call_id)
{
CallIDMap::iterator iter = _callIDMap.find (call_id);
......@@ -79,18 +79,18 @@ CallIDSet* MainBuffer::getCallIDSet (CallID call_id)
}
bool MainBuffer::createCallIDSet (CallID set_id)
bool MainBuffer::createCallIDSet (std::string set_id)
{
CallIDSet* newCallIDSet = new CallIDSet;
_callIDMap.insert (std::pair<CallID, CallIDSet*> (set_id, newCallIDSet));
_callIDMap.insert (std::pair<std::string, CallIDSet*> (set_id, newCallIDSet));
return true;
}
bool MainBuffer::removeCallIDSet (CallID set_id)
bool MainBuffer::removeCallIDSet (std::string set_id)
{
......@@ -112,13 +112,13 @@ bool MainBuffer::removeCallIDSet (CallID set_id)
}
void MainBuffer::addCallIDtoSet (CallID set_id, CallID call_id)
void MainBuffer::addCallIDtoSet (std::string set_id, std::string call_id)
{
CallIDSet* callid_set = getCallIDSet (set_id);
callid_set->insert (call_id);
}
void MainBuffer::removeCallIDfromSet (CallID set_id, CallID call_id)
void MainBuffer::removeCallIDfromSet (std::string set_id, std::string call_id)
{
CallIDSet* callid_set = getCallIDSet (set_id);
......@@ -133,7 +133,7 @@ void MainBuffer::removeCallIDfromSet (CallID set_id, CallID call_id)
}
RingBuffer* MainBuffer::getRingBuffer (CallID call_id)
RingBuffer* MainBuffer::getRingBuffer (std::string call_id)
{
RingBufferMap::iterator iter = _ringBufferMap.find (call_id);
......@@ -145,17 +145,17 @@ RingBuffer* MainBuffer::getRingBuffer (CallID call_id)
}
RingBuffer* MainBuffer::createRingBuffer (CallID call_id)
RingBuffer* MainBuffer::createRingBuffer (std::string call_id)
{
RingBuffer* newRingBuffer = new RingBuffer (SIZEBUF, call_id);
_ringBufferMap.insert (std::pair<CallID, RingBuffer*> (call_id, newRingBuffer));
_ringBufferMap.insert (std::pair<std::string, RingBuffer*> (call_id, newRingBuffer));
return newRingBuffer;
}
bool MainBuffer::removeRingBuffer (CallID call_id)
bool MainBuffer::removeRingBuffer (std::string call_id)
{
RingBuffer* ring_buffer = getRingBuffer (call_id);
......@@ -174,7 +174,7 @@ bool MainBuffer::removeRingBuffer (CallID call_id)
}
void MainBuffer::bindCallID (CallID call_id1, CallID call_id2)
void MainBuffer::bindCallID (std::string call_id1, std::string call_id2)
{
ost::MutexLock guard (_mutex);
......@@ -203,7 +203,7 @@ void MainBuffer::bindCallID (CallID call_id1, CallID call_id2)
}
void MainBuffer::bindHalfDuplexOut (CallID process_id, CallID call_id)
void MainBuffer::bindHalfDuplexOut (std::string process_id, std::string call_id)
{
ost::MutexLock guard (_mutex);
......@@ -221,7 +221,7 @@ void MainBuffer::bindHalfDuplexOut (CallID process_id, CallID call_id)
}
void MainBuffer::unBindCallID (CallID call_id1, CallID call_id2)
void MainBuffer::unBindCallID (std::string call_id1, std::string call_id2)
{
ost::MutexLock guard (_mutex);
......@@ -254,7 +254,7 @@ void MainBuffer::unBindCallID (CallID call_id1, CallID call_id2)
}
}
void MainBuffer::unBindHalfDuplexOut (CallID process_id, CallID call_id)
void MainBuffer::unBindHalfDuplexOut (std::string process_id, std::string call_id)
{
ost::MutexLock guard (_mutex);
......@@ -285,7 +285,7 @@ void MainBuffer::unBindHalfDuplexOut (CallID process_id, CallID call_id)
}
void MainBuffer::unBindAll (CallID call_id)
void MainBuffer::unBindAll (std::string call_id)
{
CallIDSet* callid_set = getCallIDSet (call_id);
......@@ -300,7 +300,7 @@ void MainBuffer::unBindAll (CallID call_id)
CallIDSet::iterator iter_set = temp_set.begin();
while (iter_set != temp_set.end()) {
CallID call_id_in_set = *iter_set;
std::string call_id_in_set = *iter_set;
unBindCallID (call_id, call_id_in_set);
iter_set++;
......@@ -309,7 +309,7 @@ void MainBuffer::unBindAll (CallID call_id)
}
void MainBuffer::unBindAllHalfDuplexOut (CallID process_id)
void MainBuffer::unBindAllHalfDuplexOut (std::string process_id)
{
CallIDSet* callid_set = getCallIDSet (process_id);
......@@ -324,7 +324,7 @@ void MainBuffer::unBindAllHalfDuplexOut (CallID process_id)
CallIDSet::iterator iter_set = temp_set.begin();
while (iter_set != temp_set.end()) {
CallID call_id_in_set = *iter_set;
std::string call_id_in_set = *iter_set;
unBindCallID (process_id, call_id_in_set);
iter_set++;
......@@ -332,7 +332,7 @@ void MainBuffer::unBindAllHalfDuplexOut (CallID process_id)
}
int MainBuffer::putData (void *buffer, int toCopy, unsigned short volume, CallID call_id)
int MainBuffer::putData (void *buffer, int toCopy, unsigned short volume, std::string call_id)
{
ost::MutexLock guard (_mutex);
......@@ -357,7 +357,7 @@ int MainBuffer::putData (void *buffer, int toCopy, unsigned short volume, CallID
}
int MainBuffer::availForPut (CallID call_id)
int MainBuffer::availForPut (std::string call_id)
{
ost::MutexLock guard (_mutex);
......@@ -372,7 +372,7 @@ int MainBuffer::availForPut (CallID call_id)
}
int MainBuffer::getData (void *buffer, int toCopy, unsigned short volume, CallID call_id)
int MainBuffer::getData (void *buffer, int toCopy, unsigned short volume, std::string call_id)
{
ost::MutexLock guard (_mutex);
......@@ -407,7 +407,7 @@ int MainBuffer::getData (void *buffer, int toCopy, unsigned short volume, CallID
memset (mixBuffer, 0, toCopy);
size = getDataByID (mixBuffer, toCopy, volume, (CallID) (*iter_id), call_id);
size = getDataByID (mixBuffer, toCopy, volume, (std::string) (*iter_id), call_id);
if (size > 0) {
for (int k = 0; k < nbSmplToCopy; k++) {
......@@ -423,7 +423,7 @@ int MainBuffer::getData (void *buffer, int toCopy, unsigned short volume, CallID
}
int MainBuffer::getDataByID (void *buffer, int toCopy, unsigned short volume, CallID call_id, CallID reader_id)
int MainBuffer::getDataByID (void *buffer, int toCopy, unsigned short volume, std::string call_id, std::string reader_id)
{
RingBuffer* ring_buffer = getRingBuffer (call_id);
......@@ -435,7 +435,7 @@ int MainBuffer::getDataByID (void *buffer, int toCopy, unsigned short volume, Ca
}
int MainBuffer::availForGet (CallID call_id)
int MainBuffer::availForGet (std::string call_id)
{
ost::MutexLock guard (_mutex);
......@@ -478,7 +478,7 @@ int MainBuffer::availForGet (CallID call_id)
}
int MainBuffer::availForGetByID (CallID call_id, CallID reader_id)
int MainBuffer::availForGetByID (std::string call_id, std::string reader_id)
{
if ( (call_id != default_id) && (reader_id == call_id)) {
_error ("MainBuffer: Error: RingBuffer has a readpointer on tiself");
......@@ -495,7 +495,7 @@ int MainBuffer::availForGetByID (CallID call_id, CallID reader_id)
}
int MainBuffer::discard (int toDiscard, CallID call_id)
int MainBuffer::discard (int toDiscard, std::string call_id)
{
ost::MutexLock guard (_mutex);
......@@ -528,7 +528,7 @@ int MainBuffer::discard (int toDiscard, CallID call_id)
}
int MainBuffer::discardByID (int toDiscard, CallID call_id, CallID reader_id)
int MainBuffer::discardByID (int toDiscard, std::string call_id, std::string reader_id)
{
RingBuffer* ringbuffer = getRingBuffer (call_id);
......@@ -541,7 +541,7 @@ int MainBuffer::discardByID (int toDiscard, CallID call_id, CallID reader_id)
void MainBuffer::flush (CallID call_id)
void MainBuffer::flush (std::string call_id)
{
ost::MutexLock guard (_mutex);
......@@ -575,7 +575,7 @@ void MainBuffer::flushDefault()
}
void MainBuffer::flushByID (CallID call_id, CallID reader_id)
void MainBuffer::flushByID (std::string call_id, std::string reader_id)
{
RingBuffer* ringbuffer = getRingBuffer (call_id);
......@@ -596,7 +596,7 @@ void MainBuffer::flushAllBuffers()
}
}
void MainBuffer:: syncBuffers (CallID call_id)
void MainBuffer:: syncBuffers (std::string call_id)
{
CallIDSet* callid_set = getCallIDSet (call_id);
......
......@@ -41,11 +41,11 @@
#include "call.h"
#include "ringbuffer.h"
typedef std::map<CallID, RingBuffer*> RingBufferMap;
typedef std::map<std::string, RingBuffer*> RingBufferMap;
typedef std::set<CallID> CallIDSet;
typedef std::set<std::string> CallIDSet;
typedef std::map<CallID, CallIDSet*> CallIDMap;
typedef std::map<std::string, CallIDSet*> CallIDMap;
class MainBuffer
{
......@@ -66,80 +66,80 @@ class MainBuffer
* Bind together two audio streams so taht a client will be able
* to put and get data specifying its callid only.
*/
void bindCallID (CallID call_id1, CallID call_id2 = default_id);
void bindCallID (std::string call_id1, std::string call_id2 = default_id);
/**
* Add a new call_id to unidirectional outgoing stream
* \param call_id New call id to be added for this stream
* \param process_id Process that require this stream
*/
void bindHalfDuplexOut (CallID process_id, CallID call_id = default_id);
void bindHalfDuplexOut (std::string process_id, std::string call_id = default_id);
/**
* Unbind two calls
*/
void unBindCallID (CallID call_id1, CallID call_id2 = default_id);
void unBindCallID (std::string call_id1, std::string call_id2 = default_id);
/**
* Unbind a unidirectional stream
*/
void unBindHalfDuplexOut (CallID process_id, CallID call_id = default_id);
void unBindHalfDuplexOut (std::string process_id, std::string call_id = default_id);
void unBindAll (CallID call_id);
void unBindAll (std::string call_id);
void unBindAllHalfDuplexOut (CallID process_id);
void unBindAllHalfDuplexOut (std::string process_id);
int putData (void *buffer, int toCopy, unsigned short volume = 100, CallID call_id = default_id);
int putData (void *buffer, int toCopy, unsigned short volume = 100, std::string call_id = default_id);
int getData (void *buffer, int toCopy, unsigned short volume = 100, CallID call_id = default_id);
int getData (void *buffer, int toCopy, unsigned short volume = 100, std::string call_id = default_id);
int availForPut (CallID call_id = default_id);
int availForPut (std::string call_id = default_id);
int availForGet (CallID call_id = default_id);
int availForGet (std::string call_id = default_id);
int discard (int toDiscard, CallID call_id = default_id);
int discard (int toDiscard, std::string call_id = default_id);
void flush (CallID call_id = default_id);
void flush (std::string call_id = default_id);
void flushAllBuffers();
void flushDefault();
void syncBuffers (CallID call_id);
void syncBuffers (std::string call_id);
void stateInfo();
private:
CallIDSet* getCallIDSet (CallID call_id);
CallIDSet* getCallIDSet (std::string call_id);
bool createCallIDSet (CallID set_id);
bool createCallIDSet (std::string set_id);
bool removeCallIDSet (CallID set_id);
bool removeCallIDSet (std::string set_id);
/**
* Add a new call id to this set
*/
void addCallIDtoSet (CallID set_id, CallID call_id);
void addCallIDtoSet (std::string set_id, std::string call_id);
void removeCallIDfromSet (CallID set_id, CallID call_id);
void removeCallIDfromSet (std::string set_id, std::string call_id);
/**
* Create a new ringbuffer with default readpointer
*/
RingBuffer* createRingBuffer (CallID call_id);
RingBuffer* createRingBuffer (std::string call_id);
bool removeRingBuffer (CallID call_id);
bool removeRingBuffer (std::string call_id);
RingBuffer* getRingBuffer (CallID call_id);
RingBuffer* getRingBuffer (std::string call_id);
int getDataByID (void *buffer, int toCopy, unsigned short volume, CallID call_id, CallID reader_id);
int getDataByID (void *buffer, int toCopy, unsigned short volume, std::string call_id, std::string reader_id);
int availForGetByID (CallID call_id, CallID reader_id);
int availForGetByID (std::string call_id, std::string reader_id);
int discardByID (int toDiscard, CallID call_id, CallID reader_id);
int discardByID (int toDiscard, std::string call_id, std::string reader_id);
void flushByID (CallID call_id, CallID reader_id);
void flushByID (std::string call_id, std::string reader_id);
RingBufferMap _ringBufferMap;
......
......@@ -86,7 +86,7 @@ class Recordable
* Virtual method to be implemented in order to the main
* buffer to retreive the recorded id.
*/
virtual std::string getRecFileId() = 0;
virtual std::string getRecFileId() const = 0;
/**
* An instance of audio recorder
......
......@@ -46,7 +46,7 @@
int RingBuffer::count_rb = 0;
// Create a ring buffer with 'size' bytes
RingBuffer::RingBuffer (int size, CallID call_id) : mEnd (0)
RingBuffer::RingBuffer (int size, std::string call_id) : mEnd (0)
, mBufferSize (size > MIN_BUFFER_SIZE ? size : MIN_BUFFER_SIZE)
, mBuffer (NULL)
, buffer_id (call_id)
......@@ -65,7 +65,7 @@ RingBuffer::~RingBuffer()
}
void
RingBuffer::flush (CallID call_id)
RingBuffer::flush (std::string call_id)
{
storeReadPointer (mEnd, call_id);
......@@ -104,7 +104,7 @@ RingBuffer::putLen()
}
int
RingBuffer::getLen (CallID call_id)
RingBuffer::getLen (std::string call_id)
{
int mStart = getReadPointer (call_id);
......@@ -126,7 +126,7 @@ RingBuffer::debug()
}
int
RingBuffer::getReadPointer (CallID call_id)
RingBuffer::getReadPointer (std::string call_id)
{
if (getNbReadPointer() == 0)
......@@ -163,7 +163,7 @@ RingBuffer::getSmallestReadPointer()
}
void
RingBuffer::storeReadPointer (int pointer_value, CallID call_id)
RingBuffer::storeReadPointer (int pointer_value, std::string call_id)
{
ReadPointer::iterator iter = _readpointer.find (call_id);
......@@ -178,16 +178,16 @@ RingBuffer::storeReadPointer (int pointer_value, CallID call_id)
void
RingBuffer::createReadPointer (CallID call_id)
RingBuffer::createReadPointer (std::string call_id)
{
if (!hasThisReadPointer (call_id))
_readpointer.insert (std::pair<CallID, int> (call_id, mEnd));
_readpointer.insert (std::pair<std::string, int> (call_id, mEnd));
}
void
RingBuffer::removeReadPointer (CallID call_id)
RingBuffer::removeReadPointer (std::string call_id)
{
ReadPointer::iterator iter = _readpointer.find (call_id);
......@@ -197,7 +197,7 @@ RingBuffer::removeReadPointer (CallID call_id)
bool
RingBuffer::hasThisReadPointer (CallID call_id)
RingBuffer::hasThisReadPointer (std::string call_id)
{
ReadPointer::iterator iter = _readpointer.find (call_id);
......@@ -292,7 +292,7 @@ RingBuffer::Put (void* buffer, int toCopy, unsigned short volume)
//
int
RingBuffer::AvailForGet (CallID call_id)
RingBuffer::AvailForGet (std::string call_id)
{
// Used space
......@@ -301,7 +301,7 @@ RingBuffer::AvailForGet (CallID call_id)
// Get will move 'toCopy' bytes from the internal FIFO to 'buffer'
int
RingBuffer::Get (void *buffer, int toCopy, unsigned short volume, CallID call_id)
RingBuffer::Get (void *buffer, int toCopy, unsigned short volume, std::string call_id)
{
if (getNbReadPointer() == 0)
......@@ -364,7 +364,7 @@ RingBuffer::Get (void *buffer, int toCopy, unsigned short volume, CallID call_id
// Used to discard some bytes.
int
RingBuffer::Discard (int toDiscard, CallID call_id)
RingBuffer::Discard (int toDiscard, std::string call_id)
{
int len = getLen (call_id);
......
......@@ -29,9 +29,9 @@
typedef unsigned char* samplePtr;
typedef std::map<CallID, int> ReadPointer;
typedef std::map<std::string, int> ReadPointer;
static CallID default_id = "audiolayer_id";
static std::string default_id = "audiolayer_id";
class RingBuffer
{
......@@ -40,28 +40,28 @@ class RingBuffer
* Constructor
* @param size Size of the buffer to create
*/
RingBuffer (int size, CallID call_id = default_id);
RingBuffer (int size, std::string call_id = default_id);
/**
* Destructor
*/
~RingBuffer();
CallID getBufferId() {
std::string getBufferId() {
return buffer_id;
}
/**
* Reset the counters to 0 for this read pointer
*/
void flush (CallID call_id = default_id);
void flush (std::string call_id = default_id);
void flushAll();
/**
* Get read pointer coresponding to this call
*/
int getReadPointer (CallID call_id = default_id);
int getReadPointer (std::string call_id = default_id);
/**
* Get the whole readpointer list for this ringbuffer
......@@ -78,22 +78,22 @@ class RingBuffer
/**
* Move readpointer forward by pointer_value
*/
void storeReadPointer (int pointer_value, CallID call_id = default_id);
void storeReadPointer (int pointer_value, std::string call_id = default_id);
/**
* Add a new readpointer for this ringbuffer
*/
void createReadPointer (CallID call_id = default_id);
void createReadPointer (std::string call_id = default_id);
/**
* Remove a readpointer for this ringbuffer
*/
void removeReadPointer (CallID call_id = default_id);
void removeReadPointer (std::string call_id = default_id);
/**
* Test if readpointer coresponding to this call is still active
*/
bool hasThisReadPointer (CallID call_id);
bool hasThisReadPointer (std::string call_id);
int getNbReadPointer();
......@@ -116,7 +116,7 @@ class RingBuffer
* To get how much space is available in the buffer to read in
* @return int The available size
*/
int AvailForGet (CallID call_id = default_id);
int AvailForGet (std::string call_id = default_id);
/**
* Get data in the ring buffer
......@@ -125,14 +125,14 @@ class RingBuffer
* @param volume The volume
* @return int Number of bytes copied
*/
int Get (void* buffer, int toCopy, unsigned short volume = 100, CallID call_id = default_id);
int Get (void* buffer, int toCopy, unsigned short volume = 100, std::string call_id = default_id);
/**
* Discard data from the buffer
* @param toDiscard Number of bytes to discard
* @return int Number of bytes discarded
*/
int Discard (int toDiscard, CallID call_id = default_id);
int Discard (int toDiscard, std::string call_id = default_id);
/**
* Total length of the ring buffer
......@@ -140,7 +140,7 @@ class RingBuffer
*/
int putLen();
int getLen (CallID call_id = default_id);
int getLen (std::string call_id = default_id);
/**
* Debug function print mEnd, mStart, mBufferSize
......@@ -165,7 +165,7 @@ class RingBuffer
ReadPointer _readpointer;
CallID buffer_id;
std::string buffer_id;
public:
......
......@@ -32,7 +32,7 @@
#include "manager.h"
#include "audio/mainbuffer.h"
Call::Call (const CallID& id, Call::CallType type)
Call::Call (const std::string& id, Call::CallType type)
: _callMutex()
, _localIPAddress ("")
, _localAudioPort (0)
......@@ -162,7 +162,7 @@ Call::setRecording()
_debug ("Call: Call not recording yet, set ringbuffers");
MainBuffer *mbuffer = Manager::instance().getMainBuffer();
CallID process_id = Recordable::recorder.getRecorderID();
std::string process_id = Recordable::recorder.getRecorderID();
mbuffer->bindHalfDuplexOut (process_id, _id);
mbuffer->bindHalfDuplexOut (process_id);
......@@ -175,7 +175,7 @@ Call::setRecording()
_debug ("Call: Stop recording");
MainBuffer *mbuffer = Manager::instance().getMainBuffer();
CallID process_id = Recordable::recorder.getRecorderID();
std::string process_id = Recordable::recorder.getRecorderID();
mbuffer->unBindHalfDuplexOut (process_id, _id);
mbuffer->unBindHalfDuplexOut (process_id);
......
......@@ -47,8 +47,6 @@
* @brief A call is the base class for protocol-based calls
*/
typedef std::string CallID;
class Call: public Recordable
{
public:
......@@ -84,14 +82,14 @@ class Call: public Recordable
* @param id Unique identifier of the call
* @param type set definitely this call as incoming/outgoing
*/
Call (const CallID& id, Call::CallType type);
Call (const std::string& id, Call::CallType type);
virtual ~Call();
/**
* Return a reference on the call id
* @return call id
*/
CallID& getCallId() {
std::string& getCallId() {
return _id;
}
......@@ -99,11 +97,11 @@ class Call: public Recordable
* Return a reference on the conference id
* @return call id
*/
const CallID& getConfId() const {
const std::string& getConfId() const {
return _confID;
}
void setConfId (CallID id) {
void setConfId (std::string id) {
_confID = id;
}
......@@ -236,7 +234,7 @@ class Call: public Recordable
*/
unsigned int getLocalAudioPort();
std::string getRecFileId (void) {
std::string getRecFileId (void) const {
return getPeerName();
}
......@@ -259,10 +257,10 @@ class Call: public Recordable
unsigned int _localAudioPort;
/** Unique ID of the call */
CallID _id;
std::string _id;
/** Unique conference ID, used exclusively in case of a conferece */
CallID _confID;
std::string _confID;
/** Type of the call */
CallType _type;
......
......@@ -71,7 +71,7 @@ void Conference::setState (ConferenceState state)