If the sitecore link manager has alwaysIncludeServerUrl set to true, MediaManager.GetMediaUrl(mediaItem) will return a link along the lines of:
http://sub.domain.tld/~/media/Images/path/...
LinkUtil.GetMediaUrl line 16 shows:
return Sitecore.StringUtil.EnsurePrefix('/', Sitecore.Resources.Media.MediaManager.GetMediaUrl(mediaItem));
which will convert the produced URL into:
/http://sub.domain.tld/~media/Images/path/...