vaapidecode: renegotiate if caps are not equal
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Fri, 28 Aug 2015 21:27:05 +0000 (00:27 +0300)
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>
Fri, 28 Aug 2015 21:27:05 +0000 (00:27 +0300)
The use of gst_caps_is_always_compatible() for this optimization may lead to
false positives. It is better to stick to gst_caps_is_strictly_equal() to know
if it is required a re-negotiation.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=750835

gst/vaapi/gstvaapidecode.c

index e0378b5..07e8a8b 100644 (file)
@@ -176,8 +176,13 @@ gst_vaapi_decode_input_state_replace (GstVaapiDecode * decode,
   if (decode->input_state) {
     if (new_state) {
       const GstCaps *curcaps = decode->input_state->caps;
-      if (gst_caps_is_always_compatible (curcaps, new_state->caps))
+      /* If existing caps are equal of the new state, keep the
+       * existing state without renegotiating. */
+      if (gst_caps_is_strictly_equal (curcaps, new_state->caps)) {
+        GST_DEBUG ("Ignoring new caps %" GST_PTR_FORMAT
+            " since are equal to current ones", new_state->caps);
         return FALSE;
+      }
     }
     gst_video_codec_state_unref (decode->input_state);
   }