From a69ca6c55bb7183d247c2c3b25203dbed99fd5d9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 6 Oct 2016 14:55:01 -0400 Subject: avoid buffering http responses --- MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs') diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 5805127e6..9f51dcf66 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -9,6 +9,8 @@ using System.Linq; using System.Text; using System.Xml; using CommonIO; +using MediaBrowser.Common.IO; +using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; @@ -20,11 +22,13 @@ namespace MediaBrowser.MediaEncoding.Probing private readonly CultureInfo _usCulture = new CultureInfo("en-US"); private readonly ILogger _logger; private readonly IFileSystem _fileSystem; + private readonly IMemoryStreamProvider _memoryStreamProvider; - public ProbeResultNormalizer(ILogger logger, IFileSystem fileSystem) + public ProbeResultNormalizer(ILogger logger, IFileSystem fileSystem, IMemoryStreamProvider memoryStreamProvider) { _logger = logger; _fileSystem = fileSystem; + _memoryStreamProvider = memoryStreamProvider; } public MediaInfo GetMediaInfo(InternalMediaInfoResult data, VideoType videoType, bool isAudio, string path, MediaProtocol protocol) @@ -187,7 +191,7 @@ namespace MediaBrowser.MediaEncoding.Probing xml = "" + xml; // \n\n\n\n\tcast\n\t\n\t\t\n\t\t\tname\n\t\t\tBlender Foundation\n\t\t\n\t\t\n\t\t\tname\n\t\t\tJanus Bager Kristensen\n\t\t\n\t\n\tdirectors\n\t\n\t\t\n\t\t\tname\n\t\t\tSacha Goedegebure\n\t\t\n\t\n\tstudio\n\tBlender Foundation\n\n\n - using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(xml))) + using (var stream = _memoryStreamProvider.CreateNew(Encoding.UTF8.GetBytes(xml))) { using (var streamReader = new StreamReader(stream)) { @@ -573,8 +577,7 @@ namespace MediaBrowser.MediaEncoding.Probing private void NormalizeStreamTitle(MediaStream stream) { - if (string.Equals(stream.Title, "sdh", StringComparison.OrdinalIgnoreCase) || - string.Equals(stream.Title, "cc", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(stream.Title, "cc", StringComparison.OrdinalIgnoreCase)) { stream.Title = null; } -- cgit v1.2.3