mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 13:02:29 +00:00
hlsdemux: Fix parsing of CODECS and RESOLUTION
hlsdemux does not check for the '"' character in #EXT-X-STREAM-INF attributes. The CODECS parameter is an example of an attribute that might use the '"' symbol and might contain a ',' character inside this quoted string. For example: CODECS="avc1.77.30, mp4a.40.2" hlsdemux does not correctly parse the RESOLUTION attribute, it assumes that an '=' character is used to delineate the width and height values, but the HLS RFC states that a 'x' character must be used as the delimiter between width and height. https://bugzilla.gnome.org/show_bug.cgi?id=725140
This commit is contained in:
parent
91775a1abd
commit
161254d7c0
1 changed files with 15 additions and 2 deletions
|
@ -168,7 +168,7 @@ double_from_string (gchar * ptr, gchar ** endptr, gdouble * val)
|
|||
static gboolean
|
||||
parse_attributes (gchar ** ptr, gchar ** a, gchar ** v)
|
||||
{
|
||||
gchar *end, *p;
|
||||
gchar *end=NULL, *p;
|
||||
|
||||
g_return_val_if_fail (ptr != NULL, FALSE);
|
||||
g_return_val_if_fail (*ptr != NULL, FALSE);
|
||||
|
@ -179,6 +179,19 @@ parse_attributes (gchar ** ptr, gchar ** a, gchar ** v)
|
|||
|
||||
*a = *ptr;
|
||||
end = p = g_utf8_strchr (*ptr, -1, ',');
|
||||
if(end){
|
||||
gchar *q = g_utf8_strchr (*ptr, -1, '"');
|
||||
if(q && q<end){
|
||||
/* special case, such as CODECS="avc1.77.30, mp4a.40.2" */
|
||||
q = g_utf8_next_char (q);
|
||||
if(q){
|
||||
q = g_utf8_strchr (q, -1, '"');
|
||||
}
|
||||
if(q){
|
||||
end = p = g_utf8_strchr (q, -1, ',');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (end) {
|
||||
do {
|
||||
end = g_utf8_next_char (end);
|
||||
|
@ -344,7 +357,7 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
|
|||
} else if (g_str_equal (a, "RESOLUTION")) {
|
||||
if (!int_from_string (v, &v, &list->width))
|
||||
GST_WARNING ("Error while reading RESOLUTION width");
|
||||
if (!v || *v != '=') {
|
||||
if (!v || *v != 'x') {
|
||||
GST_WARNING ("Missing height");
|
||||
} else {
|
||||
v = g_utf8_next_char (v);
|
||||
|
|
Loading…
Reference in a new issue