-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(amfenc): stop busy waiting for encoder output (#350)
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From df5d0203200337f9472b729dfb9a1eb9442971c3 Mon Sep 17 00:00:00 2001 | ||
From: Cameron Gutman <aicommander@gmail.com> | ||
Date: Mon, 2 Sep 2024 16:57:36 -0500 | ||
Subject: [PATCH] amfenc: Use QUERY_TIMEOUT feature to avoid busy looping | ||
|
||
--- | ||
libavcodec/amfenc_av1.c | 2 ++ | ||
libavcodec/amfenc_h264.c | 2 ++ | ||
libavcodec/amfenc_hevc.c | 2 ++ | ||
3 files changed, 6 insertions(+) | ||
|
||
diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c | ||
index c4e9f45e87..5102db2068 100644 | ||
--- a/libavcodec/amfenc_av1.c | ||
+++ b/libavcodec/amfenc_av1.c | ||
@@ -196,6 +196,8 @@ FF_ENABLE_DEPRECATION_WARNINGS | ||
|
||
AMF_ASSIGN_PROPERTY_RATE(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_FRAMERATE, framerate); | ||
|
||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_QUERY_TIMEOUT, 50); | ||
+ | ||
switch (avctx->profile) { | ||
case AV_PROFILE_AV1_MAIN: | ||
profile = AMF_VIDEO_ENCODER_AV1_PROFILE_MAIN; | ||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c | ||
index d3c6f6a10b..d94644bd85 100644 | ||
--- a/libavcodec/amfenc_h264.c | ||
+++ b/libavcodec/amfenc_h264.c | ||
@@ -225,6 +225,8 @@ FF_ENABLE_DEPRECATION_WARNINGS | ||
|
||
AMF_ASSIGN_PROPERTY_RATE(res, ctx->encoder, AMF_VIDEO_ENCODER_FRAMERATE, framerate); | ||
|
||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_QUERY_TIMEOUT, 50); | ||
+ | ||
switch (avctx->profile) { | ||
case AV_PROFILE_H264_BASELINE: | ||
profile = AMF_VIDEO_ENCODER_PROFILE_BASELINE; | ||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c | ||
index c0da0f08b2..4b9e419b74 100644 | ||
--- a/libavcodec/amfenc_hevc.c | ||
+++ b/libavcodec/amfenc_hevc.c | ||
@@ -187,6 +187,8 @@ FF_ENABLE_DEPRECATION_WARNINGS | ||
|
||
AMF_ASSIGN_PROPERTY_RATE(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_FRAMERATE, framerate); | ||
|
||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_QUERY_TIMEOUT, 50); | ||
+ | ||
color_depth = AMF_COLOR_BIT_DEPTH_8; | ||
switch (avctx->profile) { | ||
case AV_PROFILE_HEVC_MAIN: | ||
-- | ||
2.43.0.windows.1 | ||
|