Added El Massman's optimizations for mediastream.

Thanks El!!!