qtdemux: Do not post empty redirect messages

Some misinterpreted data could result in posting redirect messages
with empty redirect strings. It is better not to post them.

An example is the file on bug #597497
This commit is contained in:
Thiago Santos 2010-01-14 14:13:50 -03:00
parent 891ca1f4d3
commit b53a45ed44

View file

@ -2563,18 +2563,20 @@ gst_qtdemux_decorate_and_push_buffer (GstQTDemux * qtdemux,
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
if (G_UNLIKELY (stream->fourcc == FOURCC_rtsp)) { if (G_UNLIKELY (stream->fourcc == FOURCC_rtsp)) {
GstMessage *m;
gchar *url; gchar *url;
url = g_strndup ((gchar *) GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); url = g_strndup ((gchar *) GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
if (url != NULL && strlen (url) != 0) {
/* we have RTSP redirect now */ /* we have RTSP redirect now */
m = gst_message_new_element (GST_OBJECT_CAST (qtdemux), gst_element_post_message (GST_ELEMENT_CAST (qtdemux),
gst_structure_new ("redirect", gst_message_new_element (GST_OBJECT_CAST (qtdemux),
"new-location", G_TYPE_STRING, url, NULL)); gst_structure_new ("redirect",
"new-location", G_TYPE_STRING, url, NULL)));
} else {
GST_WARNING_OBJECT (qtdemux, "Redirect URI of stream is empty, not "
"posting");
}
g_free (url); g_free (url);
gst_element_post_message (GST_ELEMENT_CAST (qtdemux), m);
} }
/* position reporting */ /* position reporting */