most solid commit

This commit is contained in:
2026-04-03 08:39:24 -03:00
parent 908231f98a
commit cbb56c6d51
3 changed files with 61 additions and 32 deletions

View File

@@ -5,7 +5,7 @@ from threading import Thread
from gi.repository import GLib
from cht.config import TRANSCRIBE_MIN_CHUNK_S, SEGMENT_DURATION
from cht.config import TRANSCRIBE_MIN_CHUNK_S
from cht.session import rebuild_manifest
from cht.stream.manager import StreamManager
from cht.stream.tracker import RecordingTracker
@@ -122,6 +122,8 @@ class StreamLifecycle:
GLib.idle_add(self._go_live_once)
if self._stream_mgr:
self._stream_mgr.capture_now(on_new_frames=self._handle_new_scene_frames)
if self._stream_mgr:
self._stream_mgr.capture_now(on_new_frames=self._handle_new_scene_frames)
def _go_live_once(self):
if self._stream_mgr:
@@ -231,13 +233,6 @@ class StreamLifecycle:
if not self._stream_mgr.recorder_alive():
log.warning("Recorder died — restarting into new segment")
self._rotate_segment()
return True
# Proactive rotation: cut segment when it exceeds SEGMENT_DURATION
if SEGMENT_DURATION > 0:
dur = self._stream_mgr._estimate_safe_duration()
if dur and dur >= SEGMENT_DURATION:
log.info("Segment reached %.0fs — rotating", dur)
self._rotate_segment()
return True
def _rotate_segment(self):