[gnome-shell] ShellRecorder: drop frames to keep from running the user out of memory.



commit f2cc5cf15235854a2449be01c7cea3a6635cb75c
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Jan 30 16:38:45 2012 -0500

    ShellRecorder: drop frames to keep from running the user out of memory.
    
    Once we're buffering more than 3/4's of the "half of memory" target
    for total buffer usage, start dropping frames.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=669066

 src/shell-recorder.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/shell-recorder.c b/src/shell-recorder.c
index 40df07c..0575856 100644
--- a/src/shell-recorder.c
+++ b/src/shell-recorder.c
@@ -526,6 +526,12 @@ recorder_record_frame (ShellRecorder *recorder)
   guint8 *data;
   guint size;
 
+  /* If we get into the red zone, stop buffering new frames; 13/16 is
+  * a bit more than the 3/4 threshold for a red indicator to keep the
+  * indicator from flashing between red and yellow. */
+  if (recorder->memory_used > (recorder->memory_target * 13) / 16)
+    return;
+
   size = recorder->stage_width * recorder->stage_height * 4;
 
   data = shell_screen_grabber_grab (recorder->grabber,



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