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

View File

@ -139,14 +139,14 @@ namespace MediaBrowser.Dlna.Ssdp
values["MX"] = "3"; values["MX"] = "3";
// UDP is unreliable, so send 3 requests at a time (per Upnp spec, sec 1.1.2) // 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, public void SendDatagram(string header,
Dictionary<string, string> values, Dictionary<string, string> values,
EndPoint endpoint, EndPoint endpoint,
EndPoint localAddress, EndPoint localAddress,
bool ignoreBindFailure, bool isBroadcast,
int sendCount) int sendCount)
{ {
var msg = new SsdpMessageBuilder().BuildMessage(header, values); var msg = new SsdpMessageBuilder().BuildMessage(header, values);
@ -156,7 +156,7 @@ namespace MediaBrowser.Dlna.Ssdp
for (var i = 0; i < sendCount; i++) 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) if (_messageQueue.Count == 0)
{ {
@ -516,7 +516,7 @@ namespace MediaBrowser.Dlna.Ssdp
_logger.Debug("{0} said {1}", dev.USN, type); _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) 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; 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) if (refresh)
{ {
await item.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None).ConfigureAwait(false); 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; 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) if (refresh)
{ {
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem) _providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
@ -1888,6 +1900,12 @@ namespace MediaBrowser.Server.Implementations.Library
var refresh = isNew || (DateTime.UtcNow - item.DateLastRefreshed) >= _viewRefreshInterval; 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) if (refresh)
{ {
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem) _providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
@ -1958,6 +1976,12 @@ namespace MediaBrowser.Server.Implementations.Library
var refresh = isNew || (DateTime.UtcNow - item.DateLastRefreshed) >= _viewRefreshInterval; 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) if (refresh)
{ {
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem) _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); await Task.Delay(3000).ConfigureAwait(false);
_taskManager.QueueScheduledTask<RefreshChannelsScheduledTask>();
_taskManager.QueueScheduledTask<CleanDatabaseScheduledTask>(); _taskManager.QueueScheduledTask<CleanDatabaseScheduledTask>();
_taskManager.QueueScheduledTask<RefreshMediaLibraryTask>();
}); });
// Wait a few minutes before marking this as done. Make sure the server doesn't get restarted. // Wait a few minutes before marking this as done. Make sure the server doesn't get restarted.