va: encoder: Do not reset the frame count when reconfig().
authorHe Junyan <junyan.he@intel.com>
Wed, 25 May 2022 12:01:34 +0000 (20:01 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 25 May 2022 18:56:34 +0000 (18:56 +0000)
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2489>

subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c

index 45f5909..ba5a0d7 100644 (file)
@@ -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