Skip to content

Commit

Permalink
Merge pull request #124 from jdibenes/mq-cleanup
Browse files Browse the repository at this point in the history
Mq cleanup
  • Loading branch information
jdibenes authored Jul 25, 2024
2 parents 89b9fc6 + a5ab8a1 commit d8f8250
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 55 deletions.
2 changes: 1 addition & 1 deletion hl2ss/hl2ss/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Identity
Name="eaaf3af3-1402-4e5b-b6a1-5d0fbb7c1ba8"
Publisher="CN=jcds"
Version="1.0.31.0" />
Version="1.0.32.0" />
<mp:PhoneIdentity PhoneProductId="eaaf3af3-1402-4e5b-b6a1-5d0fbb7c1ba8" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>hl2ss</DisplayName>
Expand Down
11 changes: 7 additions & 4 deletions hl2ss/hl2ss/hl2ss.vcxproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.230225.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.230225.1\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<Import Project="..\packages\Microsoft.MixedReality.EyeTracking.1.0.2\build\native\Microsoft.MixedReality.EyeTracking.props" Condition="Exists('..\packages\Microsoft.MixedReality.EyeTracking.1.0.2\build\native\Microsoft.MixedReality.EyeTracking.props')" />
<PropertyGroup Label="Globals">
<CppWinRTOptimized>true</CppWinRTOptimized>
Expand Down Expand Up @@ -198,6 +198,7 @@
<ClInclude Include="extended_eye_tracking.h" />
<ClInclude Include="extended_video.h" />
<ClInclude Include="holographic_space.h" />
<ClInclude Include="ipc_mq.h" />
<ClInclude Include="ipc_sc.h" />
<ClInclude Include="ipc_sm.h" />
<ClInclude Include="ipc_su.h" />
Expand All @@ -208,6 +209,7 @@
<ClInclude Include="nfo.h" />
<ClInclude Include="personal_video.h" />
<ClInclude Include="ipc_rc.h" />
<ClInclude Include="plugin.h" />
<ClInclude Include="scene_understanding.h" />
<ClInclude Include="spatial_input.h" />
<ClInclude Include="spatial_mapping.h" />
Expand Down Expand Up @@ -278,6 +280,7 @@
<ClCompile Include="extended_eye_tracking.cpp" />
<ClCompile Include="extended_video.cpp" />
<ClCompile Include="holographic_space.cpp" />
<ClCompile Include="ipc_mq.cpp" />
<ClCompile Include="ipc_sc.cpp" />
<ClCompile Include="ipc_sm.cpp" />
<ClCompile Include="ipc_su.cpp" />
Expand Down Expand Up @@ -351,7 +354,7 @@
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\Microsoft.MixedReality.SceneUnderstanding.1.0.14\build\native\Microsoft.MixedReality.SceneUnderstanding.targets" Condition="Exists('..\packages\Microsoft.MixedReality.SceneUnderstanding.1.0.14\build\native\Microsoft.MixedReality.SceneUnderstanding.targets')" />
<Import Project="..\packages\Microsoft.MixedReality.EyeTracking.1.0.2\build\native\Microsoft.MixedReality.EyeTracking.targets" Condition="Exists('..\packages\Microsoft.MixedReality.EyeTracking.1.0.2\build\native\Microsoft.MixedReality.EyeTracking.targets')" />
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.230225.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.230225.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand All @@ -360,7 +363,7 @@
<Error Condition="!Exists('..\packages\Microsoft.MixedReality.SceneUnderstanding.1.0.14\build\native\Microsoft.MixedReality.SceneUnderstanding.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.MixedReality.SceneUnderstanding.1.0.14\build\native\Microsoft.MixedReality.SceneUnderstanding.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.MixedReality.EyeTracking.1.0.2\build\native\Microsoft.MixedReality.EyeTracking.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.MixedReality.EyeTracking.1.0.2\build\native\Microsoft.MixedReality.EyeTracking.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.MixedReality.EyeTracking.1.0.2\build\native\Microsoft.MixedReality.EyeTracking.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.MixedReality.EyeTracking.1.0.2\build\native\Microsoft.MixedReality.EyeTracking.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.230225.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.230225.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.230225.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.230225.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>
9 changes: 9 additions & 0 deletions hl2ss/hl2ss/hl2ss.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@
<ClCompile Include="stream_ev.cpp">
<Filter>Source Files\interfaces</Filter>
</ClCompile>
<ClCompile Include="ipc_mq.cpp">
<Filter>Source Files\interfaces</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Image Include="Assets\Wide310x150Logo.scale-200.png">
Expand Down Expand Up @@ -603,6 +606,12 @@
<ClInclude Include="stream_ev.h">
<Filter>Header Files\interfaces</Filter>
</ClInclude>
<ClInclude Include="ipc_mq.h">
<Filter>Header Files\interfaces</Filter>
</ClInclude>
<ClInclude Include="plugin.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
Expand Down
18 changes: 5 additions & 13 deletions hl2ss/plugin/ipc.cpp → hl2ss/hl2ss/ipc_mq.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

#include <queue>
#include <malloc.h>
#include "plugin.h"

#include "../hl2ss/server.h"
#include "../hl2ss/ports.h"
#include "../hl2ss/lock.h"
#include "../hl2ss/log.h"
#include "server.h"
#include "ports.h"
#include "lock.h"
#include "log.h"
#include "ipc_mq.h"

struct MQ_MSG
{
Expand Down Expand Up @@ -81,15 +81,13 @@ static DWORD WINAPI MQ_EntryPoint_Receive(void *param)
}

// OK
UNITY_EXPORT
uint32_t MQ_SI_Peek()
{
CriticalSection cs(&g_lock_si);
return g_queue_si.empty() ? ~0UL : g_queue_si.front().size;
}

// OK
UNITY_EXPORT
void MQ_SI_Pop(uint32_t& command, uint8_t* data)
{
MQ_MSG msg;
Expand Down Expand Up @@ -145,7 +143,6 @@ static DWORD WINAPI MQ_EntryPoint_Send(void *param)
}

// OK
UNITY_EXPORT
void MQ_SO_Push(uint32_t id)
{
CriticalSection cs(&g_lock_so);
Expand All @@ -154,7 +151,6 @@ void MQ_SO_Push(uint32_t id)
}

// OK
UNITY_EXPORT
void MQ_Restart()
{
g_queue_so = {};
Expand Down Expand Up @@ -310,15 +306,13 @@ static DWORD WINAPI MQX_EntryPoint_Exchange(void* param)
}

// OK
UNITY_EXPORT
uint32_t MQX_CO_Peek()
{
CriticalSection cs(&g_lock_co);
return g_queue_co.empty() ? ~0UL : sizeof(uint32_t);
}

// OK
UNITY_EXPORT
void MQX_CO_Pop(uint32_t& id)
{
CriticalSection cs(&g_lock_co);
Expand All @@ -327,7 +321,6 @@ void MQX_CO_Pop(uint32_t& id)
}

// OK
UNITY_EXPORT
void MQX_CI_Push(uint32_t command, uint32_t size, uint8_t const* data)
{
MQ_MSG msg;
Expand All @@ -349,7 +342,6 @@ void MQX_CI_Push(uint32_t command, uint32_t size, uint8_t const* data)
}

// OK
UNITY_EXPORT
void MQX_Restart()
{
while (g_queue_ci.size() > 0)
Expand Down
23 changes: 23 additions & 0 deletions hl2ss/hl2ss/ipc_mq.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

#pragma once

#include <stdint.h>
#include "plugin.h"

void MQ_Initialize();
void MQ_Quit();
void MQ_Cleanup();

void MQX_Initialize();
void MQX_Quit();
void MQX_Cleanup();

HL2SS_PLUGIN_EXPORT uint32_t MQ_SI_Peek();
HL2SS_PLUGIN_EXPORT void MQ_SI_Pop(uint32_t& command, uint8_t* data);
HL2SS_PLUGIN_EXPORT void MQ_SO_Push(uint32_t id);
HL2SS_PLUGIN_EXPORT void MQ_Restart();

HL2SS_PLUGIN_EXPORT uint32_t MQX_CO_Peek();
HL2SS_PLUGIN_EXPORT void MQX_CO_Pop(uint32_t& id);
HL2SS_PLUGIN_EXPORT void MQX_CI_Push(uint32_t command, uint32_t size, uint8_t const* data);
HL2SS_PLUGIN_EXPORT void MQX_Restart();
2 changes: 1 addition & 1 deletion hl2ss/hl2ss/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<packages>
<package id="Microsoft.MixedReality.EyeTracking" version="1.0.2" targetFramework="native" />
<package id="Microsoft.MixedReality.SceneUnderstanding" version="1.0.14" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.230225.1" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
</packages>
8 changes: 8 additions & 0 deletions hl2ss/hl2ss/plugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

#pragma once

#ifdef HL2SS_PLUGIN
#define HL2SS_PLUGIN_EXPORT extern "C" __declspec(dllexport)
#else
#define HL2SS_PLUGIN_EXPORT
#endif
2 changes: 1 addition & 1 deletion hl2ss/hl2ss/spatial_mapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void SpatialMapping_BeginComputeMeshes(SpatialMapping_MeshTask* task, size_t siz
{
void* param = (void*)(new SpatialMapping_MeshTaskGroup{ task, size, maxtasks }); // delete

g_semaphore_observed_meshes = CreateSemaphore(NULL, 0, maxtasks, NULL);
g_semaphore_observed_meshes = CreateSemaphore(NULL, 0, 0x7FFFFFFF, NULL);
g_compute_thread = CreateThread(NULL, 0, SpatialMapping_ComputeMeshes, param, 0, NULL);
}

Expand Down
10 changes: 0 additions & 10 deletions hl2ss/plugin/ipc.h

This file was deleted.

14 changes: 7 additions & 7 deletions hl2ss/plugin/plugin.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

#include <mfapi.h>
#include "configuration.h"
#include "ipc.h"
#include "plugin.h"

#include "../hl2ss/plugin.h"
#include "../hl2ss/server.h"
#include "../hl2ss/timestamps.h"
#include "../hl2ss/log.h"
Expand All @@ -24,6 +23,7 @@
#include "../hl2ss/ipc_sm.h"
#include "../hl2ss/ipc_su.h"
#include "../hl2ss/ipc_vi.h"
#include "../hl2ss/ipc_mq.h"
#include "../hl2ss/stream_eet.h"
#include "../hl2ss/stream_ea.h"
#include "../hl2ss/stream_ev.h"
Expand All @@ -40,7 +40,7 @@ using namespace winrt::Windows::ApplicationModel::Core;
//-----------------------------------------------------------------------------

// OK
UNITY_EXPORT
HL2SS_PLUGIN_EXPORT
void InitializeStreams(uint32_t enable)
{
InitializeSockets();
Expand Down Expand Up @@ -71,7 +71,7 @@ void InitializeStreams(uint32_t enable)
}

// OK
UNITY_EXPORT
HL2SS_PLUGIN_EXPORT
void InitializeStreamsOnUI(uint32_t enable)
{
HANDLE event_done = CreateEvent(NULL, TRUE, FALSE, NULL);
Expand All @@ -81,14 +81,14 @@ void InitializeStreamsOnUI(uint32_t enable)
}

// OK
UNITY_EXPORT
HL2SS_PLUGIN_EXPORT
void DebugMessage(char const* str)
{
ShowMessage("%s", str);
}

// OK
UNITY_EXPORT
HL2SS_PLUGIN_EXPORT
void GetLocalIPv4Address(wchar_t *buffer, int size)
{
std::vector<wchar_t> address;
Expand All @@ -97,7 +97,7 @@ void GetLocalIPv4Address(wchar_t *buffer, int size)
}

// OK
UNITY_EXPORT
HL2SS_PLUGIN_EXPORT
int OverrideWorldCoordinateSystem(void* scs_ptr)
{
winrt::Windows::Perception::Spatial::SpatialCoordinateSystem scs = nullptr;
Expand Down
4 changes: 0 additions & 4 deletions hl2ss/plugin/plugin.h

This file was deleted.

7 changes: 4 additions & 3 deletions hl2ss/plugin/plugin.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
<ConformanceMode>Default</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)packages\Microsoft.MixedReality.SceneUnderstanding.1.0.14\include\native;$(SolutionDir)hl2ss\Generated Files;$(SolutionDir)..\3rdparty\HoloLens2ForCV;$(SolutionDir)..\3rdparty\Zdepth\include;$(SolutionDir)..\3rdparty\Zdepth\zstd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HL2SS_PLUGIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down Expand Up @@ -287,6 +288,7 @@
<ClCompile Include="..\hl2ss\extended_execution.cpp" />
<ClCompile Include="..\hl2ss\extended_eye_tracking.cpp" />
<ClCompile Include="..\hl2ss\extended_video.cpp" />
<ClCompile Include="..\hl2ss\ipc_mq.cpp" />
<ClCompile Include="..\hl2ss\ipc_rc.cpp" />
<ClCompile Include="..\hl2ss\ipc_sc.cpp" />
<ClCompile Include="..\hl2ss\ipc_sm.cpp" />
Expand Down Expand Up @@ -320,7 +322,6 @@
<ClCompile Include="..\packages\Microsoft.MixedReality.SceneUnderstanding.1.0.14\include\native\Microsoft.MixedReality.SceneUnderstanding.cpp" />
<ClCompile Include="holographic_space_stub.cpp" />
<ClCompile Include="plugin.cpp" />
<ClCompile Include="ipc.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\3rdparty\Zdepth\include\zdepth.hpp" />
Expand Down Expand Up @@ -365,6 +366,7 @@
<ClInclude Include="..\hl2ss\extended_execution.h" />
<ClInclude Include="..\hl2ss\extended_eye_tracking.h" />
<ClInclude Include="..\hl2ss\extended_video.h" />
<ClInclude Include="..\hl2ss\ipc_mq.h" />
<ClInclude Include="..\hl2ss\ipc_rc.h" />
<ClInclude Include="..\hl2ss\ipc_sc.h" />
<ClInclude Include="..\hl2ss\ipc_sm.h" />
Expand All @@ -377,6 +379,7 @@
<ClInclude Include="..\hl2ss\neon.h" />
<ClInclude Include="..\hl2ss\nfo.h" />
<ClInclude Include="..\hl2ss\personal_video.h" />
<ClInclude Include="..\hl2ss\plugin.h" />
<ClInclude Include="..\hl2ss\ports.h" />
<ClInclude Include="..\hl2ss\research_mode.h" />
<ClInclude Include="..\hl2ss\scene_understanding.h" />
Expand All @@ -399,8 +402,6 @@
<ClInclude Include="..\hl2ss\voice_input.h" />
<ClInclude Include="configuration.h" />
<ClInclude Include="hl2ss.h" />
<ClInclude Include="plugin.h" />
<ClInclude Include="ipc.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\packages\Microsoft.MixedReality.SceneUnderstanding.1.0.14\runtimes\win10-arm64\native\Microsoft.MixedReality.SceneUnderstanding.dll" />
Expand Down
18 changes: 9 additions & 9 deletions hl2ss/plugin/plugin.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@
<ClCompile Include="plugin.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ipc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\hl2ss\stream_si.cpp">
<Filter>Libraries\hl2ss</Filter>
</ClCompile>
Expand Down Expand Up @@ -240,6 +237,9 @@
<ClCompile Include="..\hl2ss\stream_ev.cpp">
<Filter>Libraries\hl2ss</Filter>
</ClCompile>
<ClCompile Include="..\hl2ss\ipc_mq.cpp">
<Filter>Libraries\hl2ss</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\hl2ss\custom_hook_callback.h">
Expand Down Expand Up @@ -305,12 +305,6 @@
<ClInclude Include="..\hl2ss\types.h">
<Filter>Libraries\hl2ss</Filter>
</ClInclude>
<ClInclude Include="ipc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="plugin.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\hl2ss\stream_si.h">
<Filter>Libraries\hl2ss</Filter>
</ClInclude>
Expand Down Expand Up @@ -476,6 +470,12 @@
<ClInclude Include="..\hl2ss\stream_ev.h">
<Filter>Libraries\hl2ss</Filter>
</ClInclude>
<ClInclude Include="..\hl2ss\ipc_mq.h">
<Filter>Libraries\hl2ss</Filter>
</ClInclude>
<ClInclude Include="..\hl2ss\plugin.h">
<Filter>Libraries\hl2ss</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\packages\Microsoft.MixedReality.SceneUnderstanding.1.0.14\runtimes\win10-arm64\native\Microsoft.MixedReality.SceneUnderstanding.dll">
Expand Down
Binary file modified hl2ss_unity/Assets/Plugins/WSA/hl2ss.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion hl2ss_unity/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ PlayerSettings:
m_RenderingPath: 1
m_MobileRenderingPath: 1
metroPackageName: hl2ss-unity
metroPackageVersion: 1.0.30.0
metroPackageVersion: 1.0.32.0
metroCertificatePath: Assets\WSATestCertificate.pfx
metroCertificatePassword:
metroCertificateSubject: jcds
Expand Down
Loading

0 comments on commit d8f8250

Please sign in to comment.