Commit 397203f9 authored by Sylvain Berfini's avatar Sylvain Berfini

Only start the iterate once the core is fully configured + minifix for the...

Only start the iterate once the core is fully configured + minifix for the opacity of the incall controls
parent 4f28a872
......@@ -70,6 +70,7 @@ namespace Linphone.Agents
//Globals.Instance.LinphoneCoreFactory.OutputTraceListener = Globals.Instance.BackgroundModeLogger;
OopServer.LinphoneCore.SetNetworkReachable(true);
OopServer.LinphoneCore.IterateEnabled = true;
}
}
}
......@@ -48,6 +48,7 @@ namespace Linphone.Agents
server.LinphoneCore.SetRootCA("Assets/rootca.pem");
server.LinphoneCore.SetNetworkReachable(true);
server.LinphoneCore.SetUserAgent("LinphoneWP8KeepAlive", "");
server.LinphoneCore.IterateEnabled = true;
Debug.WriteLine("[KeepAliveAgent] Linphone Core created");
}
else
......
......@@ -289,7 +289,7 @@ IVector<Object^>^ Linphone::Core::LinphoneCore::GetAuthInfos()
void Linphone::Core::LinphoneCore::Destroy()
{
gApiLock.Lock();
IterateTimer->Cancel();
IterateEnabled = false;
gApiLock.Unlock();
}
......@@ -1560,10 +1560,44 @@ Linphone::Core::LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener) :
Linphone::Core::LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener, LpConfig^ config) :
lc(nullptr),
listener(coreListener),
config(config)
config(config),
isIterateEnabled(false)
{
}
void Linphone::Core::LinphoneCore::IterateEnabled::set(Platform::Boolean value)
{
gApiLock.Lock();
if (isIterateEnabled && !value && IterateTimer)
{
// Disable the iterate
IterateTimer->Cancel();
}
else if (!isIterateEnabled && value)
{
// Enable the iterate
TimeSpan period;
period.Duration = 20 * 10000;
IterateTimer = ThreadPoolTimer::CreatePeriodicTimer(
ref new TimerElapsedHandler([this](ThreadPoolTimer^ source)
{
if (source == IterateTimer) {
if (gApiLock.TryLock()) {
linphone_core_iterate(this->lc);
gApiLock.Unlock();
}
}
}), period);
}
isIterateEnabled = value;
gApiLock.Unlock();
}
Platform::Boolean Linphone::Core::LinphoneCore::IterateEnabled::get()
{
return isIterateEnabled;
}
void Linphone::Core::LinphoneCore::Init()
{
LinphoneCoreVTable *vtable = (LinphoneCoreVTable*) malloc(sizeof(LinphoneCoreVTable));
......@@ -1584,20 +1618,6 @@ void Linphone::Core::LinphoneCore::Init()
linphone_core_set_ring(this->lc, nullptr);
RefToPtrProxy<Mediastreamer2::WP8Video::IVideoRenderer^> *renderer = new RefToPtrProxy<Mediastreamer2::WP8Video::IVideoRenderer^>(Globals::Instance->VideoRenderer);
linphone_core_set_native_video_window_id(this->lc, (unsigned long)renderer);
// Launch iterate timer
TimeSpan period;
period.Duration = 20 * 10000;
IterateTimer = ThreadPoolTimer::CreatePeriodicTimer(
ref new TimerElapsedHandler([this](ThreadPoolTimer^ source)
{
if (source == IterateTimer) {
if (gApiLock.TryLock()) {
linphone_core_iterate(this->lc);
gApiLock.Unlock();
}
}
}), period);
}
Linphone::Core::LinphoneCore::~LinphoneCore()
......
......@@ -1032,6 +1032,16 @@ namespace Linphone
void set(LinphoneCoreListener^ listener);
}
/// <summary>
/// Set it to true to start the iterate, set it to false to stop it.
/// Is disabled by default.
/// </summary>
property Platform::Boolean IterateEnabled
{
Platform::Boolean get();
void set(Platform::Boolean value);
}
private:
friend ref class Linphone::Core::LinphoneCoreFactory;
friend class Linphone::Core::Utils;
......@@ -1045,6 +1055,7 @@ namespace Linphone
LinphoneCoreListener^ listener;
LpConfig^ config;
Windows::System::Threading::ThreadPoolTimer ^IterateTimer;
Platform::Boolean isIterateEnabled;
};
}
}
\ No newline at end of file
......@@ -299,6 +299,7 @@ namespace Linphone.Model
DeviceNetworkInformation.NetworkAvailabilityChanged += new EventHandler<NetworkNotificationEventArgs>(OnNetworkStatusChanged);
ConfigureTunnel();
server.LinphoneCore.IterateEnabled = true;
isLinphoneRunning = true;
}
......
using Linphone.Core;
using Linphone.Agents;
using Linphone.Core;
using Linphone.Model;
using Linphone.Resources;
using Microsoft.Xna.Framework.GamerServices;
......@@ -209,6 +210,7 @@ namespace Linphone.Views
{
oneSecondTimer = new Timer(new TimerCallback(timerTick), null, 0, 1000);
if (Customs.EnableVideo) {
if (call.IsCameraEnabled() && !((InCallModel)ViewModel).IsVideoActive)
{
// Show video if it was not shown yet
......@@ -226,6 +228,7 @@ namespace Linphone.Views
StopFadeTimer();
}
}
}
else if (oneSecondTimer != null)
{
oneSecondTimer.Dispose();
......
Markdown is supported
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