From 1533c46f8a2610fc544659c1cb35c687533ecd73 Mon Sep 17 00:00:00 2001 From: Mario Di Vece Date: Sat, 5 Jun 2021 12:24:07 -0500 Subject: [PATCH] Issue #532 --- .../MainWindow.MediaEvents.cs | 26 ++++++------------- Unosquare.FFME/Commands/CommandManager.cs | 9 ++++--- Unosquare.FFME/Constants.cs | 2 +- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/Unosquare.FFME.Windows.Sample/MainWindow.MediaEvents.cs b/Unosquare.FFME.Windows.Sample/MainWindow.MediaEvents.cs index 038a9ab55..23f261074 100644 --- a/Unosquare.FFME.Windows.Sample/MainWindow.MediaEvents.cs +++ b/Unosquare.FFME.Windows.Sample/MainWindow.MediaEvents.cs @@ -504,25 +504,15 @@ private void OnMediaStateChanged(object sender, MediaStateChangedEventArgs e) { var media = sender as MediaElement; - switch (e.MediaState) + ViewModel.PlaybackProgressState = e.MediaState switch { - case MediaPlaybackState.Close: - case MediaPlaybackState.Stop: - ViewModel.PlaybackProgressState = TaskbarItemProgressState.None; - break; - case MediaPlaybackState.Manual: - case MediaPlaybackState.Pause: - ViewModel.PlaybackProgressState = TaskbarItemProgressState.Paused; - break; - case MediaPlaybackState.Play: - ViewModel.PlaybackProgressState = media.IsSeekable - ? TaskbarItemProgressState.Normal - : TaskbarItemProgressState.Indeterminate; - break; - default: - ViewModel.PlaybackProgressState = TaskbarItemProgressState.None; - break; - } + MediaPlaybackState.Close or MediaPlaybackState.Stop => TaskbarItemProgressState.None, + MediaPlaybackState.Manual or MediaPlaybackState.Pause => TaskbarItemProgressState.Paused, + MediaPlaybackState.Play => media.IsSeekable + ? TaskbarItemProgressState.Normal + : TaskbarItemProgressState.Indeterminate, + _ => TaskbarItemProgressState.None, + }; } #endregion diff --git a/Unosquare.FFME/Commands/CommandManager.cs b/Unosquare.FFME/Commands/CommandManager.cs index eb805b235..00d96228b 100644 --- a/Unosquare.FFME/Commands/CommandManager.cs +++ b/Unosquare.FFME/Commands/CommandManager.cs @@ -318,11 +318,12 @@ private void LogReferenceCounter() if (!Debugger.IsAttached) return; if (RC.Current.InstancesByLocation.Count <= 0) return; - var builder = new StringBuilder(); - builder.AppendLine("Unmanaged references are still alive. If there are no further media container instances to be disposed,"); - builder.AppendLine("this is an indication that there is a memory leak. Otherwise, this message can be ignored."); + var builder = new StringBuilder() + .AppendLine("Unmanaged references are still alive. If there are no further media container instances to be disposed,") + .AppendLine("this is an indication that there is a memory leak. Otherwise, this message can be ignored."); + foreach (var kvp in RC.Current.InstancesByLocation) - builder.AppendLine($" {kvp.Key,30} - Instances: {kvp.Value}"); + _ = builder.AppendLine($" {kvp.Key,30} - Instances: {kvp.Value}"); this.LogError(Aspects.ReferenceCounter, builder.ToString()); } diff --git a/Unosquare.FFME/Constants.cs b/Unosquare.FFME/Constants.cs index 072f8206b..cddc1d576 100644 --- a/Unosquare.FFME/Constants.cs +++ b/Unosquare.FFME/Constants.cs @@ -66,7 +66,7 @@ static Constants() /// /// The maximum speed ratio. /// - public static double MaxSpeedRatio => 8.0d; + public static double MaxSpeedRatio => 100.0d; /// /// The minimum balance.