Commit b029f416 authored by Ghislain MARY's avatar Ghislain MARY

Create ApiLock class and use it with explicit lock/unlock.

parent b998b224
......@@ -4,7 +4,25 @@ namespace Linphone
{
namespace Core
{
// A mutex used to protect objects accessible from the API surface exposed by this DLL
std::recursive_mutex g_apiLock;
// The global API lock
ApiLock gApiLock;
ApiLock::ApiLock()
{
}
ApiLock::~ApiLock()
{
}
void ApiLock::Lock()
{
mut.lock();
}
void ApiLock::Unlock()
{
mut.unlock();
}
}
}
......@@ -5,7 +5,22 @@ namespace Linphone
{
namespace Core
{
// A mutex used to protect objects accessible from the API surface exposed by this DLL
extern std::recursive_mutex g_apiLock;
/// <summary>
/// A class that implements a mutex mechanism to protect objects accessible from the API surface exposed by this DLL
/// </summary>
class ApiLock
{
public:
ApiLock();
~ApiLock();
void Lock();
void Unlock();
private:
std::recursive_mutex mut;
};
// The global API lock
extern ApiLock gApiLock;
}
}
......@@ -7,62 +7,66 @@ using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Phone::Networking::Voip;
VoipPhoneCall^ CallController::OnIncomingCallReceived(Linphone::Core::LinphoneCall^ call, Platform::String^ contactName, Platform::String^ contactNumber, IncomingCallViewDismissedCallback^ incomingCallViewDismissedCallback)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
VoipPhoneCall^ CallController::OnIncomingCallReceived(Linphone::Core::LinphoneCall^ call, Platform::String^ contactName, Platform::String^ contactNumber, IncomingCallViewDismissedCallback^ incomingCallViewDismissedCallback)
{
gApiLock.Lock();
VoipPhoneCall^ incomingCall = nullptr;
this->call = call;
try
{
TimeSpan ringingTimeout;
ringingTimeout.Duration = 90 * 10 * 1000 * 1000; // in 100ns units
try
{
TimeSpan ringingTimeout;
ringingTimeout.Duration = 90 * 10 * 1000 * 1000; // in 100ns units
if (incomingCallViewDismissedCallback != nullptr)
this->onIncomingCallViewDismissed = incomingCallViewDismissedCallback;
// Ask the Phone Service to start a new incoming call
// Ask the Phone Service to start a new incoming call
this->callCoordinator->RequestNewIncomingCall(
this->callInProgressPageUri + "?sip=" + contactNumber,
contactName,
contactNumber,
this->defaultContactImageUri,
this->voipServiceName,
this->linphoneImageUri,
this->callInProgressPageUri + "?sip=" + contactNumber,
contactName,
contactNumber,
this->defaultContactImageUri,
this->voipServiceName,
this->linphoneImageUri,
"",
this->ringtoneUri,
VoipCallMedia::Audio,
this->ringtoneUri,
VoipCallMedia::Audio,
ringingTimeout,
&incomingCall);
}
catch(...)
}
catch(...)
{
return nullptr;
}
incomingCall->AnswerRequested += this->acceptCallRequestedHandler;
incomingCall->RejectRequested += this->rejectCallRequestedHandler;
return incomingCall;
gApiLock.Unlock();
return nullptr;
}
incomingCall->AnswerRequested += this->acceptCallRequestedHandler;
incomingCall->RejectRequested += this->rejectCallRequestedHandler;
gApiLock.Unlock();
return incomingCall;
}
void CallController::OnAcceptCallRequested(VoipPhoneCall^ incomingCall, CallAnswerEventArgs^ args)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
void CallController::OnAcceptCallRequested(VoipPhoneCall^ incomingCall, CallAnswerEventArgs^ args)
{
gApiLock.Lock();
incomingCall->NotifyCallActive();
if (this->onIncomingCallViewDismissed != nullptr)
this->onIncomingCallViewDismissed();
if (this->call != nullptr)
Globals::Instance->LinphoneCore->AcceptCall(this->call);
gApiLock.Unlock();
}
void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallRejectEventArgs^ args)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallRejectEventArgs^ args)
{
gApiLock.Lock();
incomingCall->NotifyCallEnded();
......@@ -71,63 +75,69 @@ void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallReje
if (this->call != nullptr)
Globals::Instance->LinphoneCore->TerminateCall(this->call);
gApiLock.Unlock();
}
void CallController::EndCall(VoipPhoneCall^ call)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
call->NotifyCallEnded();
gApiLock.Unlock();
}
VoipPhoneCall^ CallController::NewOutgoingCall(Platform::String^ number)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
VoipPhoneCall^ outgoingCall = nullptr;
this->call = call;
this->callCoordinator->RequestNewOutgoingCall(
this->callInProgressPageUri + "?sip=" + number,
number,
this->voipServiceName,
this->callInProgressPageUri + "?sip=" + number,
number,
this->voipServiceName,
VoipCallMedia::Audio,
&outgoingCall);
outgoingCall->NotifyCallActive();
gApiLock.Unlock();
return outgoingCall;
}
IncomingCallViewDismissedCallback^ CallController::IncomingCallViewDismissed::get()
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
return this->onIncomingCallViewDismissed;
gApiLock.Lock();
IncomingCallViewDismissedCallback^ cb = this->onIncomingCallViewDismissed;
gApiLock.Unlock();
return cb;
}
void CallController::IncomingCallViewDismissed::set(IncomingCallViewDismissedCallback^ cb)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
this->onIncomingCallViewDismissed = cb;
gApiLock.Unlock();
}
CallController::CallController() :
callInProgressPageUri(L"/Views/InCall.xaml"),
voipServiceName(nullptr),
defaultContactImageUri(nullptr),
callInProgressPageUri(L"/Views/InCall.xaml"),
voipServiceName(nullptr),
defaultContactImageUri(nullptr),
linphoneImageUri(nullptr),
ringtoneUri(nullptr),
callCoordinator(VoipCallCoordinator::GetDefault())
{
// URIs required for interactions with the VoipCallCoordinator
String^ installFolder = String::Concat(Windows::ApplicationModel::Package::Current->InstalledLocation->Path, "\\");
this->defaultContactImageUri = ref new Uri(installFolder, "Assets\\unknown.png");
this->voipServiceName = ref new String(L"Linphone");
this->linphoneImageUri = ref new Uri(installFolder, "Assets\\pnicon.png");
// URIs required for interactions with the VoipCallCoordinator
String^ installFolder = String::Concat(Windows::ApplicationModel::Package::Current->InstalledLocation->Path, "\\");
this->defaultContactImageUri = ref new Uri(installFolder, "Assets\\unknown.png");
this->voipServiceName = ref new String(L"Linphone");
this->linphoneImageUri = ref new Uri(installFolder, "Assets\\pnicon.png");
this->ringtoneUri = ref new Uri(installFolder, "Assets\\Sounds\\Ringtone.wma");
this->acceptCallRequestedHandler = ref new TypedEventHandler<VoipPhoneCall^, CallAnswerEventArgs^>(this, &CallController::OnAcceptCallRequested);
this->rejectCallRequestedHandler = ref new TypedEventHandler<VoipPhoneCall^, CallRejectEventArgs^>(this, &CallController::OnRejectCallRequested);
this->acceptCallRequestedHandler = ref new TypedEventHandler<VoipPhoneCall^, CallAnswerEventArgs^>(this, &CallController::OnAcceptCallRequested);
this->rejectCallRequestedHandler = ref new TypedEventHandler<VoipPhoneCall^, CallRejectEventArgs^>(this, &CallController::OnRejectCallRequested);
}
CallController::~CallController()
......
......@@ -25,7 +25,7 @@ Globals^ Globals::singleton = nullptr;
void Globals::StartServer(const Platform::Array<Platform::String^>^ outOfProcServerClassNames)
{
// Make sure only one API call is in progress at a time
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
std::unique_ptr<PFNGETACTIVATIONFACTORY[]> activationFactoryCallbacks;
std::unique_ptr<HSTRING[]> hOutOfProcServerClassNames;
......@@ -38,6 +38,7 @@ void Globals::StartServer(const Platform::Array<Platform::String^>^ outOfProcSer
if (this->started)
{
gApiLock.Unlock();
return; // Nothing more to be done
}
......@@ -82,6 +83,7 @@ void Globals::StartServer(const Platform::Array<Platform::String^>^ outOfProcSer
}
this->started = true;
gApiLock.Unlock();
}
unsigned int Globals::GetCurrentProcessId()
......@@ -114,13 +116,15 @@ Globals^ Globals::Instance::get()
if (Globals::singleton == nullptr)
{
// Make sure only one API call is in progress at a time
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
if (Globals::singleton == nullptr)
{
Globals::singleton = ref new Globals();
}
// else: some other thread has created an instance of the call controller
gApiLock.Unlock();
}
return Globals::singleton;
......@@ -131,12 +135,14 @@ LinphoneCoreFactory^ Globals::LinphoneCoreFactory::get()
if (this->linphoneCoreFactory == nullptr)
{
// Make sure only one API call is in progress at a time
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
if (this->linphoneCoreFactory == nullptr)
{
this->linphoneCoreFactory = ref new Linphone::Core::LinphoneCoreFactory();
}
gApiLock.Unlock();
}
return this->linphoneCoreFactory;
......@@ -151,14 +157,16 @@ Linphone::Core::CallController^ Globals::CallController::get()
{
if (this->callController == nullptr)
{
// Make sure only one API call is in progress at a time
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
// Make sure only one API call is in progress at a time
gApiLock.Lock();
if (this->callController == nullptr)
{
this->callController = ref new Linphone::Core::CallController();
}
// else: some other thread has created an instance of the call controller
gApiLock.Unlock();
}
return this->callController;
......@@ -169,12 +177,14 @@ Linphone::Core::BackgroundModeLogger^ Globals::BackgroundModeLogger::get()
if (this->backgroundModeLogger == nullptr)
{
// Make sure only one API call is in progress at a time
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
if (this->backgroundModeLogger == nullptr)
{
this->backgroundModeLogger = ref new Linphone::Core::BackgroundModeLogger();
}
gApiLock.Unlock();
}
return this->backgroundModeLogger;
......
......@@ -4,76 +4,92 @@
Platform::String^ Linphone::Core::LinphoneAuthInfo::GetUsername()
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
return Utils::cctops(linphone_auth_info_get_username(this->auth_info));
gApiLock.Lock();
Platform::String^ username = Utils::cctops(linphone_auth_info_get_username(this->auth_info));
gApiLock.Unlock();
return username;
}
void Linphone::Core::LinphoneAuthInfo::SetUsername(Platform::String^ username)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
const char *cc = Linphone::Core::Utils::pstoccs(username);
linphone_auth_info_set_username(this->auth_info, cc);
delete(cc);
gApiLock.Unlock();
}
Platform::String^ Linphone::Core::LinphoneAuthInfo::GetUserId()
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
return Utils::cctops(linphone_auth_info_get_userid(this->auth_info));
gApiLock.Lock();
Platform::String^ userid = Utils::cctops(linphone_auth_info_get_userid(this->auth_info));
gApiLock.Unlock();
return userid;
}
void Linphone::Core::LinphoneAuthInfo::SetUserId(Platform::String^ userid)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
const char *cc = Linphone::Core::Utils::pstoccs(userid);
linphone_auth_info_set_userid(this->auth_info, cc);
delete(cc);
gApiLock.Unlock();
}
Platform::String^ Linphone::Core::LinphoneAuthInfo::GetPassword()
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
return Utils::cctops(linphone_auth_info_get_passwd(this->auth_info));
gApiLock.Lock();
Platform::String^ password = Utils::cctops(linphone_auth_info_get_passwd(this->auth_info));
gApiLock.Unlock();
return password;
}
void Linphone::Core::LinphoneAuthInfo::SetPassword(Platform::String^ password)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
const char *cc = Linphone::Core::Utils::pstoccs(password);
linphone_auth_info_set_passwd(this->auth_info, cc);
delete(cc);
gApiLock.Unlock();
}
Platform::String^ Linphone::Core::LinphoneAuthInfo::GetRealm()
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
return Utils::cctops(linphone_auth_info_get_realm(this->auth_info));
gApiLock.Lock();
Platform::String^ realm = Utils::cctops(linphone_auth_info_get_realm(this->auth_info));
gApiLock.Unlock();
return realm;
}
void Linphone::Core::LinphoneAuthInfo::SetRealm(Platform::String^ realm)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
const char *cc = Linphone::Core::Utils::pstoccs(realm);
linphone_auth_info_set_realm(this->auth_info, cc);
delete(cc);
gApiLock.Unlock();
}
Platform::String^ Linphone::Core::LinphoneAuthInfo::GetHa1()
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
return Utils::cctops(linphone_auth_info_get_ha1(this->auth_info));
gApiLock.Lock();
Platform::String^ ha1 = Utils::cctops(linphone_auth_info_get_ha1(this->auth_info));
gApiLock.Unlock();
return ha1;
}
void Linphone::Core::LinphoneAuthInfo::SetHa1(Platform::String^ ha1)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
const char *cc = Linphone::Core::Utils::pstoccs(ha1);
linphone_auth_info_set_ha1(this->auth_info, cc);
delete(cc);
gApiLock.Unlock();
}
Linphone::Core::LinphoneAuthInfo::LinphoneAuthInfo(Platform::String^ username, Platform::String^ userid, Platform::String^ password, Platform::String^ ha1, Platform::String^ realm)
{
gApiLock.Lock();
const char* cc_username = Utils::pstoccs(username);
const char* cc_password = Utils::pstoccs(password);
const char* cc_realm = Utils::pstoccs(realm);
......@@ -85,6 +101,7 @@ Linphone::Core::LinphoneAuthInfo::LinphoneAuthInfo(Platform::String^ username, P
delete(cc_password);
delete(cc_ha1);
delete(cc_realm);
gApiLock.Unlock();
}
Linphone::Core::LinphoneAuthInfo::LinphoneAuthInfo(::LinphoneAuthInfo *auth_info) :
......
......@@ -12,115 +12,171 @@ using namespace Windows::Phone::Networking::Voip;
Linphone::Core::LinphoneCallState Linphone::Core::LinphoneCall::GetState()
{
return (Linphone::Core::LinphoneCallState)linphone_call_get_state(this->call);
gApiLock.Lock();
Linphone::Core::LinphoneCallState state = (Linphone::Core::LinphoneCallState)linphone_call_get_state(this->call);
gApiLock.Unlock();
return state;
}
Linphone::Core::LinphoneAddress^ Linphone::Core::LinphoneCall::GetRemoteAddress()
{
gApiLock.Lock();
const ::LinphoneAddress *addr = linphone_call_get_remote_address(this->call);
Linphone::Core::LinphoneAddress^ address = (Linphone::Core::LinphoneAddress^)Linphone::Core::Utils::CreateLinphoneAddress((void*)addr);
gApiLock.Unlock();
return address;
}
Linphone::Core::CallDirection Linphone::Core::LinphoneCall::GetDirection()
{
return (Linphone::Core::CallDirection)linphone_call_get_dir(this->call);
gApiLock.Lock();
Linphone::Core::CallDirection direction = (Linphone::Core::CallDirection)linphone_call_get_dir(this->call);
gApiLock.Unlock();
return direction;
}
Linphone::Core::LinphoneCallLog^ Linphone::Core::LinphoneCall::GetCallLog()
{
return (Linphone::Core::LinphoneCallLog^) Linphone::Core::Utils::CreateLinphoneCallLog(linphone_call_get_call_log(this->call));
gApiLock.Lock();
Linphone::Core::LinphoneCallLog^ log = (Linphone::Core::LinphoneCallLog^) Linphone::Core::Utils::CreateLinphoneCallLog(linphone_call_get_call_log(this->call));
gApiLock.Unlock();
return log;
}
Linphone::Core::LinphoneCallStats^ Linphone::Core::LinphoneCall::GetAudioStats()
{
return (Linphone::Core::LinphoneCallStats^) Linphone::Core::Utils::CreateLinphoneCallStats((void*) linphone_call_get_audio_stats(this->call), this->call);
gApiLock.Lock();
Linphone::Core::LinphoneCallStats^ stats = (Linphone::Core::LinphoneCallStats^) Linphone::Core::Utils::CreateLinphoneCallStats((void*) linphone_call_get_audio_stats(this->call), this->call);
gApiLock.Unlock();
return stats;
}
Linphone::Core::LinphoneCallParams^ Linphone::Core::LinphoneCall::GetRemoteParams()
{
if (linphone_call_get_remote_params(this->call) == nullptr)
return nullptr;
return (Linphone::Core::LinphoneCallParams^) Linphone::Core::Utils::CreateLinphoneCallParams(linphone_call_params_copy(linphone_call_get_remote_params(this->call)));
gApiLock.Lock();
Linphone::Core::LinphoneCallParams^ params = nullptr;
if (linphone_call_get_remote_params(this->call) != nullptr) {
params = (Linphone::Core::LinphoneCallParams^) Linphone::Core::Utils::CreateLinphoneCallParams(linphone_call_params_copy(linphone_call_get_remote_params(this->call)));
}
gApiLock.Unlock();
return params;
}
Linphone::Core::LinphoneCallParams^ Linphone::Core::LinphoneCall::GetCurrentParamsCopy()
{
return (Linphone::Core::LinphoneCallParams^) Linphone::Core::Utils::CreateLinphoneCallParams(linphone_call_params_copy(linphone_call_get_current_params(this->call)));
gApiLock.Lock();
Linphone::Core::LinphoneCallParams^ params = (Linphone::Core::LinphoneCallParams^) Linphone::Core::Utils::CreateLinphoneCallParams(linphone_call_params_copy(linphone_call_get_current_params(this->call)));
gApiLock.Unlock();
return params;
}
void Linphone::Core::LinphoneCall::EnableEchoCancellation(Platform::Boolean enable)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
linphone_call_enable_echo_cancellation(this->call, enable);
gApiLock.Unlock();
}
Platform::Boolean Linphone::Core::LinphoneCall::IsEchoCancellationEnabled()
{
return linphone_call_echo_cancellation_enabled(this->call);
gApiLock.Lock();
Platform::Boolean enabled = linphone_call_echo_cancellation_enabled(this->call);
gApiLock.Unlock();
return enabled;
}
void Linphone::Core::LinphoneCall::EnableEchoLimiter(Platform::Boolean enable)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
linphone_call_enable_echo_limiter(this->call, enable);
gApiLock.Unlock();
}
Platform::Boolean Linphone::Core::LinphoneCall::IsEchoLimiterEnabled()
{
return linphone_call_echo_limiter_enabled(this->call);
gApiLock.Lock();
Platform::Boolean enabled = linphone_call_echo_limiter_enabled(this->call);
gApiLock.Unlock();
return enabled;
}
int Linphone::Core::LinphoneCall::GetDuration()
{
return linphone_call_get_duration(this->call);;
gApiLock.Lock();
int duration = linphone_call_get_duration(this->call);
gApiLock.Unlock();
return duration;
}
float Linphone::Core::LinphoneCall::GetCurrentQuality()
{
return linphone_call_get_current_quality(this->call);
gApiLock.Lock();
float quality = linphone_call_get_current_quality(this->call);
gApiLock.Unlock();
return quality;
}
float Linphone::Core::LinphoneCall::GetAverageQuality()
{
return linphone_call_get_average_quality(this->call);
gApiLock.Lock();
float quality = linphone_call_get_average_quality(this->call);
gApiLock.Unlock();
return quality;
}
Platform::String^ Linphone::Core::LinphoneCall::GetAuthenticationToken()
{
return Linphone::Core::Utils::cctops(linphone_call_get_authentication_token(this->call));
gApiLock.Lock();
Platform::String^ token = Linphone::Core::Utils::cctops(linphone_call_get_authentication_token(this->call));
gApiLock.Unlock();
return token;
}
Platform::Boolean Linphone::Core::LinphoneCall::IsAuthenticationTokenVerified()
{
return linphone_call_get_authentication_token_verified(this->call);
gApiLock.Lock();
Platform::Boolean verified = linphone_call_get_authentication_token_verified(this->call);
gApiLock.Unlock();
return verified;
}
void Linphone::Core::LinphoneCall::SetAuthenticationTokenVerified(Platform::Boolean verified)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
linphone_call_set_authentication_token_verified(this->call, verified);
gApiLock.Unlock();
}
Platform::Boolean Linphone::Core::LinphoneCall::IsInConference()
{
return linphone_call_is_in_conference(this->call);
gApiLock.Lock();
Platform::Boolean inConference = linphone_call_is_in_conference(this->call);
gApiLock.Unlock();
return inConference;
}
float Linphone::Core::LinphoneCall::GetPlayVolume()
{
return linphone_call_get_play_volume(this->call);
gApiLock.Lock();
float volume = linphone_call_get_play_volume(this->call);
gApiLock.Unlock();
return volume;
}
Platform::String^ Linphone::Core::LinphoneCall::GetRemoteUserAgent()
{
return Linphone::Core::Utils::cctops(linphone_call_get_remote_user_agent(this->call));
gApiLock.Lock();
Platform::String^ userAgent = Linphone::Core::Utils::cctops(linphone_call_get_remote_user_agent(this->call));
gApiLock.Unlock();
return userAgent;
}
Platform::String^ Linphone::Core::LinphoneCall::GetRemoteContact()
{
return Linphone::Core::Utils::cctops(linphone_call_get_remote_contact(this->call));
gApiLock.Lock();
Platform::String^ contact = Linphone::Core::Utils::cctops(linphone_call_get_remote_contact(this->call));
gApiLock.Unlock();
return contact;
}
void Linphone::Core::LinphoneCall::CallContext::set(Platform::Object^ cc)
......@@ -144,12 +200,16 @@ Platform::Object^ Linphone::Core::LinphoneCall::CallContext::get()
Linphone::Core::LinphoneCall::LinphoneCall(::LinphoneCall *call) :
call(call)
{
gApiLock.Lock();
RefToPtrProxy<LinphoneCall^> *proxy = new RefToPtrProxy<LinphoneCall^>(this);
linphone_call_set_user_pointer(this->call, proxy);
gApiLock.Unlock();
}
Linphone::Core::LinphoneCall::~LinphoneCall()
{
gApiLock.Lock();
RefToPtrProxy<LinphoneCall^> *proxy = reinterpret_cast< RefToPtrProxy<LinphoneCall^> *>(linphone_call_get_user_pointer(this->call));
delete proxy;
gApiLock.Unlock();
}
......@@ -5,35 +5,47 @@
void Linphone::Core::LinphoneCallParams::SetAudioBandwidth(int value)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
linphone_call_params_set_audio_bandwidth_limit(this->params, value);
gApiLock.Unlock();
}
Linphone::Core::MediaEncryption Linphone::Core::LinphoneCallParams::GetMediaEncryption()
{
return (Linphone::Core::MediaEncryption) linphone_call_params_get_media_encryption(this->params);
gApiLock.Lock();
Linphone::Core::MediaEncryption enc = (Linphone::Core::MediaEncryption) linphone_call_params_get_media_encryption(this->params);
gApiLock.Unlock();
return enc;
}
void Linphone::Core::LinphoneCallParams::SetMediaEncryption(Linphone::Core::MediaEncryption menc)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
linphone_call_params_set_media_encryption(this->params, (LinphoneMediaEncryption) menc);
gApiLock.Unlock();
}
Linphone::Core::PayloadType^ Linphone::Core::LinphoneCallParams::GetUsedAudioCodec()
{
return (Linphone::Core::PayloadType^) Linphone::Core::Utils::CreatePayloadType((void*) linphone_call_params_get_used_audio_codec(this->params));
gApiLock.Lock();
Linphone::Core::PayloadType^ payloadType = (Linphone::Core::PayloadType^) Linphone::Core::Utils::CreatePayloadType((void*) linphone_call_params_get_used_audio_codec(this->params));
gApiLock.Unlock();
return payloadType;
}
void Linphone::Core::LinphoneCallParams::EnableLowBandwidth(Platform::Boolean enable)
{
std::lock_guard<std::recursive_mutex> lock(g_apiLock);
gApiLock.Lock();
linphone_call_params_enable_low_bandwidth(this->params, enable);
gApiLock.Unlock();
}
Platform::Boolean Linphone::Core::LinphoneCallParams::IsLowBandwidthEnabled()
{
return linphone_call_params_low_bandwidth_enabled(this->params);
gApiLock.Lock();
Platform::Boolean enabled = linphone_call_params_low_bandwidth_enabled(this->params);
gApiLock.Unlock();
return enabled;
}
Linphone::Core::LinphoneCallParams::LinphoneCallParams(::LinphoneCallParams *call_params) :
......
This diff is collapsed.
......@@ -47,16 +47,19 @@ void LinphoneCoreFactory::CreateLinphoneCore(Linphone::Core::LinphoneCoreListene
void LinphoneCoreFactory::CreateLinphoneCore(Linphone::Core::LinphoneCoreListener^ listener, Linphone::Core::LpConfig^ config)