From fc2a5acfca4b12f1f5b7dc17ce34bdd890641dc6 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 10 Mar 2017 13:33:17 -0500 Subject: [PATCH] move loopback util --- Emby.Server.Core/ApplicationHost.cs | 46 ++- .../Emby.Server.Implementations.csproj | 1 + MediaBrowser.Api/Playback/MediaInfoService.cs | 70 ++-- .../MediaEncoding/EncodingHelper.cs | 5 + .../MediaInfo/PlaybackInfoRequest.cs | 2 + MediaBrowser.Server.Mac/MacAppHost.cs | 36 -- .../MediaBrowser.ServerApplication.csproj | 1 - .../Native/LoopbackUtil.cs | 358 ------------------ .../WindowsAppHost.cs | 6 +- .../Net/HttpListenerRequest.cs | 2 +- 10 files changed, 82 insertions(+), 445 deletions(-) delete mode 100644 MediaBrowser.ServerApplication/Native/LoopbackUtil.cs diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.cs index 4425d1a0b..7dbc7760b 100644 --- a/Emby.Server.Core/ApplicationHost.cs +++ b/Emby.Server.Core/ApplicationHost.cs @@ -107,7 +107,7 @@ using Emby.Server.Implementations.Playlists; using Emby.Server.Implementations; using Emby.Server.Implementations.ServerManager; using Emby.Server.Implementations.Session; -using Emby.Server.Implementations.Social; +using Emby.Server.Implementations.Windows; using Emby.Server.Implementations.TV; using Emby.Server.Implementations.Updates; using MediaBrowser.Model.Activity; @@ -796,17 +796,25 @@ namespace Emby.Server.Core info.FFMpegFilename = "ffmpeg"; info.FFProbeFilename = "ffprobe"; info.ArchiveType = "7z"; - info.Version = "20160215"; + info.Version = "20170308"; info.DownloadUrls = GetLinuxDownloadUrls(); } else if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows) { info.FFMpegFilename = "ffmpeg.exe"; info.FFProbeFilename = "ffprobe.exe"; - info.Version = "20160410"; + info.Version = "20170308"; info.ArchiveType = "7z"; info.DownloadUrls = GetWindowsDownloadUrls(); } + else if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.OSX) + { + info.FFMpegFilename = "ffmpeg"; + info.FFProbeFilename = "ffprobe"; + info.ArchiveType = "7z"; + info.Version = "20170308"; + info.DownloadUrls = GetMacDownloadUrls(); + } else { // No version available - user requirement @@ -816,6 +824,20 @@ namespace Emby.Server.Core return info; } + private string[] GetMacDownloadUrls() + { + switch (EnvironmentInfo.SystemArchitecture) + { + case Architecture.X64: + return new[] + { + "https://embydata.com/downloads/ffmpeg/osx/ffmpeg-x64-20170308.7z" + }; + } + + return new string[] { }; + } + private string[] GetWindowsDownloadUrls() { switch (EnvironmentInfo.SystemArchitecture) @@ -823,12 +845,12 @@ namespace Emby.Server.Core case Architecture.X64: return new[] { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win64.7z" + "https://embydata.com/downloads/ffmpeg/windows/ffmpeg-20170308-win64.7z" }; case Architecture.X86: return new[] { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win32.7z" + "https://embydata.com/downloads/ffmpeg/windows/ffmpeg-20170308-win32.7z" }; } @@ -842,12 +864,12 @@ namespace Emby.Server.Core case Architecture.X64: return new[] { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z" + "https://embydata.com/downloads/ffmpeg/linux/ffmpeg-git-20170301-64bit-static.7z" }; case Architecture.X86: return new[] { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z" + "https://embydata.com/downloads/ffmpeg/linux/ffmpeg-git-20170301-32bit-static.7z" }; } @@ -1716,12 +1738,10 @@ namespace Emby.Server.Core public void EnableLoopback(string appName) { - EnableLoopbackInternal(appName); - } - - protected virtual void EnableLoopbackInternal(string appName) - { - + if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows) + { + LoopUtil.Run(appName); + } } private void RegisterModules() diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index c704d0e4e..9affe0fdd 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -269,6 +269,7 @@ + diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs index ed8449b83..4e4e8858e 100644 --- a/MediaBrowser.Api/Playback/MediaInfoService.cs +++ b/MediaBrowser.Api/Playback/MediaInfoService.cs @@ -127,7 +127,7 @@ namespace MediaBrowser.Api.Playback SetDeviceSpecificData(item, result.MediaSource, profile, authInfo, request.MaxStreamingBitrate, request.StartTimeTicks ?? 0, result.MediaSource.Id, request.AudioStreamIndex, - request.SubtitleStreamIndex, request.MaxAudioChannels, request.PlaySessionId, request.UserId, true, true, true); + request.SubtitleStreamIndex, request.MaxAudioChannels, request.PlaySessionId, request.UserId, true, true, true, true); } else { @@ -169,7 +169,7 @@ namespace MediaBrowser.Api.Playback { var mediaSourceId = request.MediaSourceId; - SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId, request.EnableDirectPlay, request.EnableDirectStream, request.EnableTranscoding); + SetDeviceSpecificData(request.Id, info, profile, authInfo, request.MaxStreamingBitrate ?? profile.MaxStreamingBitrate, request.StartTimeTicks ?? 0, mediaSourceId, request.AudioStreamIndex, request.SubtitleStreamIndex, request.MaxAudioChannels, request.UserId, request.EnableDirectPlay, request.ForceDirectPlayRemoteMediaSource, request.EnableDirectStream, request.EnableTranscoding); } return info; @@ -253,6 +253,7 @@ namespace MediaBrowser.Api.Playback int? maxAudioChannels, string userId, bool enableDirectPlay, + bool forceDirectPlayRemoteMediaSource, bool enableDirectStream, bool enableTranscoding) { @@ -260,7 +261,7 @@ namespace MediaBrowser.Api.Playback foreach (var mediaSource in result.MediaSources) { - SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, maxAudioChannels, result.PlaySessionId, userId, enableDirectPlay, enableDirectStream, enableTranscoding); + SetDeviceSpecificData(item, mediaSource, profile, auth, maxBitrate, startTimeTicks, mediaSourceId, audioStreamIndex, subtitleStreamIndex, maxAudioChannels, result.PlaySessionId, userId, enableDirectPlay, forceDirectPlayRemoteMediaSource, enableDirectStream, enableTranscoding); } SortMediaSources(result, maxBitrate); @@ -279,6 +280,7 @@ namespace MediaBrowser.Api.Playback string playSessionId, string userId, bool enableDirectPlay, + bool forceDirectPlayRemoteMediaSource, bool enableDirectStream, bool enableTranscoding) { @@ -318,43 +320,49 @@ namespace MediaBrowser.Api.Playback if (mediaSource.SupportsDirectPlay) { - var supportsDirectStream = mediaSource.SupportsDirectStream; - - // Dummy this up to fool StreamBuilder - mediaSource.SupportsDirectStream = true; - options.MaxBitrate = maxBitrate; - - if (item is Audio) + if (mediaSource.IsRemote && forceDirectPlayRemoteMediaSource) { - if (!user.Policy.EnableAudioPlaybackTranscoding) + } + else + { + var supportsDirectStream = mediaSource.SupportsDirectStream; + + // Dummy this up to fool StreamBuilder + mediaSource.SupportsDirectStream = true; + options.MaxBitrate = maxBitrate; + + if (item is Audio) { - options.ForceDirectPlay = true; + if (!user.Policy.EnableAudioPlaybackTranscoding) + { + options.ForceDirectPlay = true; + } } - } - else if (item is Video) - { - if (!user.Policy.EnableAudioPlaybackTranscoding && !user.Policy.EnableVideoPlaybackTranscoding && !user.Policy.EnablePlaybackRemuxing) + else if (item is Video) { - options.ForceDirectPlay = true; + if (!user.Policy.EnableAudioPlaybackTranscoding && !user.Policy.EnableVideoPlaybackTranscoding && !user.Policy.EnablePlaybackRemuxing) + { + options.ForceDirectPlay = true; + } } - } - // The MediaSource supports direct stream, now test to see if the client supports it - var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ? - streamBuilder.BuildAudioItem(options) : - streamBuilder.BuildVideoItem(options); + // The MediaSource supports direct stream, now test to see if the client supports it + var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ? + streamBuilder.BuildAudioItem(options) : + streamBuilder.BuildVideoItem(options); - if (streamInfo == null || !streamInfo.IsDirectStream) - { - mediaSource.SupportsDirectPlay = false; - } + if (streamInfo == null || !streamInfo.IsDirectStream) + { + mediaSource.SupportsDirectPlay = false; + } - // Set this back to what it was - mediaSource.SupportsDirectStream = supportsDirectStream; + // Set this back to what it was + mediaSource.SupportsDirectStream = supportsDirectStream; - if (streamInfo != null) - { - SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token); + if (streamInfo != null) + { + SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token); + } } } diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 80b9cc154..ebcc9853a 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1670,6 +1670,11 @@ namespace MediaBrowser.Controller.MediaEncoding case "h264": if (_mediaEncoder.SupportsDecoder("h264_qsv")) { + // qsv decoder does not support 10-bit input + if ((state.VideoStream.BitDepth ?? 8) > 8) + { + return null; + } return "-c:v h264_qsv "; } break; diff --git a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs index 57a2254b0..16c9464ac 100644 --- a/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs +++ b/MediaBrowser.Model/MediaInfo/PlaybackInfoRequest.cs @@ -27,9 +27,11 @@ namespace MediaBrowser.Model.MediaInfo public bool EnableDirectPlay { get; set; } public bool EnableDirectStream { get; set; } public bool EnableTranscoding { get; set; } + public bool ForceDirectPlayRemoteMediaSource { get; set; } public PlaybackInfoRequest() { + ForceDirectPlayRemoteMediaSource = true; EnableDirectPlay = true; EnableDirectStream = true; EnableTranscoding = true; diff --git a/MediaBrowser.Server.Mac/MacAppHost.cs b/MediaBrowser.Server.Mac/MacAppHost.cs index 59e72e71e..f84e96126 100644 --- a/MediaBrowser.Server.Mac/MacAppHost.cs +++ b/MediaBrowser.Server.Mac/MacAppHost.cs @@ -56,42 +56,6 @@ namespace MediaBrowser.Server.Mac return new SyncManager(); } - protected override FFMpegInstallInfo GetFfmpegInstallInfo() - { - var info = new FFMpegInstallInfo(); - - info.ArchiveType = "7z"; - - switch (EnvironmentInfo.SystemArchitecture) - { - case Architecture.X64: - info.Version = "20160124"; - break; - case Architecture.X86: - info.Version = "20150110"; - break; - } - - info.DownloadUrls = GetDownloadUrls(); - - return info; - } - - private string[] GetDownloadUrls() - { - switch (EnvironmentInfo.SystemArchitecture) - { - case Architecture.X64: - return new[] - { - "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z" - }; - } - - // No version available - return new string[] { }; - } - protected override void RestartInternal() { MainClass.Restart(); diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 7ebbc3809..02916f555 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -143,7 +143,6 @@ - diff --git a/MediaBrowser.ServerApplication/Native/LoopbackUtil.cs b/MediaBrowser.ServerApplication/Native/LoopbackUtil.cs deleted file mode 100644 index 5b260685b..000000000 --- a/MediaBrowser.ServerApplication/Native/LoopbackUtil.cs +++ /dev/null @@ -1,358 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; - -namespace MediaBrowser.ServerApplication.Native -{ - /// - /// http://blogs.msdn.com/b/fiddler/archive/2011/12/10/fiddler-windows-8-apps-enable-LoopUtil-network-isolation-exemption.aspx - /// - public class LoopUtil - { - //http://msdn.microsoft.com/en-us/library/windows/desktop/aa379595(v=vs.85).aspx - [StructLayout(LayoutKind.Sequential)] - internal struct SID_AND_ATTRIBUTES - { - public IntPtr Sid; - public uint Attributes; - } - - [StructLayoutAttribute(LayoutKind.Sequential)] - internal struct INET_FIREWALL_AC_CAPABILITIES - { - public uint count; - public IntPtr capabilities; //SID_AND_ATTRIBUTES - } - - [StructLayoutAttribute(LayoutKind.Sequential)] - internal struct INET_FIREWALL_AC_BINARIES - { - public uint count; - public IntPtr binaries; - } - - [StructLayoutAttribute(LayoutKind.Sequential)] - internal struct INET_FIREWALL_APP_CONTAINER - { - internal IntPtr appContainerSid; - internal IntPtr userSid; - [MarshalAs(UnmanagedType.LPWStr)] - public string appContainerName; - [MarshalAs(UnmanagedType.LPWStr)] - public string displayName; - [MarshalAs(UnmanagedType.LPWStr)] - public string description; - internal INET_FIREWALL_AC_CAPABILITIES capabilities; - internal INET_FIREWALL_AC_BINARIES binaries; - [MarshalAs(UnmanagedType.LPWStr)] - public string workingDirectory; - [MarshalAs(UnmanagedType.LPWStr)] - public string packageFullName; - } - - - // Call this API to free the memory returned by the Enumeration API - [DllImport("FirewallAPI.dll")] - internal static extern void NetworkIsolationFreeAppContainers(IntPtr pACs); - - // Call this API to load the current list of LoopUtil-enabled AppContainers - [DllImport("FirewallAPI.dll")] - internal static extern uint NetworkIsolationGetAppContainerConfig(out uint pdwCntACs, out IntPtr appContainerSids); - - // Call this API to set the LoopUtil-exemption list - [DllImport("FirewallAPI.dll")] - private static extern uint NetworkIsolationSetAppContainerConfig(uint pdwCntACs, SID_AND_ATTRIBUTES[] appContainerSids); - - - // Use this API to convert a string SID into an actual SID - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool ConvertStringSidToSid(string strSid, out IntPtr pSid); - - [DllImport("advapi32", CharSet = CharSet.Auto, SetLastError = true)] - static extern bool ConvertSidToStringSid( - [MarshalAs(UnmanagedType.LPArray)] byte[] pSID, - out IntPtr ptrSid); - - [DllImport("advapi32", CharSet = CharSet.Auto, SetLastError = true)] - static extern bool ConvertSidToStringSid(IntPtr pSid, out string strSid); - - // Use this API to convert a string reference (e.g. "@{blah.pri?ms-resource://whatever}") into a plain string - [DllImport("shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)] - internal static extern int SHLoadIndirectString(string pszSource, StringBuilder pszOutBuf); - - // Call this API to enumerate all of the AppContainers on the system - [DllImport("FirewallAPI.dll")] - internal static extern uint NetworkIsolationEnumAppContainers(uint Flags, out uint pdwCntPublicACs, out IntPtr ppACs); - // DWORD NetworkIsolationEnumAppContainers( - // _In_ DWORD Flags, - // _Out_ DWORD *pdwNumPublicAppCs, - // _Out_ PINET_FIREWALL_APP_CONTAINER *ppPublicAppCs - //); - - //http://msdn.microsoft.com/en-gb/library/windows/desktop/hh968116.aspx - enum NETISO_FLAG - { - NETISO_FLAG_FORCE_COMPUTE_BINARIES = 0x1, - NETISO_FLAG_MAX = 0x2 - } - - - public class AppContainer - { - public String appContainerName { get; set; } - public String displayName { get; set; } - public String workingDirectory { get; set; } - public String StringSid { get; set; } - public List capabilities { get; set; } - public bool LoopUtil { get; set; } - - public AppContainer(String _appContainerName, String _displayName, String _workingDirectory, IntPtr _sid) - { - this.appContainerName = _appContainerName; - this.displayName = _displayName; - this.workingDirectory = _workingDirectory; - String tempSid; - ConvertSidToStringSid(_sid, out tempSid); - this.StringSid = tempSid; - } - } - - internal List _AppList; - internal List _AppListConfig; - public List Apps = new List(); - internal IntPtr _pACs; - - public LoopUtil() - { - LoadApps(); - } - - public void LoadApps() - { - Apps.Clear(); - _pACs = IntPtr.Zero; - //Full List of Apps - _AppList = PI_NetworkIsolationEnumAppContainers(); - //List of Apps that have LoopUtil enabled. - _AppListConfig = PI_NetworkIsolationGetAppContainerConfig(); - foreach (var PI_app in _AppList) - { - AppContainer app = new AppContainer(PI_app.appContainerName, PI_app.displayName, PI_app.workingDirectory, PI_app.appContainerSid); - - var app_capabilities = LoopUtil.getCapabilites(PI_app.capabilities); - if (app_capabilities.Count > 0) - { - //var sid = new SecurityIdentifier(app_capabilities[0], 0); - - IntPtr arrayValue = IntPtr.Zero; - //var b = LoopUtil.ConvertStringSidToSid(app_capabilities[0].Sid, out arrayValue); - //string mysid; - //var b = LoopUtil.ConvertSidToStringSid(app_capabilities[0].Sid, out mysid); - } - app.LoopUtil = CheckLoopback(PI_app.appContainerSid); - Apps.Add(app); - } - } - private bool CheckLoopback(IntPtr intPtr) - { - foreach (SID_AND_ATTRIBUTES item in _AppListConfig) - { - string left, right; - ConvertSidToStringSid(item.Sid, out left); - ConvertSidToStringSid(intPtr, out right); - - if (left == right) - { - return true; - } - } - return false; - } - - private bool CreateExcemptions(string appName) - { - var hasChanges = false; - - foreach (var app in Apps) - { - if ((app.appContainerName ?? string.Empty).IndexOf(appName, StringComparison.OrdinalIgnoreCase) != -1 || - (app.displayName ?? string.Empty).IndexOf(appName, StringComparison.OrdinalIgnoreCase) != -1) - { - if (!app.LoopUtil) - { - app.LoopUtil = true; - hasChanges = true; - } - } - } - - return hasChanges; - } - - public static void Run(string appName) - { - var util = new LoopUtil(); - util.LoadApps(); - - var hasChanges = util.CreateExcemptions(appName); - - if (hasChanges) - { - util.SaveLoopbackState(); - } - util.SaveLoopbackState(); - } - - private static List getCapabilites(INET_FIREWALL_AC_CAPABILITIES cap) - { - List mycap = new List(); - - IntPtr arrayValue = cap.capabilities; - - var structSize = Marshal.SizeOf(typeof(SID_AND_ATTRIBUTES)); - for (var i = 0; i < cap.count; i++) - { - var cur = (SID_AND_ATTRIBUTES)Marshal.PtrToStructure(arrayValue, typeof(SID_AND_ATTRIBUTES)); - mycap.Add(cur); - arrayValue = new IntPtr((long)(arrayValue) + (long)(structSize)); - } - - return mycap; - - } - - private static List getContainerSID(INET_FIREWALL_AC_CAPABILITIES cap) - { - List mycap = new List(); - - IntPtr arrayValue = cap.capabilities; - - var structSize = Marshal.SizeOf(typeof(SID_AND_ATTRIBUTES)); - for (var i = 0; i < cap.count; i++) - { - var cur = (SID_AND_ATTRIBUTES)Marshal.PtrToStructure(arrayValue, typeof(SID_AND_ATTRIBUTES)); - mycap.Add(cur); - arrayValue = new IntPtr((long)(arrayValue) + (long)(structSize)); - } - - return mycap; - - } - - private static List PI_NetworkIsolationGetAppContainerConfig() - { - - IntPtr arrayValue = IntPtr.Zero; - uint size = 0; - var list = new List(); - - // Pin down variables - GCHandle handle_pdwCntPublicACs = GCHandle.Alloc(size, GCHandleType.Pinned); - GCHandle handle_ppACs = GCHandle.Alloc(arrayValue, GCHandleType.Pinned); - - uint retval = NetworkIsolationGetAppContainerConfig(out size, out arrayValue); - - var structSize = Marshal.SizeOf(typeof(SID_AND_ATTRIBUTES)); - for (var i = 0; i < size; i++) - { - var cur = (SID_AND_ATTRIBUTES)Marshal.PtrToStructure(arrayValue, typeof(SID_AND_ATTRIBUTES)); - list.Add(cur); - arrayValue = new IntPtr((long)(arrayValue) + (long)(structSize)); - } - - //release pinned variables. - handle_pdwCntPublicACs.Free(); - handle_ppACs.Free(); - - return list; - - - } - - private List PI_NetworkIsolationEnumAppContainers() - { - - IntPtr arrayValue = IntPtr.Zero; - uint size = 0; - var list = new List(); - - // Pin down variables - GCHandle handle_pdwCntPublicACs = GCHandle.Alloc(size, GCHandleType.Pinned); - GCHandle handle_ppACs = GCHandle.Alloc(arrayValue, GCHandleType.Pinned); - - //uint retval2 = NetworkIsolationGetAppContainerConfig( out size, out arrayValue); - - uint retval = NetworkIsolationEnumAppContainers((Int32)NETISO_FLAG.NETISO_FLAG_MAX, out size, out arrayValue); - _pACs = arrayValue; //store the pointer so it can be freed when we close the form - - var structSize = Marshal.SizeOf(typeof(INET_FIREWALL_APP_CONTAINER)); - for (var i = 0; i < size; i++) - { - var cur = (INET_FIREWALL_APP_CONTAINER)Marshal.PtrToStructure(arrayValue, typeof(INET_FIREWALL_APP_CONTAINER)); - list.Add(cur); - arrayValue = new IntPtr((long)(arrayValue) + (long)(structSize)); - } - - //release pinned variables. - handle_pdwCntPublicACs.Free(); - handle_ppACs.Free(); - - return list; - - - } - - public bool SaveLoopbackState() - { - var countEnabled = CountEnabledLoopUtil(); - SID_AND_ATTRIBUTES[] arr = new SID_AND_ATTRIBUTES[countEnabled]; - int count = 0; - - for (int i = 0; i < Apps.Count; i++) - { - if (Apps[i].LoopUtil) - { - arr[count].Attributes = 0; - //TO DO: - IntPtr ptr; - ConvertStringSidToSid(Apps[i].StringSid, out ptr); - arr[count].Sid = ptr; - count++; - } - - } - - - if (NetworkIsolationSetAppContainerConfig((uint)countEnabled, arr) == 0) - { - return true; - } - else - { return false; } - - } - - private int CountEnabledLoopUtil() - { - var count = 0; - for (int i = 0; i < Apps.Count; i++) - { - if (Apps[i].LoopUtil) - { - count++; - } - - } - return count; - } - - public void FreeResources() - { - NetworkIsolationFreeAppContainers(_pACs); - } - - } -} diff --git a/MediaBrowser.ServerApplication/WindowsAppHost.cs b/MediaBrowser.ServerApplication/WindowsAppHost.cs index cc899462a..915a2fa86 100644 --- a/MediaBrowser.ServerApplication/WindowsAppHost.cs +++ b/MediaBrowser.ServerApplication/WindowsAppHost.cs @@ -10,6 +10,7 @@ using Emby.Server.Core; using Emby.Server.Implementations; using Emby.Server.Implementations.EntryPoints; using Emby.Server.Implementations.FFMpeg; +using Emby.Server.Implementations.Windows; using Emby.Server.Sync; using MediaBrowser.Controller.Connect; using MediaBrowser.Controller.Sync; @@ -107,11 +108,6 @@ namespace MediaBrowser.ServerApplication } } - protected override void EnableLoopbackInternal(string appName) - { - LoopUtil.Run(appName); - } - public override bool SupportsRunningAsService { get diff --git a/SocketHttpListener.Portable/Net/HttpListenerRequest.cs b/SocketHttpListener.Portable/Net/HttpListenerRequest.cs index 811cc6ddb..cfbd49203 100644 --- a/SocketHttpListener.Portable/Net/HttpListenerRequest.cs +++ b/SocketHttpListener.Portable/Net/HttpListenerRequest.cs @@ -456,7 +456,7 @@ namespace SocketHttpListener.Net public long ContentLength64 { - get { return content_length; } + get { return is_chunked ? -1 : content_length; } } public string ContentType