appsrc: handle a sample not having caps or a buffer more gracefully

https://bugzilla.gnome.org/show_bug.cgi?id=746908
This commit is contained in:
Nicola Murino 2015-03-27 20:16:28 +01:00 committed by Tim-Philipp Müller
parent b7facbaf22
commit f23736d52f

View file

@ -1666,10 +1666,22 @@ gst_app_src_push_sample_internal (GstAppSrc * appsrc, GstSample * sample)
{
GstBuffer *buffer;
GstCaps *caps;
g_return_val_if_fail (GST_IS_SAMPLE (sample), GST_FLOW_ERROR);
caps = gst_sample_get_caps (sample);
gst_app_src_set_caps (appsrc, caps);
if (caps != NULL) {
gst_app_src_set_caps (appsrc, caps);
} else {
GST_WARNING_OBJECT (appsrc, "received sample without caps");
}
buffer = gst_sample_get_buffer (sample);
if (buffer == NULL) {
GST_WARNING_OBJECT (appsrc, "received sample without buffer");
return GST_FLOW_OK;
}
return gst_app_src_push_buffer_full (appsrc, buffer, FALSE);
}