gst_plugins_base/gst/gdp/gstgdpdepay.c
changeset 8 4a7fac7dd34a
parent 0 0e761a78d257
child 30 7e817e7e631c
--- a/gst_plugins_base/gst/gdp/gstgdpdepay.c	Fri Mar 19 09:35:09 2010 +0200
+++ b/gst_plugins_base/gst/gdp/gstgdpdepay.c	Fri Apr 16 15:15:52 2010 +0300
@@ -21,18 +21,14 @@
  * SECTION:element-gdpdepay
  * @see_also: gdppay
  *
- * <refsect2>
- * <para>
  * This element depayloads GStreamer Data Protocol buffers back to deserialized
  * buffers and events.
- * </para>
- * <para>
- * <programlisting>
+ *
+ * <refsect2>
+ * |[
  * gst-launch -v -m filesrc location=test.gdp ! gdpdepay ! xvimagesink
- * </programlisting>
- * This pipeline plays back a serialized video stream as created in the
+ * ]| This pipeline plays back a serialized video stream as created in the
  * example for gdppay.
- * </para>
  * </refsect2>
  */
 
@@ -260,8 +256,8 @@
         this->header = header;
 
         GST_LOG_OBJECT (this,
-            "read GDP header, payload size %d, switching to state PAYLOAD",
-            this->payload_length);
+            "read GDP header, payload size %d, payload type %d, switching to state PAYLOAD",
+            this->payload_length, this->payload_type);
         this->state = GST_GDP_DEPAY_STATE_PAYLOAD;
         break;
       }
@@ -287,6 +283,13 @@
         } else {
           goto wrong_type;
         }
+
+        if (this->payload_length
+            && (!gst_dp_validate_payload (GST_DP_HEADER_LENGTH, this->header,
+                    gst_adapter_peek (this->adapter, this->payload_length)))) {
+          goto payload_validate_error;
+        }
+
         break;
       }
       case GST_GDP_DEPAY_STATE_BUFFER:
@@ -392,6 +395,13 @@
     ret = GST_FLOW_ERROR;
     goto done;
   }
+payload_validate_error:
+  {
+    GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),
+        ("GDP packet payload does not validate"));
+    ret = GST_FLOW_ERROR;
+    goto done;
+  }
 wrong_type:
   {
     GST_ELEMENT_ERROR (this, STREAM, DECODE, (NULL),