Some optimization in HLS stream routine