summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop
diff options
context:
space:
mode:
authorsr55 <[email protected]>2020-02-23 14:17:29 +0000
committersr55 <[email protected]>2020-02-23 14:17:29 +0000
commit4083aca9d94a7fd58b400b3744a35bfc233cdf5d (patch)
tree8cad746ab47bfe9e7156dd062d3c66d659e2f267 /win/CS/HandBrake.Interop
parentd18c6ff64630c1b741b05d0ae170c92dd05d5870 (diff)
WinGui: Fix an issue with Queue Pause/Resume not working correctly and some unhandled silent exceptions in the libhb wrapper library. Fixes #2647
Diffstat (limited to 'win/CS/HandBrake.Interop')
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs12
1 files changed, 10 insertions, 2 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs
index 69bf56155..34997f0ce 100644
--- a/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs
@@ -470,8 +470,16 @@ namespace HandBrake.Interop.Interop
{
if (this.EncodeProgress != null)
{
- TimeSpan eta = TimeSpan.FromSeconds(state.Working.ETASeconds);
- var progressEventArgs = new EncodeProgressEventArgs(state.Working.Progress, state.Working.Rate, state.Working.RateAvg, eta, state.Working.PassID, state.Working.Pass, state.Working.PassCount, taskState.Code);
+ TimeSpan eta = TimeSpan.FromSeconds(state?.Working?.ETASeconds ?? 0);
+ var progressEventArgs = new EncodeProgressEventArgs(0, 0, 0, TimeSpan.MinValue, 0, 0, 0, taskState.Code);
+ if (taskState == TaskState.Muxing || state.Working == null)
+ {
+ progressEventArgs = new EncodeProgressEventArgs(100, 0, 0, TimeSpan.MinValue, 0, 0, 0, taskState.Code);
+ }
+ else
+ {
+ progressEventArgs = new EncodeProgressEventArgs(state.Working.Progress, state.Working.Rate, state.Working.RateAvg, eta, state.Working.PassID, state.Working.Pass, state.Working.PassCount, taskState.Code);
+ }
this.EncodeProgress(this, progressEventArgs);
}