[ekiga] VideoInput: Fill in data with black if we can't capture.



commit 9a158f1643c2fcc8bfabbabe1cf1d77f2704e7e0
Author: Damien Sandras <dsandras seconix com>
Date:   Sun Nov 1 15:33:48 2015 +0100

    VideoInput: Fill in data with black if we can't capture.
    
    This fixes awful green images when the driver is not ready to capture
    yet. It can happen for the very first frames.

 .../components/ptlib/videoinput-manager-ptlib.cpp  |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp 
b/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp
index f5f7a17..38e0c5d 100644
--- a/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp
+++ b/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp
@@ -183,6 +183,14 @@ bool GMVideoInputManager_ptlib::get_frame_data (char *data)
 
   if ((unsigned) I != expectedFrameSize) {
     PTRACE(1, "GMVideoInputManager_ptlib\tExpected a frame of " << expectedFrameSize << " bytes but got " << 
I << " bytes");
+    memset (data, 0, current_state.width*current_state.height); //ff
+    memset (data + (current_state.width * current_state.height),
+            0x7f,
+            (current_state.width*current_state.height) >> 2);
+    memset (data + (current_state.width * current_state.height) +
+            ((current_state.width * current_state.height) >> 2),
+            0x7f,
+            (current_state.width*current_state.height) >> 2);
   }
   return ret;
 }


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