From d47416d3a28bf5c0028ac420df758ede89ace97b Mon Sep 17 00:00:00 2001 From: He Junyan Date: Wed, 25 May 2022 20:01:34 +0800 Subject: [PATCH] va: encoder: Do not reset the frame count when reconfig(). We should not reset the input/output_frame_count when some configure changes. For example, the if resolution changes, the current way just resets the frame count and make the PTS of the output buffer restart from the original PTS of the first frame. That causes a lot of QOS event and drop all the new frames. We should only reset them when encoder start(). Part-of: --- subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c b/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c index 45f5909..ba5a0d7 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c @@ -62,8 +62,6 @@ static void gst_va_base_enc_reset_state (GstVaBaseEnc * base) { base->frame_duration = GST_CLOCK_TIME_NONE; - base->input_frame_count = 0; - base->output_frame_count = 0; base->width = 0; base->height = 0; @@ -122,6 +120,9 @@ gst_va_base_enc_start (GstVideoEncoder * venc) klass->reset_state (base); + base->input_frame_count = 0; + base->output_frame_count = 0; + base->input_state = NULL; /* Set the minimum pts to some huge value (1000 hours). This keeps -- 2.7.4