backport 167c80bfe052728ae01cfad5f385f1a351bc0a2f from xbmc@xbmc