[ekiga] Made the get_frame_data function more complex



commit 8b19b1d66eda151a3ef12966924801ee91ca8259
Author: Julien Puydt <jpuydt newton localdomain>
Date:   Wed Feb 1 22:12:01 2012 +0100

    Made the get_frame_data function more complex
    
    I'm not sure we're not losing data this way :-/

 plugins/gstreamer/gst-helper.cpp |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/plugins/gstreamer/gst-helper.cpp b/plugins/gstreamer/gst-helper.cpp
index ed978dc..c27cddb 100644
--- a/plugins/gstreamer/gst-helper.cpp
+++ b/plugins/gstreamer/gst-helper.cpp
@@ -94,17 +94,23 @@ gst_helper_get_frame_data (gst_helper* self,
 {
   bool result = false;
   GstBuffer* buffer = NULL;
+  unsigned cpy_size;
 
   read = 0;
 
-  buffer = gst_app_sink_pull_buffer (GST_APP_SINK (self->active));
+  while (read < size) {
 
-  if (buffer != NULL) {
+    buffer = gst_app_sink_pull_buffer (GST_APP_SINK (self->active));
 
-    read = MIN (GST_BUFFER_SIZE (buffer), size);
-    memcpy (data, GST_BUFFER_DATA (buffer), read);
-    result = true;
-    gst_buffer_unref (buffer);
+    if (buffer != NULL) {
+
+      cpy_size = MIN(GST_BUFFER_SIZE (buffer), size-read);
+      memcpy (data+read, GST_BUFFER_DATA (buffer), cpy_size);
+      read += cpy_size;
+      gst_buffer_unref (buffer);
+      result = true;
+    } else
+      break;
   }
 
   return result;



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