commit
4cc15a8919
|
@ -125,15 +125,15 @@ namespace Emby.Common.Implementations.Net
|
|||
|
||||
try
|
||||
{
|
||||
#if NETSTANDARD1_3
|
||||
// The ExclusiveAddressUse socket option is a Windows-specific option that, when set to "true," tells Windows not to allow another socket to use the same local address as this socket
|
||||
// See https://github.com/dotnet/corefx/pull/11509 for more details
|
||||
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
|
||||
#if NET46
|
||||
retVal.ExclusiveAddressUse = false;
|
||||
#else
|
||||
// The ExclusiveAddressUse socket option is a Windows-specific option that, when set to "true," tells Windows not to allow another socket to use the same local address as this socket
|
||||
// See https://github.com/dotnet/corefx/pull/11509 for more details
|
||||
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
|
||||
{
|
||||
retVal.ExclusiveAddressUse = false;
|
||||
}
|
||||
#else
|
||||
retVal.ExclusiveAddressUse = false;
|
||||
#endif
|
||||
//retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
|
||||
retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
||||
|
|
|
@ -245,7 +245,7 @@ namespace Emby.Common.Implementations.Networking
|
|||
//}
|
||||
|
||||
return ipProperties.UnicastAddresses
|
||||
.Where(i => i.IsDnsEligible)
|
||||
//.Where(i => i.IsDnsEligible)
|
||||
.Select(i => i.Address)
|
||||
.Where(i => i.AddressFamily == AddressFamily.InterNetwork)
|
||||
.ToList();
|
||||
|
|
|
@ -98,6 +98,9 @@ namespace Emby.Dlna.ContentDirectory
|
|||
if (string.Equals(methodName, "Search", StringComparison.OrdinalIgnoreCase))
|
||||
return HandleSearch(methodParams, user, deviceId).Result;
|
||||
|
||||
if (string.Equals(methodName, "X_BrowseByLetter", StringComparison.OrdinalIgnoreCase))
|
||||
return HandleX_BrowseByLetter(methodParams, user, deviceId).Result;
|
||||
|
||||
throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
|
||||
}
|
||||
|
||||
|
@ -118,7 +121,7 @@ namespace Emby.Dlna.ContentDirectory
|
|||
_userDataManager.SaveUserData(user.Id, item, userdata, UserDataSaveReason.TogglePlayed,
|
||||
CancellationToken.None);
|
||||
|
||||
return new Dictionary<string,string>(StringComparer.OrdinalIgnoreCase);
|
||||
return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private IEnumerable<KeyValuePair<string, string>> HandleGetSearchCapabilities()
|
||||
|
@ -147,7 +150,7 @@ namespace Emby.Dlna.ContentDirectory
|
|||
|
||||
private IEnumerable<KeyValuePair<string, string>> HandleGetSystemUpdateID()
|
||||
{
|
||||
var headers = new Dictionary<string,string>(StringComparer.OrdinalIgnoreCase);
|
||||
var headers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
headers.Add("Id", _systemUpdateId.ToString(_usCulture));
|
||||
return headers;
|
||||
}
|
||||
|
@ -309,6 +312,12 @@ namespace Emby.Dlna.ContentDirectory
|
|||
};
|
||||
}
|
||||
|
||||
private Task<IEnumerable<KeyValuePair<string, string>>> HandleX_BrowseByLetter(IDictionary<string, string> sparams, User user, string deviceId)
|
||||
{
|
||||
// TODO: Implement this method
|
||||
return HandleSearch(sparams, user, deviceId);
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<KeyValuePair<string, string>>> HandleSearch(IDictionary<string, string> sparams, User user, string deviceId)
|
||||
{
|
||||
var searchCriteria = new SearchCriteria(GetValueOrDefault(sparams, "SearchCriteria", ""));
|
||||
|
@ -553,20 +562,6 @@ namespace Emby.Dlna.ContentDirectory
|
|||
return result;
|
||||
}
|
||||
|
||||
private bool EnablePeopleDisplay(BaseItem item)
|
||||
{
|
||||
if (_libraryManager.GetPeopleNames(new InternalPeopleQuery
|
||||
{
|
||||
ItemId = item.Id
|
||||
|
||||
}).Count > 0)
|
||||
{
|
||||
return item is Movie;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private ServerItem GetItemFromObjectId(string id, User user)
|
||||
{
|
||||
return DidlBuilder.IsIdRoot(id)
|
||||
|
|
|
@ -207,8 +207,7 @@ namespace Emby.Dlna.Didl
|
|||
streamInfo.TargetVideoStreamCount,
|
||||
streamInfo.TargetAudioStreamCount,
|
||||
streamInfo.TargetVideoCodecTag,
|
||||
streamInfo.IsTargetAVC,
|
||||
streamInfo.AllAudioCodecs);
|
||||
streamInfo.IsTargetAVC);
|
||||
|
||||
foreach (var contentFeature in contentFeatureList)
|
||||
{
|
||||
|
@ -348,8 +347,7 @@ namespace Emby.Dlna.Didl
|
|||
streamInfo.TargetVideoStreamCount,
|
||||
streamInfo.TargetAudioStreamCount,
|
||||
streamInfo.TargetVideoCodecTag,
|
||||
streamInfo.IsTargetAVC,
|
||||
streamInfo.AllAudioCodecs);
|
||||
streamInfo.IsTargetAVC);
|
||||
|
||||
var filename = url.Substring(0, url.IndexOf('?'));
|
||||
|
||||
|
|
|
@ -541,8 +541,7 @@ namespace Emby.Dlna.PlayTo
|
|||
streamInfo.TargetVideoStreamCount,
|
||||
streamInfo.TargetAudioStreamCount,
|
||||
streamInfo.TargetVideoCodecTag,
|
||||
streamInfo.IsTargetAVC,
|
||||
streamInfo.AllAudioCodecs);
|
||||
streamInfo.IsTargetAVC);
|
||||
|
||||
return list.FirstOrDefault();
|
||||
}
|
||||
|
|
|
@ -102,11 +102,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
|
|||
/// <returns>Task.</returns>
|
||||
public Task SendAsync(byte[] bytes, bool endOfMessage, CancellationToken cancellationToken)
|
||||
{
|
||||
var completionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
WebSocket.SendAsync(bytes, res => completionSource.TrySetResult(true));
|
||||
|
||||
return completionSource.Task;
|
||||
return WebSocket.SendAsync(bytes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -118,11 +114,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
|
|||
/// <returns>Task.</returns>
|
||||
public Task SendAsync(string text, bool endOfMessage, CancellationToken cancellationToken)
|
||||
{
|
||||
var completionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
WebSocket.SendAsync(text, res => completionSource.TrySetResult(true));
|
||||
|
||||
return completionSource.Task;
|
||||
return WebSocket.SendAsync(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -151,9 +151,10 @@ namespace MediaBrowser.Api
|
|||
}
|
||||
|
||||
if (client.IndexOf("web", StringComparison.OrdinalIgnoreCase) == -1 &&
|
||||
|
||||
// covers both emby mobile and emby for android mobile
|
||||
client.IndexOf("mobile", StringComparison.OrdinalIgnoreCase) == -1 &&
|
||||
client.IndexOf("ios", StringComparison.OrdinalIgnoreCase) == -1 &&
|
||||
client.IndexOf("android", StringComparison.OrdinalIgnoreCase) == -1 &&
|
||||
client.IndexOf("theater", StringComparison.OrdinalIgnoreCase) == -1)
|
||||
{
|
||||
options.Fields.Add(Model.Querying.ItemFields.ChildCount);
|
||||
|
|
|
@ -2358,8 +2358,7 @@ namespace MediaBrowser.Api.Playback
|
|||
state.TargetVideoStreamCount,
|
||||
state.TargetAudioStreamCount,
|
||||
state.TargetVideoCodecTag,
|
||||
state.IsTargetAVC,
|
||||
state.AllAudioCodecs);
|
||||
state.IsTargetAVC);
|
||||
|
||||
if (mediaProfile != null)
|
||||
{
|
||||
|
@ -2581,8 +2580,7 @@ namespace MediaBrowser.Api.Playback
|
|||
state.TargetVideoStreamCount,
|
||||
state.TargetAudioStreamCount,
|
||||
state.TargetVideoCodecTag,
|
||||
state.IsTargetAVC,
|
||||
state.AllAudioCodecs
|
||||
state.IsTargetAVC
|
||||
|
||||
).FirstOrDefault() ?? string.Empty;
|
||||
}
|
||||
|
|
|
@ -245,17 +245,6 @@ namespace MediaBrowser.Api.Playback
|
|||
public int? OutputAudioBitrate;
|
||||
public int? OutputVideoBitrate;
|
||||
|
||||
public List<string> AllAudioCodecs
|
||||
{
|
||||
get
|
||||
{
|
||||
return MediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio)
|
||||
.Select(i => i.Codec)
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public string ActualOutputVideoCodec
|
||||
{
|
||||
get
|
||||
|
|
|
@ -118,17 +118,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
}
|
||||
}
|
||||
|
||||
public List<string> AllAudioCodecs
|
||||
{
|
||||
get
|
||||
{
|
||||
return MediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio)
|
||||
.Select(i => i.Codec)
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
private void DisposeIsoMount()
|
||||
{
|
||||
if (IsoMount != null)
|
||||
|
|
|
@ -846,8 +846,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
state.TargetVideoStreamCount,
|
||||
state.TargetAudioStreamCount,
|
||||
state.TargetVideoCodecTag,
|
||||
state.IsTargetAVC,
|
||||
state.AllAudioCodecs);
|
||||
state.IsTargetAVC);
|
||||
|
||||
if (mediaProfile != null)
|
||||
{
|
||||
|
|
|
@ -24,15 +24,12 @@ namespace MediaBrowser.Model.Dlna
|
|||
int? numVideoStreams,
|
||||
int? numAudioStreams,
|
||||
string videoCodecTag,
|
||||
bool? isAvc,
|
||||
List<string> allAudioCodecs )
|
||||
bool? isAvc )
|
||||
{
|
||||
switch (condition.Property)
|
||||
{
|
||||
case ProfileConditionValue.IsAnamorphic:
|
||||
return IsConditionSatisfied(condition, isAnamorphic);
|
||||
case ProfileConditionValue.HasAudioCodec:
|
||||
return IsHasAudioCodecConditionSatisfied(condition, allAudioCodecs);
|
||||
case ProfileConditionValue.IsAvc:
|
||||
return IsConditionSatisfied(condition, isAvc);
|
||||
case ProfileConditionValue.VideoFramerate:
|
||||
|
@ -167,25 +164,6 @@ namespace MediaBrowser.Model.Dlna
|
|||
}
|
||||
}
|
||||
|
||||
private bool IsHasAudioCodecConditionSatisfied(ProfileCondition condition, List<string> allAudioCodecs)
|
||||
{
|
||||
if (allAudioCodecs.Count == 0)
|
||||
{
|
||||
// If the value is unknown, it satisfies if not marked as required
|
||||
return !condition.IsRequired;
|
||||
}
|
||||
|
||||
switch (condition.Condition)
|
||||
{
|
||||
case ProfileConditionType.Equals:
|
||||
return allAudioCodecs.Contains(condition.Value, StringComparer.Ordinal);
|
||||
case ProfileConditionType.NotEquals:
|
||||
return !allAudioCodecs.Contains(condition.Value, StringComparer.Ordinal);
|
||||
default:
|
||||
throw new InvalidOperationException("Unexpected ProfileConditionType");
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsConditionSatisfied(ProfileCondition condition, bool? currentValue)
|
||||
{
|
||||
if (!currentValue.HasValue)
|
||||
|
|
|
@ -119,8 +119,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
int? numVideoStreams,
|
||||
int? numAudioStreams,
|
||||
string videoCodecTag,
|
||||
bool? isAvc,
|
||||
List<string> allAudioCodecs)
|
||||
bool? isAvc)
|
||||
{
|
||||
// first bit means Time based seek supported, second byte range seek supported (not sure about the order now), so 01 = only byte seek, 10 = time based, 11 = both, 00 = none
|
||||
string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetOrgOpValue(runtimeTicks.HasValue, isDirectStream, transcodeSeekInfo);
|
||||
|
@ -162,8 +161,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
numVideoStreams,
|
||||
numAudioStreams,
|
||||
videoCodecTag,
|
||||
isAvc,
|
||||
allAudioCodecs);
|
||||
isAvc);
|
||||
|
||||
List<string> orgPnValues = new List<string>();
|
||||
|
||||
|
|
|
@ -297,8 +297,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
int? numVideoStreams,
|
||||
int? numAudioStreams,
|
||||
string videoCodecTag,
|
||||
bool? isAvc,
|
||||
List<string> allAudioCodecs)
|
||||
bool? isAvc)
|
||||
{
|
||||
container = StringHelper.TrimStart(container ?? string.Empty, '.');
|
||||
|
||||
|
@ -332,7 +331,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
var anyOff = false;
|
||||
foreach (ProfileCondition c in i.Conditions)
|
||||
{
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(GetModelProfileCondition(c), width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc, allAudioCodecs))
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(GetModelProfileCondition(c), width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
|
||||
{
|
||||
anyOff = true;
|
||||
break;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
NumVideoStreams = 17,
|
||||
IsSecondaryAudio = 18,
|
||||
VideoCodecTag = 19,
|
||||
IsAvc = 20,
|
||||
HasAudioCodec = 21
|
||||
IsAvc = 20
|
||||
}
|
||||
}
|
|
@ -411,7 +411,6 @@ namespace MediaBrowser.Model.Dlna
|
|||
}
|
||||
|
||||
var allMediaStreams = item.MediaStreams;
|
||||
var allAudioCodecs = allMediaStreams.Where(i => i.Type == MediaStreamType.Audio).Select(i => i.Codec).Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
|
||||
|
||||
MediaStream videoStream = item.VideoStream;
|
||||
|
||||
|
@ -556,7 +555,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
int? numAudioStreams = item.GetStreamCount(MediaStreamType.Audio);
|
||||
int? numVideoStreams = item.GetStreamCount(MediaStreamType.Video);
|
||||
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc, allAudioCodecs))
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
|
||||
{
|
||||
LogConditionFailure(options.Profile, "VideoCodecProfile", applyCondition, item);
|
||||
applyConditions = false;
|
||||
|
@ -739,12 +738,10 @@ namespace MediaBrowser.Model.Dlna
|
|||
int? numAudioStreams = mediaSource.GetStreamCount(MediaStreamType.Audio);
|
||||
int? numVideoStreams = mediaSource.GetStreamCount(MediaStreamType.Video);
|
||||
|
||||
var allAudioCodecs = allMediaStreams.Where(i => i.Type == MediaStreamType.Audio).Select(i => i.Codec).Where(i => !string.IsNullOrWhiteSpace(i)).ToList();
|
||||
|
||||
// Check container conditions
|
||||
foreach (ProfileCondition i in conditions)
|
||||
{
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc, allAudioCodecs))
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
|
||||
{
|
||||
LogConditionFailure(profile, "VideoContainerProfile", i, mediaSource);
|
||||
|
||||
|
@ -771,7 +768,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
bool applyConditions = true;
|
||||
foreach (ProfileCondition applyCondition in i.ApplyConditions)
|
||||
{
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc, allAudioCodecs))
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
|
||||
{
|
||||
LogConditionFailure(profile, "VideoCodecProfile", applyCondition, mediaSource);
|
||||
applyConditions = false;
|
||||
|
@ -791,7 +788,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
|
||||
foreach (ProfileCondition i in conditions)
|
||||
{
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc, allAudioCodecs))
|
||||
if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
|
||||
{
|
||||
LogConditionFailure(profile, "VideoCodecProfile", i, mediaSource);
|
||||
|
||||
|
|
|
@ -413,17 +413,6 @@ namespace MediaBrowser.Model.Dlna
|
|||
}
|
||||
}
|
||||
|
||||
public List<string> AllAudioCodecs
|
||||
{
|
||||
get
|
||||
{
|
||||
return MediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio)
|
||||
.Select(i => i.Codec)
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the video stream that will be used
|
||||
/// </summary>
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Cryptography;
|
||||
using MediaBrowser.Model.IO;
|
||||
using SocketHttpListener.Net.WebSockets;
|
||||
|
@ -621,26 +622,22 @@ namespace SocketHttpListener
|
|||
}
|
||||
}
|
||||
|
||||
private void sendAsync(Opcode opcode, Stream stream, Action<bool> completed)
|
||||
private Task sendAsync(Opcode opcode, Stream stream)
|
||||
{
|
||||
Func<Opcode, Stream, bool> sender = send;
|
||||
sender.BeginInvoke(
|
||||
opcode,
|
||||
stream,
|
||||
ar =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var sent = sender.EndInvoke(ar);
|
||||
if (completed != null)
|
||||
completed(sent);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
error("An exception has occurred while callback.", ex);
|
||||
}
|
||||
},
|
||||
null);
|
||||
var completionSource = new TaskCompletionSource<bool>();
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
send(opcode, stream);
|
||||
completionSource.TrySetResult(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
completionSource.TrySetException(ex);
|
||||
}
|
||||
});
|
||||
return completionSource.Task;
|
||||
}
|
||||
|
||||
// As server
|
||||
|
@ -833,22 +830,18 @@ namespace SocketHttpListener
|
|||
/// <param name="data">
|
||||
/// An array of <see cref="byte"/> that represents the binary data to send.
|
||||
/// </param>
|
||||
/// <param name="completed">
|
||||
/// An Action<bool> delegate that references the method(s) called when the send is
|
||||
/// complete. A <see cref="bool"/> passed to this delegate is <c>true</c> if the send is
|
||||
/// complete successfully; otherwise, <c>false</c>.
|
||||
/// </param>
|
||||
public void SendAsync(byte[] data, Action<bool> completed)
|
||||
public Task SendAsync(byte[] data)
|
||||
{
|
||||
var msg = _readyState.CheckIfOpen() ?? data.CheckIfValidSendData();
|
||||
if (msg != null)
|
||||
{
|
||||
error(msg);
|
||||
|
||||
return;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
sendAsync(Opcode.Binary, _memoryStreamFactory.CreateNew(data), completed);
|
||||
return sendAsync(Opcode.Binary, _memoryStreamFactory.CreateNew(data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -860,22 +853,18 @@ namespace SocketHttpListener
|
|||
/// <param name="data">
|
||||
/// A <see cref="string"/> that represents the text data to send.
|
||||
/// </param>
|
||||
/// <param name="completed">
|
||||
/// An Action<bool> delegate that references the method(s) called when the send is
|
||||
/// complete. A <see cref="bool"/> passed to this delegate is <c>true</c> if the send is
|
||||
/// complete successfully; otherwise, <c>false</c>.
|
||||
/// </param>
|
||||
public void SendAsync(string data, Action<bool> completed)
|
||||
public Task SendAsync(string data)
|
||||
{
|
||||
var msg = _readyState.CheckIfOpen() ?? data.CheckIfValidSendData();
|
||||
if (msg != null)
|
||||
{
|
||||
error(msg);
|
||||
|
||||
return;
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
sendAsync(Opcode.Text, _memoryStreamFactory.CreateNew(Encoding.UTF8.GetBytes(data)), completed);
|
||||
return sendAsync(Opcode.Text, _memoryStreamFactory.CreateNew(Encoding.UTF8.GetBytes(data)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -215,9 +215,12 @@ namespace Emby.Server
|
|||
|
||||
var initProgress = new Progress<double>();
|
||||
|
||||
// Not crazy about this but it's the only way to suppress ffmpeg crash dialog boxes
|
||||
SetErrorMode(ErrorModes.SEM_FAILCRITICALERRORS | ErrorModes.SEM_NOALIGNMENTFAULTEXCEPT |
|
||||
ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX);
|
||||
if (environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)
|
||||
{
|
||||
// Not crazy about this but it's the only way to suppress ffmpeg crash dialog boxes
|
||||
SetErrorMode(ErrorModes.SEM_FAILCRITICALERRORS | ErrorModes.SEM_NOALIGNMENTFAULTEXCEPT |
|
||||
ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX);
|
||||
}
|
||||
|
||||
var task = _appHost.Init(initProgress);
|
||||
Task.WaitAll(task);
|
||||
|
|
Loading…
Reference in New Issue
Block a user