From 0b3848db08cf78c6c5396f7b03a32d6074a0c48b Mon Sep 17 00:00:00 2001 From: Mikhail Burakov Date: Wed, 12 Apr 2023 07:07:28 +0200 Subject: Restructure gpu frames interface and handling --- main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 1b27a0d..aa5a493 100644 --- a/main.c +++ b/main.c @@ -143,10 +143,9 @@ static void OnTimerExpire(void* user) { } if (!contexts->encode_context) { - uint32_t width, height; - GpuFrameGetSize(captured_frame, &width, &height); - contexts->encode_context = EncodeContextCreate(contexts->gpu_context, width, - height, colorspace, range); + contexts->encode_context = + EncodeContextCreate(contexts->gpu_context, captured_frame->width, + captured_frame->height, colorspace, range); if (!contexts->encode_context) { LOG("Failed to create encode context"); goto drop_client; @@ -159,12 +158,11 @@ static void OnTimerExpire(void* user) { LOG("Failed to get encoded frame"); goto drop_client; } - if (!GpuFrameConvert(captured_frame, encoded_frame)) { + if (!GpuContextConvertFrame(contexts->gpu_context, captured_frame, + encoded_frame)) { LOG("Failed to convert frame"); goto drop_client; } - - GpuContextSync(contexts->gpu_context); if (!EncodeContextEncodeFrame(contexts->encode_context, contexts->client_fd)) { LOG("Failed to encode frame"); -- cgit v1.2.3