amlv4l2dec: CB2 fix crash when resolution changed [1/1]

PD#SWPL-176811

Problem:
set self->input_state to NULL when resolution changed.
it causes crash when caculat pts with fps

Solution:
set self->input_state to NULL after finish v4l2 capture
loop thread

Verify:
ap222

Change-Id: I052b1031f807814a8458c42ce44c6f6513305048
Signed-off-by: fei.deng <fei.deng@amlogic.com>
diff --git a/src/gstamlv4l2videodec.c b/src/gstamlv4l2videodec.c
index f476230..5d722ef 100644
--- a/src/gstamlv4l2videodec.c
+++ b/src/gstamlv4l2videodec.c
@@ -447,12 +447,13 @@
             GST_DEBUG_OBJECT(self, "Compatible caps");
             goto done;
         }
-        gst_video_codec_state_unref(self->input_state);
-        self->input_state = NULL;
 
         gst_aml_v4l2_video_dec_finish(decoder);
         gst_aml_v4l2_object_stop(self->v4l2output);
 
+        gst_video_codec_state_unref(self->input_state);
+        self->input_state = NULL;
+
         /* The renegotiation flow don't blend with the base class flow. To properly
          * stop the capture pool, if the buffers can't be orphaned, we need to
          * reclaim our buffers, which will happend through the allocation query.
@@ -762,8 +763,9 @@
             if (!GST_CLOCK_TIME_IS_VALID(f->pts))
             {
                 frame = f;
+                GST_DEBUG("The pts of the expected output frame is invalid");
+                break;
             }
-            GST_DEBUG("The pts of the expected output frame is invalid");
         }
     }