GST_OBJECT_LOCK (self);
if (req_name == NULL || strlen (req_name) < 6
- || !g_str_has_prefix (req_name, "sink_")) {
+ || !g_str_has_prefix (req_name, "sink_")
+ || strrchr (req_name, '%') != NULL) {
/* no name given when requesting the pad, use next available int */
serial = ++priv->max_padserial;
} else {
+ gchar *endptr = NULL;
+
/* parse serial number from requested padname */
- serial = g_ascii_strtoull (&req_name[5], NULL, 10);
- if (serial > priv->max_padserial)
- priv->max_padserial = serial;
+ serial = g_ascii_strtoull (&req_name[5], &endptr, 10);
+ if (endptr != NULL && *endptr == '\0') {
+ if (serial > priv->max_padserial) {
+ priv->max_padserial = serial;
+ }
+ } else {
+ serial = ++priv->max_padserial;
+ }
}
name = g_strdup_printf ("sink_%u", serial);