diff --git a/cht/stream/manager.py b/cht/stream/manager.py index 25e6629..620f303 100644 --- a/cht/stream/manager.py +++ b/cht/stream/manager.py @@ -10,6 +10,7 @@ Architecture: import json import logging +import os import re import time from queue import Queue, Empty @@ -266,8 +267,11 @@ class StreamManager: frame_num = start_number offset = self.current_global_offset buf = b"" + raw_fd = proc.stdout.fileno() while True: - chunk = proc.stdout.read(4096) + # os.read on the raw fd returns as soon as ANY data is available + # (no Python buffered-IO blocking waiting to fill a buffer) + chunk = os.read(raw_fd, 65536) if not chunk: break buf += chunk