From 82e3854c84c7cebec3c0e60577f385b1ae5a4a3e Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Mon, 28 Jun 2021 15:35:43 -0600 Subject: [PATCH] Fixed typo and minor formatting. --- AaxDecrypter/AaxcDownloadConverter.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/AaxDecrypter/AaxcDownloadConverter.cs b/AaxDecrypter/AaxcDownloadConverter.cs index 8eda64ea..cb37d542 100644 --- a/AaxDecrypter/AaxcDownloadConverter.cs +++ b/AaxDecrypter/AaxcDownloadConverter.cs @@ -50,6 +50,7 @@ namespace AaxDecrypter private StepSequence steps { get; } private DownloadLicense downloadLicense { get; set; } private FFMpegAaxcProcesser aaxcProcesser; + public static async Task CreateAsync(string outDirectory, DownloadLicense dlLic, ChapterInfo chapters = null) { var converter = new AaxcDownloadConverter(outDirectory, dlLic, chapters); @@ -170,22 +171,19 @@ namespace AaxDecrypter private void AaxcProcesser_ProgressUpdate(object sender, TimeSpan e) { double averageRate = getAverageProcessRate(e); - double remainingSecsToProcess = (aaxcTagLib.Properties.Duration - e).TotalSeconds; - double estTimeRemaining = remainingSecsToProcess / averageRate; if (double.IsNormal(estTimeRemaining)) DecryptTimeRemaining?.Invoke(this, TimeSpan.FromSeconds(estTimeRemaining)); - double progressPercent = 100 * e.TotalSeconds / aaxcTagLib.Properties.Duration.TotalSeconds; DecryptProgressUpdate?.Invoke(this, (int)progressPercent); } /// - /// Calculates the average processing rate based on the last samples. + /// Calculates the average processing rate based on the last 2 to samples. /// /// Position in the audio file last processed /// The average processing rate, in book_duration_seconds / second. @@ -200,7 +198,7 @@ namespace AaxDecrypter if (streamPositions.Count < 2) return double.PositiveInfinity; - //Calculate the harmonic mean of the last AVERAGE_NUM progress updates + //Calculate the harmonic mean of the last 2 to MAX_NUM_AVERAGE progress updates //Units are Book_Duration_Seconds / second var lastPos = streamPositions.Count > MAX_NUM_AVERAGE ? streamPositions.Dequeue() : null; @@ -226,6 +224,7 @@ namespace AaxDecrypter double harmonicMean = harmonicNumerator / harmonicDenominator; return harmonicMean; } + private const int MAX_NUM_AVERAGE = 15; private class StreamPosition {