[chronojump] Webcam: Fixed crash on encoder capture end



commit f8be7d3da7b3090cfeede2b4555197dbbd80a46f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Jul 8 12:04:07 2019 +0200

    Webcam: Fixed crash on encoder capture end

 src/gui/webcam.cs | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/gui/webcam.cs b/src/gui/webcam.cs
index 807c7125..cf08ab1b 100644
--- a/src/gui/webcam.cs
+++ b/src/gui/webcam.cs
@@ -357,15 +357,19 @@ public partial class ChronoJumpWindow
 
        private bool webcamEndDo()
        {
-               if(swWebcamStop.Elapsed.TotalSeconds < preferences.videoStopAfter)
+               //note on encoder swWebcamStop is null because the video ends when encoder ends. so do not 
show the progressbar finishing the video
+               if(swWebcamStart != null || swWebcamStop != null)
                {
-                       //progressbar_video_generating.Pulse();
-                       progressbar_video_generating.Fraction = 
Util.DivideSafeFraction(swWebcamStop.Elapsed.TotalMilliseconds, preferences.videoStopAfter * 1000);
-                       return true;
-               }
+                       if(swWebcamStop.Elapsed.TotalSeconds < preferences.videoStopAfter)
+                       {
+                               //progressbar_video_generating.Pulse();
+                               progressbar_video_generating.Fraction = 
Util.DivideSafeFraction(swWebcamStop.Elapsed.TotalMilliseconds, preferences.videoStopAfter * 1000);
+                               return true;
+                       }
 
-               swWebcamStart.Stop();
-               progressbar_video_generating.Fraction = 1;
+                       swWebcamStart.Stop();
+                       progressbar_video_generating.Fraction = 1;
+               }
                LogB.Information("Called webcamEndDo() ending the pulse");
                Webcam.Result resultExit = webcamManage.ExitAndFinish (webcamEndParams.camera, 
webcamEndParams.sessionID,
                                webcamEndParams.testType, webcamEndParams.uniqueID, 
webcamEndParams.guiContactsEncoder);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]