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
This commit is contained in:
Owen W. Taylor 2012-01-30 16:38:45 -05:00
parent d4a26fbf4b
commit f2cc5cf152

View File

@ -526,6 +526,12 @@ recorder_record_frame (ShellRecorder *recorder)
guint8 *data; guint8 *data;
guint size; 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; size = recorder->stage_width * recorder->stage_height * 4;
data = shell_screen_grabber_grab (recorder->grabber, data = shell_screen_grabber_grab (recorder->grabber,