* [FFmpeg-devel] [PATCH v1] avfilter/vf_vpp_qsv: set outlink to EOF correctly
@ 2022-05-12 1:18 Fei Wang
2022-05-25 8:28 ` Xiang, Haihao
0 siblings, 1 reply; 2+ messages in thread
From: Fei Wang @ 2022-05-12 1:18 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Fei Wang
1. Return error if filter frame fail before set outlink to EOF in none
pass through mode.
2. Set outlink to EOF before return success in pass through mode.
Fix endless cmd:
ffmpeg -hwaccel qsv -qsv_device /dev/dri/renderD128 -hwaccel_output_format \
qsv -v debug -c:v hevc_qsv -i 4k.h265 \
-filter_complex "vpp_qsv=w=3840:h=2160:async_depth=4[o1];[o1]split=2[s1][s2];
[s2]vpp_qsv=w=1920:h=1080:async_depth=4[o2];[o2]split=2[s3][s4];
[s4]vpp_qsv=w=1920:h=1080:async_depth=4[o3]" \
-map [s1] -c:v hevc_qsv -async 3 -async_depth 3 -b:v 9000k -preset 7 -g 33 -y -f null - \
-map [s3] -c:v hevc_qsv -async 3 -async_depth 3 -b:v 4000k -preset 7 -g 33 -y -f null - \
-map [o3] -c:v hevc_qsv -async 3 -async_depth 3 -b:v 3100k -preset 7 -g 33 -y -f null -
---
libavfilter/vf_vpp_qsv.c | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index cfe343822b..3d9d3afbc8 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -556,15 +556,17 @@ static int activate(AVFilterContext *ctx)
qsv->eof = s->eof;
ret = ff_qsvvpp_filter_frame(qsv, inlink, in);
av_frame_free(&in);
+ if (ret == AVERROR(EAGAIN))
+ goto not_ready;
+ else if (ret < 0)
+ return ret;
- if (s->eof) {
- ff_outlink_set_status(outlink, status, pts);
- return 0;
- }
+ if (s->eof)
+ goto eof;
if (qsv->got_frame) {
qsv->got_frame = 0;
- return ret;
+ return 0;
}
}
} else {
@@ -573,18 +575,27 @@ static int activate(AVFilterContext *ctx)
in->pts = av_rescale_q(in->pts, inlink->time_base, outlink->time_base);
ret = ff_filter_frame(outlink, in);
- return ret;
+ if (ret < 0)
+ return ret;
+
+ if (s->eof)
+ goto eof;
+
+ return 0;
}
}
- if (s->eof) {
- ff_outlink_set_status(outlink, status, pts);
- return 0;
- } else {
- FF_FILTER_FORWARD_WANTED(outlink, inlink);
- }
+not_ready:
+ if (s->eof)
+ goto eof;
+
+ FF_FILTER_FORWARD_WANTED(outlink, inlink);
return FFERROR_NOT_READY;
+
+eof:
+ ff_outlink_set_status(outlink, status, pts);
+ return 0;
}
static int query_formats(AVFilterContext *ctx)
--
2.25.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH v1] avfilter/vf_vpp_qsv: set outlink to EOF correctly
2022-05-12 1:18 [FFmpeg-devel] [PATCH v1] avfilter/vf_vpp_qsv: set outlink to EOF correctly Fei Wang
@ 2022-05-25 8:28 ` Xiang, Haihao
0 siblings, 0 replies; 2+ messages in thread
From: Xiang, Haihao @ 2022-05-25 8:28 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Wang, Fei W
On Thu, 2022-05-12 at 09:18 +0800, Fei Wang wrote:
> 1. Return error if filter frame fail before set outlink to EOF in none
> pass through mode.
> 2. Set outlink to EOF before return success in pass through mode.
>
> Fix endless cmd:
>
> ffmpeg -hwaccel qsv -qsv_device /dev/dri/renderD128
> -hwaccel_output_format \
> qsv -v debug -c:v hevc_qsv -i
> 4k.h265 \
> -filter_complex "vpp_qsv=w=3840:h=2160:async_depth=4[o1];[o1]split=2[s1][s2];
> [s2]vpp_qsv=w=1920:h=1080:async_depth=4[o2];[o2]split=2[s3][s4];
> [s4]vpp_qsv=w=1920:h=1080:async_depth=4[o3]" \
> -map [s1] -c:v hevc_qsv -async 3 -async_depth 3 -b:v 9000k -preset 7 -g 33 -y
> -f null - \
> -map [s3] -c:v hevc_qsv -async 3 -async_depth 3 -b:v 4000k -preset 7 -g 33 -y
> -f null - \
> -map [o3] -c:v hevc_qsv -async 3 -async_depth 3 -b:v 3100k -preset 7 -g 33 -y
> -f null -
> ---
> libavfilter/vf_vpp_qsv.c | 35 +++++++++++++++++++++++------------
> 1 file changed, 23 insertions(+), 12 deletions(-)
>
> diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
> index cfe343822b..3d9d3afbc8 100644
> --- a/libavfilter/vf_vpp_qsv.c
> +++ b/libavfilter/vf_vpp_qsv.c
> @@ -556,15 +556,17 @@ static int activate(AVFilterContext *ctx)
> qsv->eof = s->eof;
> ret = ff_qsvvpp_filter_frame(qsv, inlink, in);
> av_frame_free(&in);
> + if (ret == AVERROR(EAGAIN))
> + goto not_ready;
> + else if (ret < 0)
> + return ret;
>
> - if (s->eof) {
> - ff_outlink_set_status(outlink, status, pts);
> - return 0;
> - }
> + if (s->eof)
> + goto eof;
>
> if (qsv->got_frame) {
> qsv->got_frame = 0;
> - return ret;
> + return 0;
> }
> }
> } else {
> @@ -573,18 +575,27 @@ static int activate(AVFilterContext *ctx)
> in->pts = av_rescale_q(in->pts, inlink->time_base, outlink-
> >time_base);
>
> ret = ff_filter_frame(outlink, in);
> - return ret;
> + if (ret < 0)
> + return ret;
> +
> + if (s->eof)
> + goto eof;
> +
> + return 0;
> }
> }
>
> - if (s->eof) {
> - ff_outlink_set_status(outlink, status, pts);
> - return 0;
> - } else {
> - FF_FILTER_FORWARD_WANTED(outlink, inlink);
> - }
> +not_ready:
> + if (s->eof)
> + goto eof;
> +
> + FF_FILTER_FORWARD_WANTED(outlink, inlink);
>
> return FFERROR_NOT_READY;
> +
> +eof:
> + ff_outlink_set_status(outlink, status, pts);
> + return 0;
> }
>
> static int query_formats(AVFilterContext *ctx)
LGTM, will apply
-Haihao
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-25 8:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 1:18 [FFmpeg-devel] [PATCH v1] avfilter/vf_vpp_qsv: set outlink to EOF correctly Fei Wang
2022-05-25 8:28 ` Xiang, Haihao
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git