From 9e2ad6054cd287026da3c7f0e65c10cbd866c254 Mon Sep 17 00:00:00 2001 From: Mick Date: Thu, 4 Jun 2026 16:59:23 +0800 Subject: [PATCH] [diffusion] feat: speed up lossless realtime rgb transport (#27236) --- .../sglang/multimodal_gen/runtime/utils/realtime_video.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/sglang/multimodal_gen/runtime/utils/realtime_video.py b/python/sglang/multimodal_gen/runtime/utils/realtime_video.py index c651209ee..2c2786ee5 100644 --- a/python/sglang/multimodal_gen/runtime/utils/realtime_video.py +++ b/python/sglang/multimodal_gen/runtime/utils/realtime_video.py @@ -27,6 +27,7 @@ WEBP_FRAME_CONTENT_TYPE = "image/webp" JPEG_FRAME_CONTENT_TYPE = "image/jpeg" RAW_RGB_CHANNELS = 3 RAW_RGBA_CHANNELS = 4 +_RAW_RGB_DELTA_GZIP_LEVEL = 0 def build_delta_gzip_raw_rgb_payload( @@ -46,7 +47,10 @@ def build_delta_gzip_raw_rgb_payload( if reference_frame is not None else None ) - compressor = zlib.compressobj(level=1, method=zlib.DEFLATED, wbits=31) + # keep gzip framing for lossless transport without spending realtime budget on compression + compressor = zlib.compressobj( + level=_RAW_RGB_DELTA_GZIP_LEVEL, method=zlib.DEFLATED, wbits=31 + ) compressed_chunks = [] for frame in frames: if len(frame) != frame_size: