diff -r 9b2c3c7a1a9c -r 567bb019e3e3 gst_plugins_base/gst/gdp/gstgdpdepay.c --- a/gst_plugins_base/gst/gdp/gstgdpdepay.c Wed Mar 31 22:03:18 2010 +0300 +++ b/gst_plugins_base/gst/gdp/gstgdpdepay.c Tue Aug 31 15:30:33 2010 +0300 @@ -21,18 +21,14 @@ * SECTION:element-gdpdepay * @see_also: gdppay * - * - * * This element depayloads GStreamer Data Protocol buffers back to deserialized * buffers and events. - * - * - * + * + * + * |[ * gst-launch -v -m filesrc location=test.gdp ! gdpdepay ! xvimagesink - * - * 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. - * * */ @@ -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),