From 288ed51269e89a88fcf6ad9f97772bd987286f83 Mon Sep 17 00:00:00 2001 From: Kurt Kartaltepe Date: Fri, 9 Feb 2024 22:54:21 -0800 Subject: [PATCH] obs-ffmpeg: Receive packets while frame queue is full Previously, we always assumed we could push more frames before an encoded packet would be available. Actually, we can get EAGAIN when the frame queue is full and before any encoded packets have been completed. Instead, attempt to read packets more often as the worst that can happen is we get EAGAIN again. --- plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c index b7e5d5eddb4a0e..127ef658a493be 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c @@ -543,7 +543,7 @@ static bool vaapi_encode(void *data, struct encoder_frame *frame, } ret = avcodec_send_frame(enc->context, hwframe); - if (ret == 0) + if (ret == 0 || ret == AVERROR(EAGAIN)) ret = avcodec_receive_packet(enc->context, enc->packet); got_packet = (ret == 0);