diff --git a/WebRtcInterop.UnitTests/WebRtcInterop.UnitTests.vcxproj b/WebRtcInterop.UnitTests/WebRtcInterop.UnitTests.vcxproj index d9fd095..c6a2610 100644 --- a/WebRtcInterop.UnitTests/WebRtcInterop.UnitTests.vcxproj +++ b/WebRtcInterop.UnitTests/WebRtcInterop.UnitTests.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -17,23 +25,15 @@ Release x64 - - Debug - ARM64 - - - Release - ARM64 - {5cfb4d3d-2e45-4a55-91ca-e45b7db34bf7} - Win32Proj + ManagedCProj 10.0 Application v145 Unicode - 4.8 + v4.8 true $(MSBuildProjectDirectory)\..\WebRtcInterop;$(IncludePath) true diff --git a/WebRtcInterop/WebRtcInterop.Core.vcxproj b/WebRtcInterop/WebRtcInterop.Core.vcxproj index 6c97181..f544504 100644 --- a/WebRtcInterop/WebRtcInterop.Core.vcxproj +++ b/WebRtcInterop/WebRtcInterop.Core.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -17,20 +25,12 @@ Release x64 - - Debug - ARM64 - - - Release - ARM64 - 17.0 {F259D9C3-8B07-4B62-A9B8-F0836178BC58} NetCoreCProj - net10.0 + net10.0-windows NetCore diff --git a/WebRtcInterop/WebRtcInterop.Framework.vcxproj b/WebRtcInterop/WebRtcInterop.Framework.vcxproj index 788b656..4c07637 100644 --- a/WebRtcInterop/WebRtcInterop.Framework.vcxproj +++ b/WebRtcInterop/WebRtcInterop.Framework.vcxproj @@ -1,6 +1,14 @@ + + Debug + ARM64 + + + Release + ARM64 + Debug Win32 @@ -17,19 +25,11 @@ Release x64 - - Debug - ARM64 - - - Release - ARM64 - 17.0 {26F36298-7F6A-4BD1-893B-2572BA180259} - NetCoreCProj + ManagedCProj v4.8 true diff --git a/WebRtcInterop/WebRtcInterop.Shared.vcxitems b/WebRtcInterop/WebRtcInterop.Shared.vcxitems index 64939bd..6755a7d 100644 --- a/WebRtcInterop/WebRtcInterop.Shared.vcxitems +++ b/WebRtcInterop/WebRtcInterop.Shared.vcxitems @@ -1,158 +1,159 @@  - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - {fac2e2bf-5a09-428f-a224-1ce7a160a2d1} - - - - cd "$(WebRtcSrcRoot)" + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {fac2e2bf-5a09-428f-a224-1ce7a160a2d1} + + + + cd "$(WebRtcSrcRoot)" echo Generating WebRtc Build Files -cmd /c gn gen --ide=vs "$(WebRtcOutRoot)\$(Configuration)\$(Platform)" --filters=//:webrtc --args=" - " +cmd /c gn gen --ide=vs "$(WebRtcOutRoot)\$(Configuration)\$(Platform)" --filters=//:webrtc --args=" + + " echo Compiling WebRtc Build Files ninja -C "$(WebRtcOutRoot)\$(Configuration)\$(Platform)" - - use_custom_libcxx=false libcxx_is_shared=true use_lld=false is_component_build=false clang_use_chrome_plugins=false rtc_include_tests=false rtc_build_tools=false rtc_build_examples=false rtc_enable_symbol_export=true rtc_enable_protobuf=false enable_libaom=false - - - $(ProjectDir);$(IncludePath) - PreBuildEvent - - - - Use - pch.h - Level3 - stdcpp20 - stdc17 - - - - - - _DEBUG;%(PreprocessorDefinitions) - - - - - NDEBUG;%(PreprocessorDefinitions) - - - - - WIN32;%(PreprocessorDefinitions) - - - - - ARM64;%(PreprocessorDefinitions) - - - - - - %(PreprocessorDefinitions);_ITERATOR_DEBUG_LEVEL=0 - - - - - %(ExternalIncludePath);$(WebRtcSrcRoot);$(WebRtcSrcRoot)\system_wrappers;$(WebRtcSrcRoot)\third_party\abseil-cpp;$(WebRtcSrcRoot)\buildtools\third_party\libc++;$(WebRtcSrcRoot)\third_party\libyuv\include;$(WebRtcSrcRoot)\third_party\jsoncpp\source\include - TurnOffAllWarnings - %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(WebRtcSrcRoot);$(WebRtcSrcRoot)\system_wrappers;$(WebRtcSrcRoot)\third_party\abseil-cpp;$(WebRtcSrcRoot)\buildtools\third_party\libc++;$(WebRtcSrcRoot)\third_party\libyuv\include;$(WebRtcSrcRoot)\third_party\jsoncpp\source\include - %(PreprocessorDefinitions);_HAS_EXCEPTIONS=0;__STD_C;_CRT_RAND_S;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_ATL_NO_OPENGL;_WINDOWS;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;PSAPI_VERSION=2;WIN32;_SECURE_ATL;__WRL_NO_DEFAULT_LIB__;WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP;WIN10=_WIN32_WINNT_WIN10;WIN32_LEAN_AND_MEAN;NOMINMAX;_UNICODE;UNICODE;NTDDI_VERSION=NTDDI_WIN10_RS2;_WIN32_WINNT=0x0A00;WINVER=0x0A00;NVALGRIND;DYNAMIC_ANNOTATIONS_ENABLED=0;WEBRTC_ENABLE_PROTOBUF=0;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;RTC_ENABLE_VP9;HAVE_SCTP;WEBRTC_LIBRARY_IMPL;WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0;WEBRTC_WIN;ABSL_ALLOCATOR_NOTHROW=1;HAVE_SCTP - - - %(AdditionalLibraryDirectories);$(WebRtcOutRoot)\$(Configuration)\$(Platform) - webrtc.lib;Ws2_32.lib;iphlpapi.lib;Winmm.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) - libcmtd;%(IgnoreSpecificDefaultLibraries) - - - - - $(WebRtcGnCommandPrefix)target_cpu="x64" is_debug=false enable_iterator_debugging=false $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) - - Building Google WebRtc Library - $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib - - - - - $(WebRtcGnCommandPrefix)target_cpu="x64" is_debug=true enable_iterator_debugging=true $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) - - Building Google WebRtc Library - $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib - - - - - $(WebRtcGnCommandPrefix)target_cpu="arm64" is_debug=false enable_iterator_debugging=false rtc_enable_win_wgc=false $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) - - Building Google WebRtc Library - $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib - - - - - $(WebRtcGnCommandPrefix)target_cpu="arm64" is_debug=true enable_iterator_debugging=false rtc_enable_win_wgc=false $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) - - Building Google WebRtc Library - $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib - - - - - $(WebRtcGnCommandPrefix)target_cpu="x86" is_debug=false enable_iterator_debugging=false $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) - - Building Google WebRtc Library - $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib - - - - - $(WebRtcGnCommandPrefix)target_cpu="x86" is_debug=true enable_iterator_debugging=true $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) - - Building Google WebRtc Library - $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib - - - - - - - - {98433217-c99b-4b08-a19b-3f97a1f1e633} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - - - + + use_custom_libcxx=false libcxx_is_shared=true use_lld=false is_component_build=false clang_use_chrome_plugins=false rtc_include_tests=false rtc_build_tools=false rtc_build_examples=false rtc_enable_symbol_export=true rtc_enable_protobuf=false enable_libaom=false + + + $(ProjectDir);$(IncludePath) + PreBuildEvent + + + + Use + pch.h + Level3 + stdcpp20 + stdc17 + + + + + + _DEBUG;%(PreprocessorDefinitions) + + + + + NDEBUG;%(PreprocessorDefinitions) + + + + + WIN32;%(PreprocessorDefinitions) + + + + + %(PreprocessorDefinitions) + + + + + + ARM64;%(PreprocessorDefinitions);_ITERATOR_DEBUG_LEVEL=0 + + + + + %(ExternalIncludePath);$(WebRtcSrcRoot);$(WebRtcSrcRoot)\system_wrappers;$(WebRtcSrcRoot)\third_party\abseil-cpp;$(WebRtcSrcRoot)\buildtools\third_party\libc++;$(WebRtcSrcRoot)\third_party\libyuv\include;$(WebRtcSrcRoot)\third_party\jsoncpp\source\include + TurnOffAllWarnings + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(WebRtcSrcRoot);$(WebRtcSrcRoot)\system_wrappers;$(WebRtcSrcRoot)\third_party\abseil-cpp;$(WebRtcSrcRoot)\buildtools\third_party\libc++;$(WebRtcSrcRoot)\third_party\libyuv\include;$(WebRtcSrcRoot)\third_party\jsoncpp\source\include + %(PreprocessorDefinitions);_HAS_EXCEPTIONS=0;__STD_C;_CRT_RAND_S;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_ATL_NO_OPENGL;_WINDOWS;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;PSAPI_VERSION=2;WIN32;_SECURE_ATL;__WRL_NO_DEFAULT_LIB__;WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP;WIN10=_WIN32_WINNT_WIN10;WIN32_LEAN_AND_MEAN;NOMINMAX;_UNICODE;UNICODE;NTDDI_VERSION=NTDDI_WIN10_RS2;_WIN32_WINNT=0x0A00;WINVER=0x0A00;NVALGRIND;DYNAMIC_ANNOTATIONS_ENABLED=0;WEBRTC_ENABLE_PROTOBUF=0;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;RTC_ENABLE_VP9;HAVE_SCTP;WEBRTC_LIBRARY_IMPL;WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0;WEBRTC_WIN;ABSL_ALLOCATOR_NOTHROW=1;HAVE_SCTP + + + %(AdditionalLibraryDirectories);$(WebRtcOutRoot)\$(Configuration)\$(Platform) + webrtc.lib;Ws2_32.lib;iphlpapi.lib;Winmm.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + libcmtd;%(IgnoreSpecificDefaultLibraries) + + + + + $(WebRtcGnCommandPrefix)target_cpu="x64" is_debug=false enable_iterator_debugging=false $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) + + Building Google WebRtc Library + $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib + + + + + $(WebRtcGnCommandPrefix)target_cpu="x64" is_debug=true enable_iterator_debugging=true $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) + + Building Google WebRtc Library + $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib + + + + + $(WebRtcGnCommandPrefix)target_cpu="arm64" is_debug=false enable_iterator_debugging=false rtc_enable_win_wgc=false $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) + + Building Google WebRtc Library + $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib + + + + + $(WebRtcGnCommandPrefix)target_cpu="arm64" is_debug=true enable_iterator_debugging=false rtc_enable_win_wgc=false $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) + + Building Google WebRtc Library + $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib + + + + + $(WebRtcGnCommandPrefix)target_cpu="x86" is_debug=false enable_iterator_debugging=false $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) + + Building Google WebRtc Library + $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib + + + + + $(WebRtcGnCommandPrefix)target_cpu="x86" is_debug=true enable_iterator_debugging=true $(WebRtcGnCommonArgs)$(WebRtcGnCommandSuffix) + + Building Google WebRtc Library + $(WebRtcOutRoot)\$(Configuration)\$(Platform)\webrtc.lib + + + + + + + + {98433217-c99b-4b08-a19b-3f97a1f1e633} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + + + \ No newline at end of file diff --git a/WebRtcInterop/WebRtcInterop.default.props b/WebRtcInterop/WebRtcInterop.default.props index 637ce9e..78d3f39 100644 --- a/WebRtcInterop/WebRtcInterop.default.props +++ b/WebRtcInterop/WebRtcInterop.default.props @@ -1,16 +1,16 @@ - - WebRtcInterop - 10.0 - DynamicLibrary - v145 - Unicode - - - true - - - false - + + WebRtcInterop + 10.0 + DynamicLibrary + v145 + Unicode + + + true + + + false + \ No newline at end of file diff --git a/WebRtcNet.Api.UnitTests/WebRtcNet.Api.UnitTests.csproj b/WebRtcNet.Api.UnitTests/WebRtcNet.Api.UnitTests.csproj index 055cb33..29625bf 100644 --- a/WebRtcNet.Api.UnitTests/WebRtcNet.Api.UnitTests.csproj +++ b/WebRtcNet.Api.UnitTests/WebRtcNet.Api.UnitTests.csproj @@ -1,20 +1,19 @@  - - net10.0;net48 - Library - Debug;Release - AnyCPU;x64;x86;ARM64 - WebRtcNet.UnitTests - Unit tests for the WebRtcNet assembly - 54bcf14f-4d80-4bfc-b51c-b67df6de2e0d - latest - - - - - - - - - + + net10.0-windows;net48 + Library + ARM64;x64;x86 + WebRtcNet.UnitTests + Unit tests for the WebRtcNet assembly + 54bcf14f-4d80-4bfc-b51c-b67df6de2e0d + latest + + + + + + + + + \ No newline at end of file diff --git a/WebRtcNet.Api/WebRtcNet.Api.csproj b/WebRtcNet.Api/WebRtcNet.Api.csproj index 764ae5a..f6bb1ea 100644 --- a/WebRtcNet.Api/WebRtcNet.Api.csproj +++ b/WebRtcNet.Api/WebRtcNet.Api.csproj @@ -1,14 +1,12 @@  - net10.0;net48 + net10.0-windows;net48 Library - Debug;Release - AnyCPU;x64;x86;ARM64 + ARM64;x64;x86 WebRtcNet.Api The public WebRtc interfaces and classes for the WebRtcNet library 98433217-c99b-4b08-a19b-3f97a1f1e633 $(OutputPath)$(TargetFramework)\WebRtcNet.Api.XML - true latest WebRtcNet diff --git a/WebRtcNet.slnx b/WebRtcNet.slnx index a0e3a7f..f9eb10e 100644 --- a/WebRtcNet.slnx +++ b/WebRtcNet.slnx @@ -26,9 +26,25 @@ - + + + + + - - - + + + + + + + + + + + + + + + diff --git a/WebRtcNet/WebRtcNet.csproj b/WebRtcNet/WebRtcNet.csproj index 6df6b28..0592882 100644 --- a/WebRtcNet/WebRtcNet.csproj +++ b/WebRtcNet/WebRtcNet.csproj @@ -1,25 +1,24 @@  - - net10.0;net48 - Library - Debug;Release - x64;x86;ARM64 - WebRtcNet - A WebRtc implementation for .Net - 3CA16CE5-8124-4D86-8E37-2171B15BE276 - true - latest - + + net10.0-windows;net48 + Library + ARM64;x64;x86 + WebRtcNet + A WebRtc implementation for .Net + 3CA16CE5-8124-4D86-8E37-2171B15BE276 + true + latest + - - ..\LICENSE - True - $(OutputPath)$(TargetFramework)\WebRtcNet.XML - + + ..\LICENSE + True + $(OutputPath)$(TargetFramework)\WebRtcNet.XML + - - - - - + + + + + diff --git a/examples/BasicVideoChat/MainWindow.xaml.cs b/examples/BasicVideoChat/MainWindow.xaml.cs index df1d275..2be3373 100644 --- a/examples/BasicVideoChat/MainWindow.xaml.cs +++ b/examples/BasicVideoChat/MainWindow.xaml.cs @@ -19,7 +19,7 @@ public partial class MainWindow : Window private static readonly RtcConfiguration DefaultConfiguration = new( new[] { new RtcIceServer("stun:stun.l.google.com:19302") }); - private WebRtcInterop.RtcPeerConnection? _peerConnection; + private RtcPeerConnection? _peerConnection; private TcpSignalingChannel? _signaling; private MediaStream? _localStream; private MediaStreamTrack? _audioTrack; @@ -76,7 +76,7 @@ private async Task StartCallAsync() { SetStatus("Acquiring media..."); - var mediaDevices = new WebRtcInterop.Media.MediaDevices(); + var mediaDevices = CreateInteropInstance("WebRtcInterop.Media.MediaDevices"); _localStream = await mediaDevices.GetUserMedia(new MediaStreamConstraints(true, true)); _audioTrack = _localStream.GetAudioTracks().FirstOrDefault(); @@ -89,7 +89,7 @@ private async Task StartCallAsync() // NOTE: Many WebRtcInterop methods currently throw NotImplementedException — this example // will not run end-to-end until they are implemented. SetLocalDescription and // AddIceCandidate are the minimum required for a basic call flow. - _peerConnection = new WebRtcInterop.RtcPeerConnection(DefaultConfiguration); + _peerConnection = CreateInteropInstance("WebRtcInterop.RtcPeerConnection", DefaultConfiguration); _peerConnection.OnIceCandidate += OnIceCandidate; _peerConnection.OnTrack += OnTrack; _peerConnection.OnConnectionStateChange += OnConnectionStateChange; @@ -223,4 +223,19 @@ private async Task HangUpAsync() private void SetStatus(string message) => Dispatcher.Invoke(() => StatusText.Text = message); + + private static T CreateInteropInstance(string fullTypeName, params object[] args) where T : class + { + var type = + Type.GetType($"{fullTypeName}, WebRtcInterop.Core") ?? + Type.GetType($"{fullTypeName}, WebRtcInterop.Framework") ?? + Type.GetType($"{fullTypeName}, WebRtcInterop"); + if (type == null) + throw new NotSupportedException($"{fullTypeName} is not available. Ensure WebRtcInterop is built for the active target framework."); + + if (Activator.CreateInstance(type, args) is T instance) + return instance; + + throw new InvalidOperationException($"{fullTypeName} does not implement {typeof(T).FullName}."); + } }