[0.11] gstreamer: caps: don't create broken caps for invalid media types

Wim Taymans wtay at kemper.freedesktop.org
Tue Mar 8 09:12:39 PST 2011


Module: gstreamer
Branch: 0.11
Commit: 2bbfa3304ce183a1ef936023b4959c4134161c46
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=2bbfa3304ce183a1ef936023b4959c4134161c46

Author: Jonathan Matthew <jonathan at d14n.org>
Date:   Fri Mar  4 08:28:25 2011 +1000

caps: don't create broken caps for invalid media types

Check if structure has been created before appending it to the caps. Free the
caps in the case of an error to not conceal it be returning empty caps.

Fixes #642271

---

 gst/gstcaps.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gst/gstcaps.c b/gst/gstcaps.c
index 7e8f262..083f296 100644
--- a/gst/gstcaps.c
+++ b/gst/gstcaps.c
@@ -225,7 +225,10 @@ gst_caps_new_simple (const char *media_type, const char *fieldname, ...)
   structure = gst_structure_new_valist (media_type, fieldname, var_args);
   va_end (var_args);
 
-  gst_caps_append_structure_unchecked (caps, structure);
+  if (structure)
+    gst_caps_append_structure_unchecked (caps, structure);
+  else
+    gst_caps_replace (&caps, NULL);
 
   return caps;
 }



More information about the gstreamer-commits mailing list