Commit e22f3bb5 authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Kristian H. Kristensen

screenshooter: Record one extra frame when recording stops

If the compositor hasn't been rendering for a while when the recording
stops, the time difference between the last rendered frame and that
moment won't be in the encoded video. Fix that by forcing one extra
frame to be recorded when the user presses the recorder key binding.
parent c2010b3a
......@@ -267,7 +267,7 @@ struct weston_recorder {
uint32_t total;
int fd;
struct wl_listener frame_listener;
int count;
int count, destroying;
static uint32_t *
......@@ -355,6 +355,9 @@ transform_rect(struct weston_output *output, pixman_box32_t *r)
r->y2 *= output->current_scale;
static void
weston_recorder_destroy(struct weston_recorder *recorder);
static void
weston_recorder_frame_notify(struct wl_listener *listener, void *data)
......@@ -456,6 +459,9 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data)
if (recorder->destroying)
static void
......@@ -477,6 +483,7 @@ weston_recorder_create(struct weston_output *output, const char *filename)
recorder->rect = malloc(size);
recorder->total = 0;
recorder->count = 0;
recorder->destroying = 0;
recorder->output = output;
if (do_yflip)
......@@ -553,7 +560,8 @@ recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *da
"stopping recorder, total file size %dM, %d frames\n",
recorder->total / (1024 * 1024), recorder->count);
recorder->destroying = 1;
} else {
weston_log("starting recorder, file %s\n", filename);
weston_recorder_create(output, filename);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment