diff options
| author | Bond_009 <Bond.009@outlook.com> | 2019-03-26 22:56:05 +0100 |
|---|---|---|
| committer | Bond_009 <Bond.009@outlook.com> | 2019-03-26 23:00:14 +0100 |
| commit | 93e535d3a143d092effb37e529e5682c3d11802a (patch) | |
| tree | d46bc3203e436f55495408cc1e783836055224d9 /MediaBrowser.Controller/MediaEncoding/JobLogger.cs | |
| parent | 31607fbb377c826415dc0f6689ac4189b38c840f (diff) | |
Trying to make sense of the streaming code
Mostly small changes as I was looking through the code.
* async void -> async Task
* Properly implemented dispose methods
* Pass the logstream directly to the JobLogger
* Style fixes
Diffstat (limited to 'MediaBrowser.Controller/MediaEncoding/JobLogger.cs')
| -rw-r--r-- | MediaBrowser.Controller/MediaEncoding/JobLogger.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs index 2755bf581..d0d5ebfd6 100644 --- a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs +++ b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs @@ -3,6 +3,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Text; +using System.Threading.Tasks; using MediaBrowser.Model.Extensions; using Microsoft.Extensions.Logging; @@ -18,10 +19,11 @@ namespace MediaBrowser.Controller.MediaEncoding _logger = logger; } - public async void StartStreamingLog(EncodingJobInfo state, Stream source, Stream target) + public async Task StartStreamingLog(EncodingJobInfo state, Stream source, Stream target) { try { + using (target) using (var reader = new StreamReader(source)) { while (!reader.EndOfStream && reader.BaseStream.CanRead) @@ -97,8 +99,7 @@ namespace MediaBrowser.Controller.MediaEncoding { var currentMs = startMs + val.TotalMilliseconds; - var percentVal = currentMs / totalMs; - percent = 100 * percentVal; + percent = 100 * currentMs / totalMs; transcodingPosition = val; } |
