Commit df0a067a authored by Nicolas Jager's avatar Nicolas Jager

video : add video debug output to video.log

Change-Id: I266b8519aceba214803789a6b1f23876a974a1f8
Tuleap: #1226
parent e30847e6
......@@ -51,6 +51,9 @@ MainPage::MainPage()
{
InitializeComponent();
Window::Current->SizeChanged += ref new WindowSizeChangedEventHandler(this, &MainPage::OnResize);
_welcomeFrame_->Navigate(TypeName(RingClientUWP::Views::WelcomePage::typeid));
......@@ -73,11 +76,11 @@ MainPage::MainPage()
Platform::Object^>(this, &MainPage::DisplayProperties_DpiChanged));
visibilityChangedEventToken = Window::Current->VisibilityChanged +=
ref new WindowVisibilityChangedEventHandler(this, &MainPage::Application_VisibilityChanged);
ref new WindowVisibilityChangedEventHandler(this, &MainPage::Application_VisibilityChanged);
applicationSuspendingEventToken = Application::Current->Suspending +=
ref new SuspendingEventHandler(this, &MainPage::Application_Suspending);
ref new SuspendingEventHandler(this, &MainPage::Application_Suspending);
applicationResumingEventToken = Application::Current->Resuming +=
ref new EventHandler<Object^>(this, &MainPage::Application_Resuming);
ref new EventHandler<Object^>(this, &MainPage::Application_Resuming);
}
void
......@@ -123,6 +126,7 @@ RingClientUWP::MainPage::OnNavigatedTo(NavigationEventArgs ^ e)
{
RingD::instance->startDaemon();
showLoadingOverlay(true, false);
}
void
......@@ -263,27 +267,27 @@ void RingClientUWP::MainPage::OnstateChange(Platform::String ^callId, RingClient
void
MainPage::Application_Suspending(Object^, Windows::ApplicationModel::SuspendingEventArgs^ e)
{
WriteLine("Application_Suspending");
RingDebug::instance->WriteLine("Application_Suspending");
if (Frame->CurrentSourcePageType.Name ==
Interop::TypeName(MainPage::typeid).Name) {
auto deferral = e->SuspendingOperation->GetDeferral();
BeginExtendedExecution()
.then([=](task<void> previousTask) {
.then([=](task<void> previousTask) {
try {
previousTask.get();
}
catch (Exception^ e) {
WriteLine("Exception: Extended Execution Begin");
RingDebug::instance->WriteLine("Exception: Extended Execution Begin");
}
})
.then([this, deferral](task<void> previousTask) {
.then([this, deferral](task<void> previousTask) {
try {
previousTask.get();
WriteLine("deferral->Complete()");
RingDebug::instance->WriteLine("deferral->Complete()");
deferral->Complete();
}
catch (Exception^ e) {
WriteLine("Exception: Extended Execution");
RingDebug::instance->WriteLine("Exception: Extended Execution");
deferral->Complete();
}
});
......@@ -294,7 +298,7 @@ void
MainPage::Application_VisibilityChanged(Object^ sender, VisibilityChangedEventArgs^ e)
{
if (e->Visible) {
WriteLine("->Visible");
RingDebug::instance->WriteLine("->Visible");
auto isPreviewing = Video::VideoManager::instance->captureManager()->isPreviewing;
bool isInCall = false;
for (auto item : SmartPanelItemsViewModel::instance->itemsList) {
......@@ -311,7 +315,7 @@ MainPage::Application_VisibilityChanged(Object^ sender, VisibilityChangedEventAr
}
}
else {
WriteLine("->Invisible");
RingDebug::instance->WriteLine("->Invisible");
auto isPreviewing = Video::VideoManager::instance->captureManager()->isPreviewing;
bool isInCall = false;
for (auto item : SmartPanelItemsViewModel::instance->itemsList) {
......@@ -338,7 +342,7 @@ MainPage::Application_VisibilityChanged(Object^ sender, VisibilityChangedEventAr
void MainPage::Application_Resuming(Object^, Object^)
{
WriteLine("Application_Resuming");
RingDebug::instance->WriteLine("Application_Resuming");
}
void
......@@ -353,7 +357,7 @@ void
MainPage::ClearExtendedExecution()
{
if (session != nullptr) {
WriteLine("End Extended Execution");
RingDebug::instance->WriteLine("End Extended Execution");
session->Revoked -= sessionRevokedToken;
}
}
......@@ -367,31 +371,31 @@ MainPage::BeginExtendedExecution()
newSession->Reason = ExtendedExecutionReason::SavingData;
newSession->Description = "Extended Execution";
sessionRevokedToken = (newSession->Revoked += ref new TypedEventHandler<Object^,
ExtendedExecutionRevokedEventArgs^>(this, &MainPage::SessionRevoked));
ExtendedExecutionRevokedEventArgs^>(this, &MainPage::SessionRevoked));
return create_task(newSession->RequestExtensionAsync())
.then([=](ExtendedExecutionResult result){
.then([=](ExtendedExecutionResult result) {
try {
switch (result)
{
case ExtendedExecutionResult::Allowed:
session = newSession;
WriteLine("Request Extended Execution Allowed");
WriteLine("Clean up camera...");
RingDebug::instance->WriteLine("Request Extended Execution Allowed");
RingDebug::instance->WriteLine("Clean up camera...");
Video::VideoManager::instance->captureManager()->CleanupCameraAsync()
.then([](){
WriteLine("Hang up calls...");
.then([]() {
RingDebug::instance->WriteLine("Hang up calls...");
DRing::fini();
});
break;
default:
default:
case ExtendedExecutionResult::Denied:
WriteLine("Request Extended Execution Denied");
RingDebug::instance->WriteLine("Request Extended Execution Denied");
break;
}
}
catch (Exception^ e) {
WriteLine("Exception: Extended Execution Request");
RingDebug::instance->WriteLine("Exception: Extended Execution Request");
}
});
}
\ No newline at end of file
......@@ -56,7 +56,18 @@ RingDebug::print(const std::string& message,
/* fire the event. */
auto line = ref new String(wString.c_str(), wString.length());
messageToScreen(line);
FileIO::AppendTextAsync(_logFile, line+"\n");
FileIO::AppendTextAsync(_logFile, line + "\n");
}
void RingClientUWP::RingDebug::WriteLine(String^ str)
{
/* save in file */
FileIO::AppendTextAsync(_videoFile, str + "\n");
/* screen in visual studio console */
std::wstringstream wStringstream;
wStringstream << str->Data() << "\n";
OutputDebugString(wStringstream.str().c_str());
}
RingClientUWP::RingDebug::RingDebug()
......@@ -70,5 +81,10 @@ RingClientUWP::RingDebug::RingDebug()
this->_logFile = file;
});
task<StorageFile^>(storageFolder->CreateFileAsync("video.log", CreationCollisionOption::ReplaceExisting)).then([this](StorageFile^ file)
{
this->_videoFile = file;
});
}
......@@ -43,6 +43,7 @@ public:
}
property StorageFile^ _logFile;
property StorageFile^ _videoFile;
/* properties */
......@@ -51,6 +52,8 @@ internal:
enum class Type { MSG, WNG, ERR };
void print(const std::string& message, const Type& type = Type::MSG);
void WriteLine(String^ str);
/* event */
event debugMessageToScreen^ messageToScreen;
......
......@@ -145,7 +145,7 @@ Resolution::Resolution(Video::Size^ size):
String^
Resolution::name()
{
return size()->width().ToString() + "x" + size()->height().ToString();
return size()->width().ToString() + "x" + size()->height().ToString();
}
Rate^
......@@ -193,12 +193,12 @@ Resolution::setFormat(String^ format)
bool
Resolution::setActiveRate(Rate^ rate)
{
if (m_currentRate == rate)
return false;
if (m_currentRate == rate)
return false;
m_currentRate = rate;
// set camera device rate here
return true;
m_currentRate = rate;
// set camera device rate here
return true;
}
/************************************************************
......@@ -222,7 +222,7 @@ Device::id()
Vector<Channel^>^
Device::channelList()
{
return m_channels;
return m_channels;
}
String^
......@@ -261,7 +261,7 @@ bool
Device::isActive()
{
return false;
//return Video::DeviceModel::instance().activeDevice() == this;
//return Video::DeviceModel::instance().activeDevice() == this;
}
void
......@@ -270,12 +270,12 @@ Device::SetDeviceProperties(String^ format, int width, int height, int rate)
auto rl = m_currentChannel->resolutionList();
for (auto res : rl) {
if (res->format() == format &&
res->size()->width() == width &&
res->size()->height() == height &&
res->activeRate()->value() == rate)
res->size()->width() == width &&
res->size()->height() == height &&
res->activeRate()->value() == rate)
{
m_currentChannel->setCurrentResolution(res);
WriteLine("SetDeviceProperties");
RingDebug::instance->WriteLine("SetDeviceProperties");
return;
}
}
......
This diff is collapsed.
......@@ -73,12 +73,12 @@ VideoPage::VideoPage()
previousTask.get();
}
catch (Platform::Exception^ e) {
WriteLine( "Caught exception from previous task.\n" );
RingDebug::instance->WriteLine( "Caught exception from previous task.\n" );
}
});
}
catch(Platform::COMException^ e) {
WriteLine(e->ToString());
RingDebug::instance->WriteLine(e->ToString());
}
}));
});
......
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