raw: Keep reference to encoder while encoding

pull/80/head
Andri Yngvason 2022-10-30 12:32:13 +00:00
parent 727b2f727e
commit 91dc5da243
1 changed files with 4 additions and 0 deletions

View File

@ -176,6 +176,7 @@ static void raw_encoder_on_done(void* obj)
encoder_finish_frame(&self->encoder, result, pts); encoder_finish_frame(&self->encoder, result, pts);
rcbuf_unref(result); rcbuf_unref(result);
encoder_unref(&self->encoder);
} }
struct encoder* raw_encoder_new(void) struct encoder* raw_encoder_new(void)
@ -223,8 +224,11 @@ static int raw_encoder_encode(struct encoder* encoder, struct nvnc_fb* fb,
nvnc_fb_ref(self->current_fb); nvnc_fb_ref(self->current_fb);
pixman_region_copy(&self->current_damage, damage); pixman_region_copy(&self->current_damage, damage);
encoder_ref(&self->encoder);
int rc = aml_start(aml_get_default(), self->work); int rc = aml_start(aml_get_default(), self->work);
if (rc < 0) { if (rc < 0) {
encoder_unref(&self->encoder);
aml_unref(self->work); aml_unref(self->work);
self->work = NULL; self->work = NULL;
pixman_region_clear(&self->current_damage); pixman_region_clear(&self->current_damage);