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.
This commit is contained in:
Kurt Kartaltepe
2024-02-09 22:54:21 -08:00
committed by Lain
parent e71149697f
commit 288ed51269
+1 -1
View File
@@ -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);