From 4e9eb98301a8d561dc479692497eaa7dbbcf6c87 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sat, 25 Jun 2022 15:08:02 +0000 Subject: [PATCH] open-h264: Convert to normal encoder The push/pull code path is buggy. --- src/open-h264.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/open-h264.c b/src/open-h264.c index 5814a14..7880967 100644 --- a/src/open-h264.c +++ b/src/open-h264.c @@ -52,6 +52,7 @@ enum open_h264_flags { }; struct encoder* open_h264_new(void); +static struct rcbuf* open_h264_pull(struct encoder* enc, uint64_t* pts); struct encoder_impl encoder_impl_open_h264; @@ -75,7 +76,9 @@ static void open_h264_handle_packet(const void* data, size_t size, uint64_t pts, vec_append(&self->pending, data, size); self->pts = pts; - encoder_finish_frame(&self->parent, NULL, NVNC_NO_PTS); + uint64_t rpts = NVNC_NO_PTS; + struct rcbuf* result = open_h264_pull(&self->parent, &rpts); + encoder_finish_frame(&self->parent, result, rpts); } static int open_h264_init_pending(struct open_h264* self) @@ -141,7 +144,7 @@ static int open_h264_resize(struct open_h264* self, struct nvnc_fb* fb) return 0; } -static int open_h264_push(struct encoder* enc, struct nvnc_fb* fb, +static int open_h264_encode(struct encoder* enc, struct nvnc_fb* fb, struct pixman_region16* damage) { struct open_h264* self = open_h264(enc); @@ -206,7 +209,6 @@ static void open_h264_request_keyframe(struct encoder* enc) struct encoder_impl encoder_impl_open_h264 = { .flags = ENCODER_IMPL_FLAG_IGNORES_DAMAGE, .destroy = open_h264_destroy, - .push = open_h264_push, - .pull = open_h264_pull, + .encode = open_h264_encode, .request_key_frame = open_h264_request_keyframe, };