assrender: Do not iterate over mimetypes without filename

No point spending time on iterating and comparing strings if we
are going to reject the value due to missing filename anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1206>
This commit is contained in:
Rafał Dzięgiel 2021-01-20 13:38:03 +01:00 committed by GStreamer Marge Bot
parent e6ff71f8e7
commit 18b5806ab9

View file

@ -1572,6 +1572,10 @@ gst_ass_render_handle_tag_sample (GstAssRender * render, GstSample * sample)
if (!buf || !structure) if (!buf || !structure)
return; return;
filename = gst_structure_get_string (structure, "filename");
if (!filename)
return;
valid_mimetype = FALSE; valid_mimetype = FALSE;
valid_extension = FALSE; valid_extension = FALSE;
@ -1585,10 +1589,6 @@ gst_ass_render_handle_tag_sample (GstAssRender * render, GstSample * sample)
} }
} }
filename = gst_structure_get_string (structure, "filename");
if (!filename)
return;
if (!valid_mimetype) { if (!valid_mimetype) {
guint len = strlen (filename); guint len = strlen (filename);
const gchar *extension = filename + len - 4; const gchar *extension = filename + len - 4;