Commit 4ee9a302 authored by Ghislain MARY's avatar Ghislain MARY

Refactor ApiLock so that there is no need for a manual unlock.

parent e80aa34f
#include "ApiLock.h"
// Do not treat doxygen documentation as XML
#pragma warning(push)
#pragma warning(disable : 4635)
#include "belle-sip/object.h"
#pragma warning(pop)
#include <mutex>
#include "mediastreamer2/mscommon.h"
namespace Linphone
{
namespace Core
{
// The global API lock
ApiLock gApiLock;
GlobalApiLock *GlobalApiLock::instance = nullptr;
GlobalApiLock::GlobalApiLock() : count(0), pool(nullptr)
{}
GlobalApiLock::~GlobalApiLock()
{}
class ApiLockPrivate
GlobalApiLock * GlobalApiLock::Instance()
{
public:
ApiLockPrivate() : count(0), pool(nullptr)
{
if (instance == nullptr) {
instance = new GlobalApiLock();
}
~ApiLockPrivate()
{
}
std::recursive_mutex mut;
int count;
belle_sip_object_pool_t *pool;
};
return instance;
}
ApiLock::ApiLock() : d(new ApiLockPrivate())
void GlobalApiLock::Lock()
{
mut.lock();
if (count == 0) {
pool = belle_sip_object_pool_push();
}
count++;
}
ApiLock::~ApiLock()
void GlobalApiLock::Unlock()
{
delete d;
count--;
if ((count == 0) && (pool != nullptr)) {
belle_sip_object_unref(pool);
pool = nullptr;
}
mut.unlock();
}
void ApiLock::Lock()
bool GlobalApiLock::TryLock()
{
d->mut.lock();
if (d->count == 0) {
d->pool = belle_sip_object_pool_push();
bool ok = mut.try_lock();
if (ok) {
if (count == 0) {
pool = belle_sip_object_pool_push();
}
count++;
}
d->count++;
return ok;
}
void ApiLock::Unlock()
ApiLock::ApiLock(const char *function)
{
d->count--;
if ((d->count == 0) && (d->pool != nullptr)) {
belle_sip_object_unref(d->pool);
d->pool = nullptr;
#ifdef TRACE_LOCKS
if (function != NULL) {
this->function = ms_strdup(function);
}
d->mut.unlock();
char *s = ms_strdup_printf("### Locking in %s [%ul] at %ul\r\n", this->function, WIN_thread_self(), (unsigned long)ortp_get_cur_time_ms());
OutputDebugStringA(s);
ms_free(s);
#endif
GlobalApiLock::Instance()->Lock();
}
bool ApiLock::TryLock()
ApiLock::~ApiLock()
{
bool ok = d->mut.try_lock();
if (ok) {
if (d->count == 0) {
d->pool = belle_sip_object_pool_push();
}
d->count++;
#ifdef TRACE_LOCKS
char *s = ms_strdup_printf("### Unlocking in %s [%ul] at %ul\r\n", this->function, WIN_thread_self(), (unsigned long)ortp_get_cur_time_ms());
OutputDebugStringA(s);
ms_free(s);
if (this->function != NULL) {
ms_free(this->function);
}
return ok;
#endif
GlobalApiLock::Instance()->Unlock();
}
}
}
#pragma once
// Do not treat doxygen documentation as XML
#pragma warning(push)
#pragma warning(disable : 4635)
#include "belle-sip/object.h"
#pragma warning(pop)
#include <mutex>
#include "Utils.h"
#ifdef TRACE_LOCKS
#define API_LOCK \
{ \
char *s = ms_strdup_printf("### Locking in %s [%ul] at %ul\r\n", __FUNCTION__, WIN_thread_self(), (unsigned long)ortp_get_cur_time_ms()); \
OutputDebugStringA(s); \
ms_free(s); \
} \
Linphone::Core::gApiLock.Lock()
#define API_UNLOCK \
{ \
char *s = ms_strdup_printf("### Unlocking in %s [%ul] at %ul\r\n", __FUNCTION__, WIN_thread_self(), (unsigned long)ortp_get_cur_time_ms()); \
OutputDebugStringA(s); \
ms_free(s); \
} \
Linphone::Core::gApiLock.Unlock()
#else
#define API_LOCK Linphone::Core::gApiLock.Lock()
#define API_UNLOCK Linphone::Core::gApiLock.Unlock()
#endif
#define API_LOCK ApiLock apiLock(__FUNCTION__)
namespace Linphone
{
namespace Core
{
class ApiLockPrivate;
class GlobalApiLock
{
public:
static GlobalApiLock * Instance();
void Lock();
void Unlock();
bool TryLock();
private:
GlobalApiLock();
~GlobalApiLock();
static GlobalApiLock *instance;
std::recursive_mutex mut;
int count;
belle_sip_object_pool_t *pool;
};
/// <summary>
/// A class that implements a mutex mechanism to protect objects accessible from the API surface exposed by this DLL
......@@ -36,17 +42,11 @@ namespace Linphone
class ApiLock
{
public:
ApiLock();
ApiLock(const char *function);
~ApiLock();
void Lock();
void Unlock();
bool TryLock();
private:
ApiLockPrivate *d;
char *function;
};
// The global API lock
extern ApiLock gApiLock;
}
}
......@@ -56,7 +56,6 @@ VoipPhoneCall^ CallController::OnIncomingCallReceived(Linphone::Core::LinphoneCa
&incomingCall);
}
catch(...) {
API_UNLOCK;
return nullptr;
}
......@@ -67,7 +66,6 @@ VoipPhoneCall^ CallController::OnIncomingCallReceived(Linphone::Core::LinphoneCa
// StreamsRunning state by calling NewIncomingCallForCustomIncomingCallView()
}
API_UNLOCK;
return incomingCall;
}
......@@ -95,8 +93,6 @@ void CallController::OnAcceptCallRequested(VoipPhoneCall^ incomingCall, CallAnsw
Globals::Instance->LinphoneCore->AcceptCall(this->call);
#endif
}
API_UNLOCK;
}
void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallRejectEventArgs^ args)
......@@ -111,8 +107,6 @@ void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallReje
//This will call notifyCallEnded on the call state changed callback
if (this->call != nullptr)
Globals::Instance->LinphoneCore->DeclineCall(this->call, this->declineReason);
API_UNLOCK;
}
VoipPhoneCall^ CallController::NewOutgoingCall(Platform::String^ number)
......@@ -138,8 +132,6 @@ VoipPhoneCall^ CallController::NewOutgoingCall(Platform::String^ number)
&outgoingCall);
outgoingCall->NotifyCallActive();
API_UNLOCK;
return outgoingCall;
}
......@@ -169,46 +161,37 @@ void CallController::NotifyMute(bool isMuted)
IncomingCallViewDismissedCallback^ CallController::IncomingCallViewDismissed::get()
{
API_LOCK;
IncomingCallViewDismissedCallback^ cb = this->onIncomingCallViewDismissed;
API_UNLOCK;
return cb;
return this->onIncomingCallViewDismissed;
}
void CallController::IncomingCallViewDismissed::set(IncomingCallViewDismissedCallback^ cb)
{
API_LOCK;
this->onIncomingCallViewDismissed = cb;
API_UNLOCK;
}
Platform::Boolean CallController::CustomIncomingCallView::get()
{
API_LOCK;
Platform::Boolean value = this->customIncomingCallView;
API_UNLOCK;
return value;
return this->customIncomingCallView;
}
void CallController::CustomIncomingCallView::set(Platform::Boolean value)
{
API_LOCK;
this->customIncomingCallView = value;
API_UNLOCK;
}
Reason CallController::DeclineReason::get()
{
API_LOCK;
Linphone::Core::Reason value = this->declineReason;
API_UNLOCK;
return value;
return this->declineReason;
}
void CallController::DeclineReason::set(Linphone::Core::Reason value)
{
API_LOCK;
this->declineReason = value;
API_UNLOCK;
}
CallController::CallController() :
......
......@@ -38,7 +38,6 @@ void Globals::StartServer(const Platform::Array<Platform::String^>^ outOfProcSer
if (this->started)
{
API_UNLOCK;
return; // Nothing more to be done
}
......@@ -83,7 +82,6 @@ void Globals::StartServer(const Platform::Array<Platform::String^>^ outOfProcSer
}
this->started = true;
API_UNLOCK;
}
unsigned int Globals::GetCurrentProcessId()
......@@ -123,8 +121,6 @@ Globals^ Globals::Instance::get()
Globals::singleton = ref new Globals();
}
// else: some other thread has created an instance of the call controller
API_UNLOCK;
}
return Globals::singleton;
......@@ -141,8 +137,6 @@ LinphoneCoreFactory^ Globals::LinphoneCoreFactory::get()
{
this->linphoneCoreFactory = ref new Linphone::Core::LinphoneCoreFactory();
}
API_UNLOCK;
}
return this->linphoneCoreFactory;
......@@ -165,8 +159,6 @@ Linphone::Core::CallController^ Globals::CallController::get()
this->callController = ref new Linphone::Core::CallController();
}
// else: some other thread has created an instance of the call controller
API_UNLOCK;
}
return this->callController;
......@@ -183,8 +175,6 @@ Linphone::Core::BackgroundModeLogger^ Globals::BackgroundModeLogger::get()
{
this->backgroundModeLogger = ref new Linphone::Core::BackgroundModeLogger();
}
API_UNLOCK;
}
return this->backgroundModeLogger;
......@@ -199,7 +189,6 @@ void Globals::VideoRenderer::set(Mediastreamer2::WP8Video::IVideoRenderer^ value
{
API_LOCK;
this->videoRenderer = value;
API_UNLOCK;
}
Globals::Globals() :
......
......@@ -5,9 +5,7 @@
Platform::String^ Linphone::Core::LinphoneAuthInfo::GetUsername()
{
API_LOCK;
Platform::String^ username = Utils::cctops(linphone_auth_info_get_username(this->auth_info));
API_UNLOCK;
return username;
return Utils::cctops(linphone_auth_info_get_username(this->auth_info));
}
void Linphone::Core::LinphoneAuthInfo::SetUsername(Platform::String^ username)
......@@ -16,15 +14,12 @@ void Linphone::Core::LinphoneAuthInfo::SetUsername(Platform::String^ username)
const char *cc = Linphone::Core::Utils::pstoccs(username);
linphone_auth_info_set_username(this->auth_info, cc);
delete(cc);
API_UNLOCK;
}
Platform::String^ Linphone::Core::LinphoneAuthInfo::GetUserId()
{
API_LOCK;
Platform::String^ userid = Utils::cctops(linphone_auth_info_get_userid(this->auth_info));
API_UNLOCK;
return userid;
return Utils::cctops(linphone_auth_info_get_userid(this->auth_info));
}
void Linphone::Core::LinphoneAuthInfo::SetUserId(Platform::String^ userid)
......@@ -33,15 +28,12 @@ void Linphone::Core::LinphoneAuthInfo::SetUserId(Platform::String^ userid)
const char *cc = Linphone::Core::Utils::pstoccs(userid);
linphone_auth_info_set_userid(this->auth_info, cc);
delete(cc);
API_UNLOCK;
}
Platform::String^ Linphone::Core::LinphoneAuthInfo::GetPassword()
{
API_LOCK;
Platform::String^ password = Utils::cctops(linphone_auth_info_get_passwd(this->auth_info));
API_UNLOCK;
return password;
return Utils::cctops(linphone_auth_info_get_passwd(this->auth_info));
}
void Linphone::Core::LinphoneAuthInfo::SetPassword(Platform::String^ password)
......@@ -50,15 +42,12 @@ void Linphone::Core::LinphoneAuthInfo::SetPassword(Platform::String^ password)
const char *cc = Linphone::Core::Utils::pstoccs(password);
linphone_auth_info_set_passwd(this->auth_info, cc);
delete(cc);
API_UNLOCK;
}
Platform::String^ Linphone::Core::LinphoneAuthInfo::GetRealm()
{
API_LOCK;
Platform::String^ realm = Utils::cctops(linphone_auth_info_get_realm(this->auth_info));
API_UNLOCK;
return realm;
return Utils::cctops(linphone_auth_info_get_realm(this->auth_info));
}
void Linphone::Core::LinphoneAuthInfo::SetRealm(Platform::String^ realm)
......@@ -67,15 +56,12 @@ void Linphone::Core::LinphoneAuthInfo::SetRealm(Platform::String^ realm)
const char *cc = Linphone::Core::Utils::pstoccs(realm);
linphone_auth_info_set_realm(this->auth_info, cc);
delete(cc);
API_UNLOCK;
}
Platform::String^ Linphone::Core::LinphoneAuthInfo::GetHa1()
{
API_LOCK;
Platform::String^ ha1 = Utils::cctops(linphone_auth_info_get_ha1(this->auth_info));
API_UNLOCK;
return ha1;
return Utils::cctops(linphone_auth_info_get_ha1(this->auth_info));
}
void Linphone::Core::LinphoneAuthInfo::SetHa1(Platform::String^ ha1)
......@@ -84,7 +70,6 @@ void Linphone::Core::LinphoneAuthInfo::SetHa1(Platform::String^ ha1)
const char *cc = Linphone::Core::Utils::pstoccs(ha1);
linphone_auth_info_set_ha1(this->auth_info, cc);
delete(cc);
API_UNLOCK;
}
Linphone::Core::LinphoneAuthInfo::LinphoneAuthInfo(Platform::String^ username, Platform::String^ userid, Platform::String^ password, Platform::String^ ha1, Platform::String^ realm, Platform::String^ domain)
......@@ -103,16 +88,13 @@ Linphone::Core::LinphoneAuthInfo::LinphoneAuthInfo(Platform::String^ username, P
delete(cc_ha1);
delete(cc_realm);
delete(cc_domain);
API_UNLOCK;
}
Linphone::Core::LinphoneAuthInfo::LinphoneAuthInfo(::LinphoneAuthInfo *auth_info) :
auth_info(auth_info)
{
}
Linphone::Core::LinphoneAuthInfo::~LinphoneAuthInfo()
{
}
\ No newline at end of file
......@@ -13,42 +13,32 @@ using namespace Windows::Phone::Networking::Voip;
Linphone::Core::LinphoneCallState Linphone::Core::LinphoneCall::GetState()
{
API_LOCK;
Linphone::Core::LinphoneCallState state = (Linphone::Core::LinphoneCallState)linphone_call_get_state(this->call);
API_UNLOCK;
return state;
return (Linphone::Core::LinphoneCallState)linphone_call_get_state(this->call);
}
Linphone::Core::LinphoneAddress^ Linphone::Core::LinphoneCall::GetRemoteAddress()
{
API_LOCK;
const ::LinphoneAddress *addr = linphone_call_get_remote_address(this->call);
Linphone::Core::LinphoneAddress^ address = (Linphone::Core::LinphoneAddress^)Linphone::Core::Utils::CreateLinphoneAddress((void*)addr);
API_UNLOCK;
return address;
return (Linphone::Core::LinphoneAddress^)Linphone::Core::Utils::CreateLinphoneAddress((void*)addr);
}
Linphone::Core::CallDirection Linphone::Core::LinphoneCall::GetDirection()
{
API_LOCK;
Linphone::Core::CallDirection direction = (Linphone::Core::CallDirection)linphone_call_get_dir(this->call);
API_UNLOCK;
return direction;
return (Linphone::Core::CallDirection)linphone_call_get_dir(this->call);
}
Linphone::Core::LinphoneCallLog^ Linphone::Core::LinphoneCall::GetCallLog()
{
API_LOCK;
Linphone::Core::LinphoneCallLog^ log = (Linphone::Core::LinphoneCallLog^) Linphone::Core::Utils::CreateLinphoneCallLog(linphone_call_get_call_log(this->call));
API_UNLOCK;
return log;
return (Linphone::Core::LinphoneCallLog^) Linphone::Core::Utils::CreateLinphoneCallLog(linphone_call_get_call_log(this->call));
}
Linphone::Core::LinphoneCallStats^ Linphone::Core::LinphoneCall::GetAudioStats()
{
API_LOCK;
Linphone::Core::LinphoneCallStats^ stats = (Linphone::Core::LinphoneCallStats^) Linphone::Core::Utils::CreateLinphoneCallStats(this->call, (int)Linphone::Core::MediaType::Audio);
API_UNLOCK;
return stats;
return (Linphone::Core::LinphoneCallStats^) Linphone::Core::Utils::CreateLinphoneCallStats(this->call, (int)Linphone::Core::MediaType::Audio);
}
Linphone::Core::LinphoneCallParams^ Linphone::Core::LinphoneCall::GetRemoteParams()
......@@ -58,125 +48,97 @@ Linphone::Core::LinphoneCallParams^ Linphone::Core::LinphoneCall::GetRemoteParam
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)));
}
API_UNLOCK;
return params;
}
Linphone::Core::LinphoneCallParams^ Linphone::Core::LinphoneCall::GetCurrentParamsCopy()
{
API_LOCK;
Linphone::Core::LinphoneCallParams^ params = (Linphone::Core::LinphoneCallParams^) Linphone::Core::Utils::CreateLinphoneCallParams(linphone_call_params_copy(linphone_call_get_current_params(this->call)));
API_UNLOCK;
return params;
return (Linphone::Core::LinphoneCallParams^) Linphone::Core::Utils::CreateLinphoneCallParams(linphone_call_params_copy(linphone_call_get_current_params(this->call)));
}
void Linphone::Core::LinphoneCall::EnableEchoCancellation(Platform::Boolean enable)
{
API_LOCK;
linphone_call_enable_echo_cancellation(this->call, enable);
API_UNLOCK;
}
Platform::Boolean Linphone::Core::LinphoneCall::IsEchoCancellationEnabled()
{
API_LOCK;
Platform::Boolean enabled = (linphone_call_echo_cancellation_enabled(this->call) == TRUE);
API_UNLOCK;
return enabled;
return (linphone_call_echo_cancellation_enabled(this->call) == TRUE);
}
void Linphone::Core::LinphoneCall::EnableEchoLimiter(Platform::Boolean enable)
{
API_LOCK;
linphone_call_enable_echo_limiter(this->call, enable);
API_UNLOCK;
}
Platform::Boolean Linphone::Core::LinphoneCall::IsEchoLimiterEnabled()
{
API_LOCK;
Platform::Boolean enabled = (linphone_call_echo_limiter_enabled(this->call) == TRUE);
API_UNLOCK;
return enabled;
return (linphone_call_echo_limiter_enabled(this->call) == TRUE);
}
int Linphone::Core::LinphoneCall::GetDuration()
{
API_LOCK;
int duration = linphone_call_get_duration(this->call);
API_UNLOCK;
return duration;
return linphone_call_get_duration(this->call);
}
float Linphone::Core::LinphoneCall::GetCurrentQuality()
{
API_LOCK;
float quality = linphone_call_get_current_quality(this->call);
API_UNLOCK;
return quality;
return linphone_call_get_current_quality(this->call);
}
float Linphone::Core::LinphoneCall::GetAverageQuality()
{
API_LOCK;
float quality = linphone_call_get_average_quality(this->call);
API_UNLOCK;
return quality;
return linphone_call_get_average_quality(this->call);
}
Platform::String^ Linphone::Core::LinphoneCall::GetAuthenticationToken()
{
API_LOCK;
Platform::String^ token = Linphone::Core::Utils::cctops(linphone_call_get_authentication_token(this->call));
API_UNLOCK;
return token;
return Linphone::Core::Utils::cctops(linphone_call_get_authentication_token(this->call));
}
Platform::Boolean Linphone::Core::LinphoneCall::IsAuthenticationTokenVerified()
{
API_LOCK;
Platform::Boolean verified = (linphone_call_get_authentication_token_verified(this->call) == TRUE);
API_UNLOCK;
return verified;
return (linphone_call_get_authentication_token_verified(this->call) == TRUE);
}
void Linphone::Core::LinphoneCall::SetAuthenticationTokenVerified(Platform::Boolean verified)
{
API_LOCK;
linphone_call_set_authentication_token_verified(this->call, verified);
API_UNLOCK;
}
Platform::Boolean Linphone::Core::LinphoneCall::IsInConference()
{
API_LOCK;
Platform::Boolean inConference = (linphone_call_is_in_conference(this->call) == TRUE);
API_UNLOCK;
return inConference;
return (linphone_call_is_in_conference(this->call) == TRUE);
}
float Linphone::Core::LinphoneCall::GetPlayVolume()
{
API_LOCK;
float volume = linphone_call_get_play_volume(this->call);
API_UNLOCK;
return volume;
return linphone_call_get_play_volume(this->call);
}
Platform::String^ Linphone::Core::LinphoneCall::GetRemoteUserAgent()
{
API_LOCK;
Platform::String^ userAgent = Linphone::Core::Utils::cctops(linphone_call_get_remote_user_agent(this->call));
API_UNLOCK;
return userAgent;
return Linphone::Core::Utils::cctops(linphone_call_get_remote_user_agent(this->call));
}
Platform::String^ Linphone::Core::LinphoneCall::GetRemoteContact()
{
API_LOCK;
Platform::String^ contact = Linphone::Core::Utils::cctops(linphone_call_get_remote_contact(this->call));
API_UNLOCK;
return contact;
return Linphone::Core::Utils::cctops(linphone_call_get_remote_contact(this->call));
}
void Linphone::Core::LinphoneCall::CallContext::set(Windows::Phone::Networking::Voip::VoipPhoneCall^ cc)
......@@ -201,31 +163,25 @@ Platform::Object^ Linphone::Core::LinphoneCall::GetCallStartTimeFromContext()
Platform::Boolean Linphone::Core::LinphoneCall::IsCameraEnabled()
{
API_LOCK;
Platform::Boolean enabled = (linphone_call_camera_enabled(this->call) == TRUE);
API_UNLOCK;
return enabled;
return (linphone_call_camera_enabled(this->call) == TRUE);
}
void Linphone::Core::LinphoneCall::EnableCamera(Platform::Boolean enable)
{
API_LOCK;
linphone_call_enable_camera(this->call, enable);
API_UNLOCK;
}
Linphone::Core::LinphoneCallStats^ Linphone::Core::LinphoneCall::GetVideoStats()
{
API_LOCK;
Linphone::Core::LinphoneCallStats^ stats = (Linphone::Core::LinphoneCallStats^) Linphone::Core::Utils::CreateLinphoneCallStats(this->call, (int)Linphone::Core::MediaType::Video);
API_UNLOCK;
return stats;
return (Linphone::Core::LinphoneCallStats^) Linphone::Core::Utils::CreateLinphoneCallStats(this->call, (int)Linphone::Core::MediaType::Video);
}
void Linphone::Core::LinphoneCall::SendVFURequest()
{
API_LOCK;
linphone_call_send_vfu_request(this->call);
API_UNLOCK;
}
Windows::Phone::Networking::Voip::VoipPhoneCall^ Linphone::Core::LinphoneCall::CallContext::get()
......@@ -244,7 +200,6 @@ Linphone::Core::LinphoneCall::LinphoneCall(::LinphoneCall *call) :
API_LOCK;
RefToPtrProxy<LinphoneCall^> *proxy = new RefToPtrProxy<LinphoneCall^>(this);
linphone_call_set_user_data(this->call, proxy);
API_UNLOCK;
}
Linphone::Core::LinphoneCall::~LinphoneCall()
......@@ -253,5 +208,4 @@ Linphone::Core::LinphoneCall::~LinphoneCall()
linphone_call_unref(call);
RefToPtrProxy<LinphoneCall^> *proxy = reinterpret_cast< RefToPtrProxy<LinphoneCall^> *>(linphone_call_get_user_data(this->call));
delete proxy;
API_UNLOCK;
}
......@@ -7,14 +7,12 @@ void Linphone::Core::LinphoneCallParams::SetAudioBandwidth(int value)
{
API_LOCK;
linphone_call_params_set_audio_bandwidth_limit(this->params, value);
API_UNLOCK;
}
Linphone::Core::MediaEncryption Linphone::Core::LinphoneCallParams::GetMediaEncryption()
{
API_LOCK;
Linphone::Core::MediaEncryption enc = (Linphone::Core::MediaEncryption) linphone_call_params_get_media_encryption(this->params);
API_UNLOCK;
return enc;
}
......@@ -22,7 +20,6 @@ void Linphone::Core::LinphoneCallParams::SetMediaEncryption(Linphone::Core::Medi
{
API_LOCK;
linphone_call_params_set_media_encryption(this->params, (LinphoneMediaEncryption) menc);
API_UNLOCK;
}
Linphone::Core::PayloadType^ Linphone::Core::LinphoneCallParams::GetUsedAudioCodec()
......@@ -33,7 +30,6 @@ Linphone::Core::PayloadType^ Linphone::Core::LinphoneCallParams::GetUsedAudioCod
if (pt != nullptr) {
payloadType = (Linphone::Core::PayloadType^) Linphone::Core::Utils::CreatePayloadType((void*)pt);
}
API_UNLOCK;
return payloadType;
}
......@@ -41,30 +37,24 @@ void Linphone::Core::LinphoneCallParams::EnableLowBandwidth(Platform::Boolean en
{
API_LOCK;
linphone_call_params_enable_low_bandwidth(this->params, enable);
API_UNLOCK;
}
Platform::Boolean Linphone::Core::LinphoneCallParams::IsLowBandwidthEnabled()
{
API_LOCK;
Platform::Boolean enabled = (linphone_call_params_low_bandwidth_enabled(this->params) == TRUE);
API_UNLOCK;
return enabled;
return (linphone_call_params_low_bandwidth_enabled(this->params) == TRUE);
}
Platform::Boolean Linphone::Core::LinphoneCallParams::VideoEnabled::get()
{
API_LOCK;
Platform::Boolean enabled = (linphone_call_params_video_enabled(this->params) == TRUE);
API_UNLOCK;
return enabled;
return (linphone_call_params_video_enabled(this->params) == TRUE);
}