diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs index d938359e9e..50e9135b00 100644 --- a/Emby.Server.Implementations/Networking/NetworkManager.cs +++ b/Emby.Server.Implementations/Networking/NetworkManager.cs @@ -19,10 +19,43 @@ namespace Emby.Server.Implementations.Networking { protected ILogger Logger { get; private set; } private DateTime _lastRefresh; + private int NetworkCacheMinutes = 360; public NetworkManager(ILogger logger) { Logger = logger; + + try + { + NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; + } + catch (Exception ex) + { + NetworkCacheMinutes = 15; + Logger.ErrorException("Error binding to NetworkAddressChanged event", ex); + } + + try + { + NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged; + } + catch (Exception ex) + { + NetworkCacheMinutes = 15; + Logger.ErrorException("Error binding to NetworkChange_NetworkAvailabilityChanged event", ex); + } + } + + private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e) + { + Logger.Debug("NetworkAvailabilityChanged"); + _lastRefresh = DateTime.MinValue; + } + + private void NetworkChange_NetworkAddressChanged(object sender, EventArgs e) + { + Logger.Debug("NetworkAddressChanged"); + _lastRefresh = DateTime.MinValue; } private List _localIpAddresses; @@ -30,11 +63,9 @@ namespace Emby.Server.Implementations.Networking public List GetLocalIpAddresses() { - const int cacheMinutes = 10; - lock (_localIpAddressSyncLock) { - var forceRefresh = (DateTime.UtcNow - _lastRefresh).TotalMinutes >= cacheMinutes; + var forceRefresh = (DateTime.UtcNow - _lastRefresh).TotalMinutes >= NetworkCacheMinutes; if (_localIpAddresses == null || forceRefresh) { diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 8f8791922d..1fab6defce 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -393,6 +393,10 @@ namespace MediaBrowser.Controller.MediaEncoding { return "wmav2"; } + if (string.Equals(codec, "opus", StringComparison.OrdinalIgnoreCase)) + { + return "libopus"; + } return codec.ToLower(); } diff --git a/SharedVersion.cs b/SharedVersion.cs index 90e6929e2a..14968dfa51 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.40.3")] +[assembly: AssemblyVersion("3.2.40.4")]