Skip to content

Commit

Permalink
Issue #532
Browse files Browse the repository at this point in the history
  • Loading branch information
mariodivece committed Jun 5, 2021
1 parent 63dd331 commit 1533c46
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
26 changes: 8 additions & 18 deletions Unosquare.FFME.Windows.Sample/MainWindow.MediaEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions Unosquare.FFME/Commands/CommandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
2 changes: 1 addition & 1 deletion Unosquare.FFME/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static Constants()
/// <summary>
/// The maximum speed ratio.
/// </summary>
public static double MaxSpeedRatio => 8.0d;
public static double MaxSpeedRatio => 100.0d;

/// <summary>
/// The minimum balance.
Expand Down

0 comments on commit 1533c46

Please sign in to comment.