aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-12-14 16:01:33 -0500
committerGitHub <noreply@github.com>2016-12-14 16:01:33 -0500
commit4cc15a8919ce9eabe6901407381336e796e1f396 (patch)
tree43b077c17cc7070ce2b911bc58cdf6d5ead739f3
parent96e6b519b9997af1a0199142909d674c4e05dfd0 (diff)
parentde9cd28a7959f6920c82ff536339653334246c76 (diff)
Merge pull request #2342 from MediaBrowser/dev
Dev
-rw-r--r--Emby.Common.Implementations/Net/SocketFactory.cs12
-rw-r--r--Emby.Common.Implementations/Networking/NetworkManager.cs2
-rw-r--r--Emby.Dlna/ContentDirectory/ControlHandler.cs27
-rw-r--r--Emby.Dlna/Didl/DidlBuilder.cs6
-rw-r--r--Emby.Dlna/PlayTo/PlayToController.cs3
-rw-r--r--Emby.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs12
-rw-r--r--MediaBrowser.Api/BaseApiService.cs3
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs6
-rw-r--r--MediaBrowser.Api/Playback/StreamState.cs11
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs11
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs3
-rw-r--r--MediaBrowser.Model/Dlna/ConditionProcessor.cs24
-rw-r--r--MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs6
-rw-r--r--MediaBrowser.Model/Dlna/DeviceProfile.cs5
-rw-r--r--MediaBrowser.Model/Dlna/ProfileConditionValue.cs3
-rw-r--r--MediaBrowser.Model/Dlna/StreamBuilder.cs11
-rw-r--r--MediaBrowser.Model/Dlna/StreamInfo.cs11
-rw-r--r--SocketHttpListener.Portable/WebSocket.cs55
-rw-r--r--src/Emby.Server/Program.cs9
19 files changed, 66 insertions, 154 deletions
diff --git a/Emby.Common.Implementations/Net/SocketFactory.cs b/Emby.Common.Implementations/Net/SocketFactory.cs
index 1f41ffff5..70c7ba845 100644
--- a/Emby.Common.Implementations/Net/SocketFactory.cs
+++ b/Emby.Common.Implementations/Net/SocketFactory.cs
@@ -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);
diff --git a/Emby.Common.Implementations/Networking/NetworkManager.cs b/Emby.Common.Implementations/Networking/NetworkManager.cs
index a4e6d47d4..4485e8b14 100644
--- a/Emby.Common.Implementations/Networking/NetworkManager.cs
+++ b/Emby.Common.Implementations/Networking/NetworkManager.cs
@@ -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();
diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.cs
index 98a151f29..bba8c53d9 100644
--- a/Emby.Dlna/ContentDirectory/ControlHandler.cs
+++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs
@@ -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)
diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs
index e968509b5..3dcdaf2ef 100644
--- a/Emby.Dlna/Didl/DidlBuilder.cs
+++ b/Emby.Dlna/Didl/DidlBuilder.cs
@@ -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('?'));
diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs
index bfc29d0f5..7dff8bda1 100644
--- a/Emby.Dlna/PlayTo/PlayToController.cs
+++ b/Emby.Dlna/PlayTo/PlayToController.cs
@@ -541,8 +541,7 @@ namespace Emby.Dlna.PlayTo
streamInfo.TargetVideoStreamCount,
streamInfo.TargetAudioStreamCount,
streamInfo.TargetVideoCodecTag,
- streamInfo.IsTargetAVC,
- streamInfo.AllAudioCodecs);
+ streamInfo.IsTargetAVC);
return list.FirstOrDefault();
}
diff --git a/Emby.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs b/Emby.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs
index 0a312f7b9..9823a2ff5 100644
--- a/Emby.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs
+++ b/Emby.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs
@@ -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>
diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs
index 7a8951396..07ec6d955 100644
--- a/MediaBrowser.Api/BaseApiService.cs
+++ b/MediaBrowser.Api/BaseApiService.cs
@@ -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);
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 288553ade..3718edba4 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -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;
}
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs
index 9c337781c..d1ef996ae 100644
--- a/MediaBrowser.Api/Playback/StreamState.cs
+++ b/MediaBrowser.Api/Playback/StreamState.cs
@@ -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
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
index 145337a2a..b5ff5cbb6 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
@@ -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)
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
index 70d02901e..e197bdb6f 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
@@ -846,8 +846,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
state.TargetVideoStreamCount,
state.TargetAudioStreamCount,
state.TargetVideoCodecTag,
- state.IsTargetAVC,
- state.AllAudioCodecs);
+ state.IsTargetAVC);
if (mediaProfile != null)
{
diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
index aa0b6f431..e9e76a993 100644
--- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs
+++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
@@ -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)
diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
index c6a5116b4..4a16a2780 100644
--- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
+++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs
@@ -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>();
diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs
index 638f78dcb..821531ed0 100644
--- a/MediaBrowser.Model/Dlna/DeviceProfile.cs
+++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs
@@ -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;
diff --git a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs
index 9d6321c84..7e2002f17 100644
--- a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs
+++ b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs
@@ -21,7 +21,6 @@
NumVideoStreams = 17,
IsSecondaryAudio = 18,
VideoCodecTag = 19,
- IsAvc = 20,
- HasAudioCodec = 21
+ IsAvc = 20
}
} \ No newline at end of file
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index dee1605f3..aac4ed4d1 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -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);
diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs
index 105edb131..eb3b7d8fb 100644
--- a/MediaBrowser.Model/Dlna/StreamInfo.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs
@@ -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>
diff --git a/SocketHttpListener.Portable/WebSocket.cs b/SocketHttpListener.Portable/WebSocket.cs
index 889880387..9966d3fcf 100644
--- a/SocketHttpListener.Portable/WebSocket.cs
+++ b/SocketHttpListener.Portable/WebSocket.cs
@@ -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&lt;bool&gt; 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&lt;bool&gt; 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
diff --git a/src/Emby.Server/Program.cs b/src/Emby.Server/Program.cs
index 24e391c73..26141a0ce 100644
--- a/src/Emby.Server/Program.cs
+++ b/src/Emby.Server/Program.cs
@@ -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);