Skip to content

Commit

Permalink
obs-ffmpeg: Receive packets while frame queue is full
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kkartaltepe authored and Lain-B committed Feb 10, 2024
1 parent e711496 commit 288ed51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 288ed51

Please sign in to comment.