Never re-allocate buffer pool if caps haven't changed.

When using vpudec inside an autoplugged pipeline (e.g. decodebin)
the negotiation is triggered multiple times and identical decoder
output buffers are allocated and freed multiple times.

There are cases where we can't fit 2x decoder buffers in memory at
the same time and decoding fails. This is especially true when the
pipeline also contains OpenGL elements that use the same CMA memory.

Change-Id: I31fe4d34a318ad88b9736db8d5fcf0c50a9bc917
diff --git a/plugins/vpu/gstvpudecobject.c b/plugins/vpu/gstvpudecobject.c
index 41ccc0a..3134b1e 100644
--- a/plugins/vpu/gstvpudecobject.c
+++ b/plugins/vpu/gstvpudecobject.c
@@ -781,7 +781,6 @@
   GST_INFO_OBJECT(vpu_dec_object, "using %s as video output format", gst_video_format_to_string(fmt));
 
   /* Create the output state */
-  //FIXME: set max resolution to avoid buffer reallocate when resolution change.
   vpu_dec_object->output_state = state =
     gst_video_decoder_set_output_state (bdec, fmt, vpu_dec_object->init_info.nPicWidth, \
         vpu_dec_object->init_info.nPicHeight, vpu_dec_object->input_state);
@@ -1370,9 +1369,10 @@
 
     if (buf_ret & VPU_DEC_INIT_OK \
         || buf_ret & VPU_DEC_RESOLUTION_CHANGED) {
-      if (buf_ret & VPU_DEC_RESOLUTION_CHANGED)
+      if (buf_ret & VPU_DEC_RESOLUTION_CHANGED) {
         vpu_dec_object->vpu_report_resolution_change = TRUE; 
-      vpu_dec_object->vpu_need_reconfig = TRUE;
+        vpu_dec_object->vpu_need_reconfig = TRUE;
+      }
       ret = gst_vpu_dec_object_handle_reconfig(vpu_dec_object, bdec);
       /* workaround for VPU will discard decoded video frame when resolution change. */
       if (!IS_HANTRO() && !IS_AMPHION())