[chronojump] Better close webcam capture (like our standalone testingstuff code)



commit 953db166d0796c27346cb9f4d50e6694c74284e0
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Oct 19 11:07:00 2018 +0200

    Better close webcam capture (like our standalone testingstuff code)

 src/webcamFfmpeg.cs | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/webcamFfmpeg.cs b/src/webcamFfmpeg.cs
index 7ebeaf31..8c317be4 100644
--- a/src/webcamFfmpeg.cs
+++ b/src/webcamFfmpeg.cs
@@ -196,20 +196,29 @@ public class WebcamFfmpeg : Webcam
                LogB.Information("streamWriter is null: " + (streamWriter == null).ToString());
                try {
                        streamWriter.Write('q');
-                       streamWriter.Flush();
+                       //streamWriter.Flush(); //seems is not needed
                } catch {
-                       //maybe Mplayer window has been closed by user
+                       //maybe capturer process (could be a window) has been closed by user
                        process = null;
                        Running = false;
                        return;
                }
 
+                Console.WriteLine("closing ...");
+                process.Close();
+                Console.WriteLine("done!");
+
+               /*
+                * above process.Close() will end the process
+                * if not, play with kill
+                *
                //System.Threading.Thread.Sleep(500);
                //better check if process still exists to later copy the video
                do {
                        LogB.Information("waiting 100 ms to end Ffmpeg");
                        System.Threading.Thread.Sleep(100);
                } while(ExecuteProcess.IsRunning2(process, captureExecutable));
+               */
 
                streamWriter = null;
                process = null;


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