Skip to content
Snippets Groups Projects
Commit 61553b2b authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #18668: call: use pthread_mutex

parent 857cfd9d
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "manager.h" #include "manager.h"
#include "audio/mainbuffer.h" #include "audio/mainbuffer.h"
#include "history/historyitem.h" #include "history/historyitem.h"
#include "scoped_lock.h"
Call::Call(const std::string& id, Call::CallType type) Call::Call(const std::string& id, Call::CallType type)
: callMutex_() : callMutex_()
...@@ -49,37 +50,40 @@ Call::Call(const std::string& id, Call::CallType type) ...@@ -49,37 +50,40 @@ Call::Call(const std::string& id, Call::CallType type)
, timestamp_start_(0) , timestamp_start_(0)
, timestamp_stop_(0) , timestamp_stop_(0)
{ {
pthread_mutex_init(&callMutex_, NULL);
time(&timestamp_start_); time(&timestamp_start_);
} }
Call::~Call() Call::~Call()
{} {
pthread_mutex_destroy(&callMutex_);
}
void void
Call::setConnectionState(ConnectionState state) Call::setConnectionState(ConnectionState state)
{ {
ost::MutexLock m(callMutex_); sfl::ScopedLock m(callMutex_);
connectionState_ = state; connectionState_ = state;
} }
Call::ConnectionState Call::ConnectionState
Call::getConnectionState() Call::getConnectionState()
{ {
ost::MutexLock m(callMutex_); sfl::ScopedLock m(callMutex_);
return connectionState_; return connectionState_;
} }
void void
Call::setState(CallState state) Call::setState(CallState state)
{ {
ost::MutexLock m(callMutex_); sfl::ScopedLock m(callMutex_);
callState_ = state; callState_ = state;
} }
Call::CallState Call::CallState
Call::getState() Call::getState()
{ {
ost::MutexLock m(callMutex_); sfl::ScopedLock m(callMutex_);
return callState_; return callState_;
} }
...@@ -124,21 +128,21 @@ Call::getStateStr() ...@@ -124,21 +128,21 @@ Call::getStateStr()
std::string std::string
Call::getLocalIp() Call::getLocalIp()
{ {
ost::MutexLock m(callMutex_); sfl::ScopedLock m(callMutex_);
return localIPAddress_; return localIPAddress_;
} }
unsigned int unsigned int
Call::getLocalAudioPort() Call::getLocalAudioPort()
{ {
ost::MutexLock m(callMutex_); sfl::ScopedLock m(callMutex_);
return localAudioPort_; return localAudioPort_;
} }
unsigned int unsigned int
Call::getLocalVideoPort() Call::getLocalVideoPort()
{ {
ost::MutexLock m (callMutex_); sfl::ScopedLock m(callMutex_);
return localVideoPort_; return localVideoPort_;
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <sstream> #include <sstream>
#include <map> #include <map>
#include "cc_thread.h" #include <pthread.h>
#include "audio/recordable.h" #include "audio/recordable.h"
/* /*
...@@ -229,7 +229,7 @@ class Call : public Recordable { ...@@ -229,7 +229,7 @@ class Call : public Recordable {
private: private:
std::string getTypeStr() const; std::string getTypeStr() const;
/** Protect every attribute that can be changed by two threads */ /** Protect every attribute that can be changed by two threads */
ost::Mutex callMutex_; pthread_mutex_t callMutex_;
// Informations about call socket / audio // Informations about call socket / audio
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment