diff --git a/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs b/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs index ab8d5ea72f..a26c439113 100644 --- a/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs +++ b/MediaBrowser.Dlna/Profiles/WdtvLiveProfile.cs @@ -11,6 +11,7 @@ namespace MediaBrowser.Dlna.Profiles Name = "WDTV Live"; TimelineOffsetSeconds = 5; + IgnoreTranscodeByteRangeRequests = true; Identification = new DeviceIdentification { diff --git a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs index 28ea5ad6c9..19c567a33e 100644 --- a/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs +++ b/MediaBrowser.Dlna/Ssdp/SsdpHandler.cs @@ -118,10 +118,7 @@ namespace MediaBrowser.Dlna.Ssdp public void Start() { - _socket = CreateMulticastSocket(); - - _logger.Info("SSDP service started"); - Receive(); + RestartSocketListener(); ReloadAliveNotifier(); } @@ -289,6 +286,56 @@ namespace MediaBrowser.Dlna.Ssdp } } + private void RestartSocketListener() + { + if (_isDisposed) + { + StopSocketRetryTimer(); + return; + } + + try + { + _socket = CreateMulticastSocket(); + + _logger.Info("MultiCast socket created"); + + StopSocketRetryTimer(); + + Receive(); + } + catch (Exception ex) + { + _logger.ErrorException("Error creating MultiCast socket", ex); + //StartSocketRetryTimer(); + } + } + + private Timer _socketRetryTimer; + private readonly object _socketRetryLock = new object(); + private void StartSocketRetryTimer() + { + lock (_socketRetryLock) + { + if (_socketRetryTimer == null) + { + _socketRetryTimer = new Timer(s => RestartSocketListener(), null, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30)); + } + } + } + + private void StopSocketRetryTimer() + { + lock (_socketRetryLock) + { + if (_socketRetryTimer != null) + { + _socketRetryTimer.Dispose(); + _socketRetryTimer = null; + } + } + } + private void Receive() { try @@ -297,10 +344,15 @@ namespace MediaBrowser.Dlna.Ssdp EndPoint endpoint = new IPEndPoint(IPAddress.Any, SSDPPort); - _socket.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref endpoint, ReceiveCallback, buffer); + _socket.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref endpoint, ReceiveCallback, + buffer); } catch (ObjectDisposedException) { + if (!_isDisposed) + { + //StartSocketRetryTimer(); + } } catch (Exception ex) { @@ -348,6 +400,13 @@ namespace MediaBrowser.Dlna.Ssdp OnMessageReceived(args); } + catch (ObjectDisposedException) + { + if (!_isDisposed) + { + //StartSocketRetryTimer(); + } + } catch (Exception ex) { _logger.ErrorException("Failed to read SSDP message", ex); diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 2cd855e966..4c34b5a95a 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -38,7 +38,7 @@ namespace MediaBrowser.MediaEncoding.Probing var internalStreams = data.streams ?? new MediaStreamInfo[] { }; - info.MediaStreams = internalStreams.Select(s => GetMediaStream(s, data.format)) + info.MediaStreams = internalStreams.Select(s => GetMediaStream(isAudio, s, data.format)) .Where(i => i != null) .ToList(); @@ -94,7 +94,7 @@ namespace MediaBrowser.MediaEncoding.Probing /// The stream info. /// The format info. /// MediaStream. - private MediaStream GetMediaStream(MediaStreamInfo streamInfo, MediaFormatInfo formatInfo) + private MediaStream GetMediaStream(bool isAudio, MediaStreamInfo streamInfo, MediaFormatInfo formatInfo) { var stream = new MediaStream { @@ -129,7 +129,7 @@ namespace MediaBrowser.MediaEncoding.Probing } else if (string.Equals(streamInfo.codec_type, "video", StringComparison.OrdinalIgnoreCase)) { - stream.Type = (streamInfo.codec_name ?? string.Empty).IndexOf("mjpeg", StringComparison.OrdinalIgnoreCase) != -1 + stream.Type = isAudio ? MediaStreamType.EmbeddedImage : MediaStreamType.Video; diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index 752b4d1798..2b0df9778c 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -76,6 +76,7 @@ namespace MediaBrowser.Model.Dlna public bool RequiresPlainFolders { get; set; } public bool EnableMSMediaReceiverRegistrar { get; set; } + public bool IgnoreTranscodeByteRangeRequests { get; set; } public XmlAttribute[] XmlRootAttributes { get; set; } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs index d78f1b48e6..33f35450df 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs @@ -52,7 +52,7 @@ namespace MediaBrowser.Providers.MediaInfo return ItemUpdateType.MetadataImport; } - private const string SchemaVersion = "2"; + private const string SchemaVersion = "3"; private async Task GetMediaInfo(BaseItem item, CancellationToken cancellationToken) { diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs b/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs index 6514893477..18711c61e2 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelDownloadScheduledTask.cs @@ -17,7 +17,6 @@ using MediaBrowser.Model.Querying; using MoreLinq; using System; using System.Collections.Generic; -using System.Globalization; using System.IO; using System.Linq; using System.Threading; diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 4fb0569965..e7372ce377 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -48,8 +48,9 @@ ..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll - - ..\packages\MediaBrowser.Naming.1.0.0.35\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll + + False + ..\packages\MediaBrowser.Naming.1.0.0.36\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll False diff --git a/MediaBrowser.Server.Implementations/packages.config b/MediaBrowser.Server.Implementations/packages.config index 0b81c1866d..fa7511143d 100644 --- a/MediaBrowser.Server.Implementations/packages.config +++ b/MediaBrowser.Server.Implementations/packages.config @@ -1,7 +1,7 @@  - + diff --git a/SharedVersion.cs b/SharedVersion.cs index 3f171bdf8e..ce554da96d 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; -//[assembly: AssemblyVersion("3.0.*")] -[assembly: AssemblyVersion("3.0.5607.0")] +[assembly: AssemblyVersion("3.0.*")] +//[assembly: AssemblyVersion("3.0.5607.0")]