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 ...@@ -70,6 +70,7 @@ namespace Linphone.Agents
//Globals.Instance.LinphoneCoreFactory.OutputTraceListener = Globals.Instance.BackgroundModeLogger; //Globals.Instance.LinphoneCoreFactory.OutputTraceListener = Globals.Instance.BackgroundModeLogger;
OopServer.LinphoneCore.SetNetworkReachable(true); OopServer.LinphoneCore.SetNetworkReachable(true);
OopServer.LinphoneCore.IterateEnabled = true;
} }
} }
} }
...@@ -48,6 +48,7 @@ namespace Linphone.Agents ...@@ -48,6 +48,7 @@ namespace Linphone.Agents
server.LinphoneCore.SetRootCA("Assets/rootca.pem"); server.LinphoneCore.SetRootCA("Assets/rootca.pem");
server.LinphoneCore.SetNetworkReachable(true); server.LinphoneCore.SetNetworkReachable(true);
server.LinphoneCore.SetUserAgent("LinphoneWP8KeepAlive", ""); server.LinphoneCore.SetUserAgent("LinphoneWP8KeepAlive", "");
server.LinphoneCore.IterateEnabled = true;
Debug.WriteLine("[KeepAliveAgent] Linphone Core created"); Debug.WriteLine("[KeepAliveAgent] Linphone Core created");
} }
else else
......
...@@ -289,7 +289,7 @@ IVector<Object^>^ Linphone::Core::LinphoneCore::GetAuthInfos() ...@@ -289,7 +289,7 @@ IVector<Object^>^ Linphone::Core::LinphoneCore::GetAuthInfos()
void Linphone::Core::LinphoneCore::Destroy() void Linphone::Core::LinphoneCore::Destroy()
{ {
gApiLock.Lock(); gApiLock.Lock();
IterateTimer->Cancel(); IterateEnabled = false;
gApiLock.Unlock(); gApiLock.Unlock();
} }
...@@ -1560,10 +1560,44 @@ Linphone::Core::LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener) : ...@@ -1560,10 +1560,44 @@ Linphone::Core::LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener) :
Linphone::Core::LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener, LpConfig^ config) : Linphone::Core::LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener, LpConfig^ config) :
lc(nullptr), lc(nullptr),
listener(coreListener), 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() void Linphone::Core::LinphoneCore::Init()
{ {
LinphoneCoreVTable *vtable = (LinphoneCoreVTable*) malloc(sizeof(LinphoneCoreVTable)); LinphoneCoreVTable *vtable = (LinphoneCoreVTable*) malloc(sizeof(LinphoneCoreVTable));
...@@ -1584,20 +1618,6 @@ void Linphone::Core::LinphoneCore::Init() ...@@ -1584,20 +1618,6 @@ void Linphone::Core::LinphoneCore::Init()
linphone_core_set_ring(this->lc, nullptr); linphone_core_set_ring(this->lc, nullptr);
RefToPtrProxy<Mediastreamer2::WP8Video::IVideoRenderer^> *renderer = new RefToPtrProxy<Mediastreamer2::WP8Video::IVideoRenderer^>(Globals::Instance->VideoRenderer); 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); 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() Linphone::Core::LinphoneCore::~LinphoneCore()
......
...@@ -1032,6 +1032,16 @@ namespace Linphone ...@@ -1032,6 +1032,16 @@ namespace Linphone
void set(LinphoneCoreListener^ listener); 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: private:
friend ref class Linphone::Core::LinphoneCoreFactory; friend ref class Linphone::Core::LinphoneCoreFactory;
friend class Linphone::Core::Utils; friend class Linphone::Core::Utils;
...@@ -1045,6 +1055,7 @@ namespace Linphone ...@@ -1045,6 +1055,7 @@ namespace Linphone
LinphoneCoreListener^ listener; LinphoneCoreListener^ listener;
LpConfig^ config; LpConfig^ config;
Windows::System::Threading::ThreadPoolTimer ^IterateTimer; Windows::System::Threading::ThreadPoolTimer ^IterateTimer;
Platform::Boolean isIterateEnabled;
}; };
} }
} }
\ No newline at end of file
...@@ -299,6 +299,7 @@ namespace Linphone.Model ...@@ -299,6 +299,7 @@ namespace Linphone.Model
DeviceNetworkInformation.NetworkAvailabilityChanged += new EventHandler<NetworkNotificationEventArgs>(OnNetworkStatusChanged); DeviceNetworkInformation.NetworkAvailabilityChanged += new EventHandler<NetworkNotificationEventArgs>(OnNetworkStatusChanged);
ConfigureTunnel(); ConfigureTunnel();
server.LinphoneCore.IterateEnabled = true;
isLinphoneRunning = true; isLinphoneRunning = true;
} }
......
using Linphone.Core; using Linphone.Agents;
using Linphone.Core;
using Linphone.Model; using Linphone.Model;
using Linphone.Resources; using Linphone.Resources;
using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.GamerServices;
...@@ -209,21 +210,23 @@ namespace Linphone.Views ...@@ -209,21 +210,23 @@ namespace Linphone.Views
{ {
oneSecondTimer = new Timer(new TimerCallback(timerTick), null, 0, 1000); oneSecondTimer = new Timer(new TimerCallback(timerTick), null, 0, 1000);
if (call.IsCameraEnabled() && !((InCallModel)ViewModel).IsVideoActive) if (Customs.EnableVideo) {
{ if (call.IsCameraEnabled() && !((InCallModel)ViewModel).IsVideoActive)
// Show video if it was not shown yet {
((InCallModel)ViewModel).IsVideoActive = true; // Show video if it was not shown yet
video.IsChecked = true; ((InCallModel)ViewModel).IsVideoActive = true;
ButtonsFadeInVideoAnimation.Begin(); video.IsChecked = true;
StartFadeTimer(); ButtonsFadeInVideoAnimation.Begin();
} StartFadeTimer();
else if (!call.IsCameraEnabled() && ((InCallModel)ViewModel).IsVideoActive) }
{ else if (!call.IsCameraEnabled() && ((InCallModel)ViewModel).IsVideoActive)
// Stop video if it is no longer active {
((InCallModel)ViewModel).IsVideoActive = false; // Stop video if it is no longer active
video.IsChecked = false; ((InCallModel)ViewModel).IsVideoActive = false;
ButtonsFadeInAudioAnimation.Begin(); video.IsChecked = false;
StopFadeTimer(); ButtonsFadeInAudioAnimation.Begin();
StopFadeTimer();
}
} }
} }
else if (oneSecondTimer != null) else if (oneSecondTimer != null)
......
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