[FFmpeg-devel] [PATCH] avcodec/amfenc: Fix for windows imprecise sleep
Evgeny Pavlov
lucenticus at gmail.com
Mon Oct 16 12:13:20 EEST 2023
This commit reduces the sleep time on Windows to improve AMF encoding
performance on low resolution input videos.
This fix is for Windows only, because sleep() function isn't
very accurate on Windows OS.
Fix for issue #10622
Signed-off-by: Evgeny Pavlov <lucenticus at gmail.com>
---
libavcodec/amfenc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index 061859f85c..0c95465d6e 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -770,7 +770,11 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
if (query_output_data_flag == 0) {
if (res_resubmit == AMF_INPUT_FULL || ctx->delayed_drain || (ctx->eof && res_query != AMF_EOF) || (ctx->hwsurfaces_in_queue >= ctx->hwsurfaces_in_queue_max)) {
block_and_wait = 1;
+#ifdef _WIN32
+ av_usleep(0); //Sleep() is not precise on Windows OS.
+#else
av_usleep(1000);
+#endif
}
}
} while (block_and_wait);
--
2.41.0
More information about the ffmpeg-devel
mailing list