Commit 40afd723 authored by atraczyk's avatar atraczyk Committed by Andreas Traczyk
Browse files

video: better video frame copying

- uses memcpy instead of nested for loops to copy video buffers,
  as no operations are done per pixel, this gives a reduced copy
  time.

Change-Id: I43567997313d6aa8c9a0f8a56ccf0b8e6bcf963a
Tuleap: #790
parent de3b02ee
...@@ -72,18 +72,13 @@ ...@@ -72,18 +72,13 @@
VerticalScrollBarVisibility="Hidden"> VerticalScrollBarVisibility="Hidden">
<StackPanel MaxWidth="500" <StackPanel MaxWidth="500"
Width="310"> Width="310">
<TextBlock Text="Ring v1.1.15.0_x64" <TextBlock Text="Ring version: 2016/12/29"
TextWrapping="Wrap" TextWrapping="Wrap"
TextAlignment="Justify" TextAlignment="Justify"
Margin="0,0,0,24" Margin="0,0,0,24"
FontSize="12" FontSize="12"
FontWeight="Bold" FontWeight="Bold"
HorizontalAlignment="Center"/> HorizontalAlignment="Center"/>
<TextBlock Text="version: 2016/12/14"
TextWrapping="Wrap"
TextAlignment="Justify"
FontSize="12"
HorizontalAlignment="Center"/>
<TextBlock Text="Release: Beta 2 - Gaston Miron" <TextBlock Text="Release: Beta 2 - Gaston Miron"
TextWrapping="Wrap" TextWrapping="Wrap"
TextAlignment="Justify" TextAlignment="Justify"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap uap3 mp"> <Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" IgnorableNamespaces="uap uap3 mp">
<Identity Name="Savoir-faireLinux.GNURing" Publisher="CN=8121A5F7-3CA1-4CAA-92B2-4F595B011941" Version="1.1.15.0" /> <Identity Name="Savoir-faireLinux.GNURing" Publisher="CN=8121A5F7-3CA1-4CAA-92B2-4F595B011941" Version="1.1.20.0" />
<mp:PhoneIdentity PhoneProductId="2385953f-9019-423d-aa82-d1bbacfa258b" PhonePublisherId="00000000-0000-0000-0000-000000000000" /> <mp:PhoneIdentity PhoneProductId="2385953f-9019-423d-aa82-d1bbacfa258b" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties> <Properties>
<DisplayName>GNU Ring</DisplayName> <DisplayName>GNU Ring</DisplayName>
......
...@@ -947,6 +947,7 @@ RingD::RingD() ...@@ -947,6 +947,7 @@ RingD::RingD()
localFolder_ = Utils::toString(ApplicationData::Current->LocalFolder->Path); localFolder_ = Utils::toString(ApplicationData::Current->LocalFolder->Path);
callIdsList_ = ref new Vector<String^>(); callIdsList_ = ref new Vector<String^>();
currentCallId = nullptr; currentCallId = nullptr;
WriteLine("XBOX: " + isOnXBox.ToString());
} }
std::string std::string
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <dring.h> #include <dring.h>
#include "Ringtone.h" #include "Ringtone.h"
#include "Utils.h"
using namespace concurrency; using namespace concurrency;
...@@ -89,6 +90,16 @@ public: ...@@ -89,6 +90,16 @@ public:
} }
} }
property bool isOnXBox
{
bool get()
{
auto dev = Utils::toString(Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily);
std::transform(dev.begin(), dev.end(), dev.begin(), ::tolower);
return !dev.compare("windows.xbox");
}
}
property bool isInBackground; property bool isInBackground;
property StartingStatus _startingStatus; property StartingStatus _startingStatus;
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "SmartPanel.xaml.h" #include "SmartPanel.xaml.h"
#include <MemoryBuffer.h> // IMemoryBufferByteAccess #include <MemoryBuffer.h> // IMemoryBufferByteAccess
#include <algorithm>
#include <chrono>
using namespace RingClientUWP; using namespace RingClientUWP;
using namespace RingClientUWP::Views; using namespace RingClientUWP::Views;
...@@ -58,7 +60,7 @@ VideoCaptureManager::VideoCaptureManager(): ...@@ -58,7 +60,7 @@ VideoCaptureManager::VideoCaptureManager():
}) })
{ {
deviceList = ref new Vector<Device^>(); deviceList = ref new Vector<Device^>();
InitializeCopyFrameDispatcher(); InitializeCopyFrameDispatcher(30);
captureTaskTokenSource = new cancellation_token_source(); captureTaskTokenSource = new cancellation_token_source();
} }
...@@ -358,11 +360,11 @@ VideoCaptureManager::AddVideoDeviceAsync(uint8_t index) ...@@ -358,11 +360,11 @@ VideoCaptureManager::AddVideoDeviceAsync(uint8_t index)
} }
void void
VideoCaptureManager::InitializeCopyFrameDispatcher() VideoCaptureManager::InitializeCopyFrameDispatcher(unsigned frameRate)
{ {
try { try {
TimeSpan timeSpan; TimeSpan timeSpan;
timeSpan.Duration = static_cast<long long>(1e7) / 30; // framerate timeSpan.Duration = static_cast<long long>(1e7) / frameRate;
if (videoFrameCopyInvoker != nullptr) if (videoFrameCopyInvoker != nullptr)
delete(videoFrameCopyInvoker); delete(videoFrameCopyInvoker);
...@@ -437,23 +439,10 @@ VideoCaptureManager::CopyFrameAsync() ...@@ -437,23 +439,10 @@ VideoCaptureManager::CopyFrameAsync()
byte* data; byte* data;
unsigned capacity; unsigned capacity;
byteAccess->GetBuffer(&data, &capacity); byteAccess->GetBuffer(&data, &capacity);
auto desc = buffer->GetPlaneDescription(0); auto desc = buffer->GetPlaneDescription(0);
byte* buf = (byte*)DRing::obtainFrame(capacity); byte* buf = (byte*)DRing::obtainFrame(capacity);
if (buf)
if (buf) { std::memcpy(buf, data, static_cast<size_t>(capacity));
for (int row = 0; row < desc.Height; row++) {
for (int col = 0; col < desc.Width; col++) {
auto currPixel = desc.StartIndex + desc.Stride * row
+ BYTES_PER_PIXEL * col;
buf[currPixel + 0] = data[currPixel + 0];
buf[currPixel + 1] = data[currPixel + 1];
buf[currPixel + 2] = data[currPixel + 2];
}
}
}
DRing::releaseFrame((void*)buf); DRing::releaseFrame((void*)buf);
} }
delete reference; delete reference;
......
...@@ -94,7 +94,7 @@ internal: ...@@ -94,7 +94,7 @@ internal:
DispatcherTimer^ videoFrameCopyInvoker; DispatcherTimer^ videoFrameCopyInvoker;
task<void> CopyFrameAsync(); task<void> CopyFrameAsync();
void CopyFrame(Object^ sender, Object^ e); void CopyFrame(Object^ sender, Object^ e);
void InitializeCopyFrameDispatcher(); void InitializeCopyFrameDispatcher(unsigned frameRate);
event StartPreviewing^ startPreviewing; event StartPreviewing^ startPreviewing;
event StopPreviewing^ stopPreviewing; event StopPreviewing^ stopPreviewing;
......
...@@ -361,20 +361,8 @@ VideoPage::WriteFrameAsSoftwareBitmapAsync(String^ id, uint8_t* buf, int width, ...@@ -361,20 +361,8 @@ VideoPage::WriteFrameAsSoftwareBitmapAsync(String^ id, uint8_t* buf, int width,
byte* data; byte* data;
unsigned capacity; unsigned capacity;
byteAccess->GetBuffer(&data, &capacity); byteAccess->GetBuffer(&data, &capacity);
auto desc = buffer->GetPlaneDescription(0); auto desc = buffer->GetPlaneDescription(0);
std::memcpy(data, buf, static_cast<size_t>(capacity));
for (int row = 0; row < desc.Height; row++)
{
for (int col = 0; col < desc.Width; col++)
{
auto currPixel = desc.StartIndex + desc.Stride * row + BYTES_PER_PIXEL * col;
data[currPixel + 0] = buf[currPixel + 0];
data[currPixel + 1] = buf[currPixel + 1];
data[currPixel + 2] = buf[currPixel + 2];
}
}
} }
delete reference; delete reference;
delete buffer; delete buffer;
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
HorizontalAlignment="Center" HorizontalAlignment="Center"
Margin="0 10 0 30" Margin="0 10 0 30"
Height="150"/> Height="150"/>
<TextBlock Text="Ring is free software for universal communication wich respects the freedoms and privacy of its users." <TextBlock Text="Ring is free software for universal communication which respects the freedoms and privacy of its users."
Foreground="#707370" Foreground="#707370"
MaxWidth="500" MaxWidth="500"
Width="310" Width="310"
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
FontSize="12" FontSize="12"
FontWeight="Bold" FontWeight="Bold"
HorizontalAlignment="Center"/> HorizontalAlignment="Center"/>
<HyperlinkButton Content="Privacy Policy"
FontSize="12"
NavigateUri="https://ring.cx/en/about/privacy-and-anonymity"
HorizontalAlignment="Center"/>
<Button x:Name="_aboutButton_" <Button x:Name="_aboutButton_"
Margin="0,48,0,0" Margin="0,48,0,0"
BorderThickness="0" BorderThickness="0"
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -4,9 +4,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 ...@@ -4,9 +4,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 14.0.25420.1 VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ring-client-uwp", "ring-client-uwp.vcxproj", "{90928671-346F-42E4-934F-7A7A512A2D11}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ring-client-uwp", "ring-client-uwp.vcxproj", "{90928671-346F-42E4-934F-7A7A512A2D11}"
ProjectSection(ProjectDependencies) = postProject
{79F8DE42-595D-49D9-A66F-55244FD9DCC3} = {79F8DE42-595D-49D9-A66F-55244FD9DCC3}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ring-daemon", "..\ring-daemon\MSVC\ring-daemon.vcxproj", "{79F8DE42-595D-49D9-A66F-55244FD9DCC3}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ring-daemon", "..\ring-daemon\MSVC\ring-daemon.vcxproj", "{79F8DE42-595D-49D9-A66F-55244FD9DCC3}"
EndProject EndProject
......
Supports Markdown
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