support ac3 audio in edge browser

This commit is contained in:
Luke Pulverenti 2015-10-17 21:18:29 -04:00
parent 3da90bc103
commit 8f5609df3a
5 changed files with 38 additions and 15 deletions

View File

@ -62,7 +62,7 @@ namespace MediaBrowser.Common.ScheduledTasks
}
else
{
triggerDate = DateTime.UtcNow.AddSeconds(10);
triggerDate = DateTime.UtcNow.AddMinutes(1);
}
}

View File

@ -11,17 +11,17 @@ namespace MediaBrowser.Dlna.Ssdp
public EndPoint ToEndPoint { get; private set; }
public EndPoint FromEndPoint { get; private set; }
public string Message { get; private set; }
public bool IgnoreBindFailure { get; private set; }
public bool IsBroadcast { get; private set; }
public bool EnableDebugLogging { get; private set; }
private readonly ILogger _logger;
public Datagram(EndPoint toEndPoint, EndPoint fromEndPoint, ILogger logger, string message, bool ignoreBindFailure, bool enableDebugLogging)
public Datagram(EndPoint toEndPoint, EndPoint fromEndPoint, ILogger logger, string message, bool isBroadcast, bool enableDebugLogging)
{
Message = message;
_logger = logger;
EnableDebugLogging = enableDebugLogging;
IgnoreBindFailure = ignoreBindFailure;
IsBroadcast = isBroadcast;
FromEndPoint = fromEndPoint;
ToEndPoint = toEndPoint;
}
@ -50,10 +50,9 @@ namespace MediaBrowser.Dlna.Ssdp
_logger.ErrorException("Error binding datagram socket", ex);
}
if (!IgnoreBindFailure)
if (IsBroadcast)
{
CloseSocket(socket, false);
return;
}
}
@ -107,12 +106,14 @@ namespace MediaBrowser.Dlna.Ssdp
try
{
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 4);
if (IsBroadcast)
{
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
}
return socket;
}
catch (Exception ex)

View File

@ -139,14 +139,14 @@ namespace MediaBrowser.Dlna.Ssdp
values["MX"] = "3";
// UDP is unreliable, so send 3 requests at a time (per Upnp spec, sec 1.1.2)
SendDatagram("M-SEARCH * HTTP/1.1", values, _ssdpEndp, localIp, false, 2);
SendDatagram("M-SEARCH * HTTP/1.1", values, _ssdpEndp, localIp, true, 2);
}
public void SendDatagram(string header,
Dictionary<string, string> values,
EndPoint endpoint,
EndPoint localAddress,
bool ignoreBindFailure,
bool isBroadcast,
int sendCount)
{
var msg = new SsdpMessageBuilder().BuildMessage(header, values);
@ -156,7 +156,7 @@ namespace MediaBrowser.Dlna.Ssdp
for (var i = 0; i < sendCount; i++)
{
var dgram = new Datagram(endpoint, localAddress, _logger, msg, ignoreBindFailure, enableDebugLogging);
var dgram = new Datagram(endpoint, localAddress, _logger, msg, isBroadcast, enableDebugLogging);
if (_messageQueue.Count == 0)
{
@ -516,7 +516,7 @@ namespace MediaBrowser.Dlna.Ssdp
_logger.Debug("{0} said {1}", dev.USN, type);
}
SendDatagram(header, values, _ssdpEndp, new IPEndPoint(dev.Address, 0), false, sendCount);
SendDatagram(header, values, _ssdpEndp, new IPEndPoint(dev.Address, 0), true, sendCount);
}
public void RegisterNotification(Guid uuid, Uri descriptionUri, IPAddress address, IEnumerable<string> services)

View File

@ -1723,6 +1723,12 @@ namespace MediaBrowser.Server.Implementations.Library
refresh = (DateTime.UtcNow - item.DateLastRefreshed) >= _viewRefreshInterval;
}
if (!refresh && item.DisplayParentId != Guid.Empty)
{
var displayParent = GetItemById(item.DisplayParentId);
refresh = displayParent != null && displayParent.DateLastSaved > item.DateLastRefreshed;
}
if (refresh)
{
await item.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None).ConfigureAwait(false);
@ -1819,6 +1825,12 @@ namespace MediaBrowser.Server.Implementations.Library
var refresh = isNew || (DateTime.UtcNow - item.DateLastRefreshed) >= _viewRefreshInterval;
if (!refresh && item.DisplayParentId != Guid.Empty)
{
var displayParent = GetItemById(item.DisplayParentId);
refresh = displayParent != null && displayParent.DateLastSaved > item.DateLastRefreshed;
}
if (refresh)
{
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
@ -1888,6 +1900,12 @@ namespace MediaBrowser.Server.Implementations.Library
var refresh = isNew || (DateTime.UtcNow - item.DateLastRefreshed) >= _viewRefreshInterval;
if (!refresh && item.DisplayParentId != Guid.Empty)
{
var displayParent = GetItemById(item.DisplayParentId);
refresh = displayParent != null && displayParent.DateLastSaved > item.DateLastRefreshed;
}
if (refresh)
{
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
@ -1958,6 +1976,12 @@ namespace MediaBrowser.Server.Implementations.Library
var refresh = isNew || (DateTime.UtcNow - item.DateLastRefreshed) >= _viewRefreshInterval;
if (!refresh && item.DisplayParentId != Guid.Empty)
{
var displayParent = GetItemById(item.DisplayParentId);
refresh = displayParent != null && displayParent.DateLastSaved > item.DateLastRefreshed;
}
if (refresh)
{
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)

View File

@ -33,9 +33,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
{
await Task.Delay(3000).ConfigureAwait(false);
_taskManager.QueueScheduledTask<RefreshChannelsScheduledTask>();
_taskManager.QueueScheduledTask<CleanDatabaseScheduledTask>();
_taskManager.QueueScheduledTask<RefreshMediaLibraryTask>();
});
// Wait a few minutes before marking this as done. Make sure the server doesn't get restarted.