ffmpeg fix

This commit is contained in:
2026-04-03 09:28:03 -03:00
parent 36e8358fc9
commit 3f76670169
5 changed files with 138 additions and 19 deletions

View File

@@ -28,6 +28,7 @@ from cht.ui.session_dialog import SessionDialog
from cht.session import load_frame_index, load_segment_manifest, rebuild_manifest, global_time_to_segment
from cht.scrub.manager import ProxyManager
from cht.agent.runner import AgentRunner, check_claude_cli
from cht.telemetry import Telemetry
log = logging.getLogger(__name__)
@@ -42,6 +43,7 @@ class ChtWindow(Adw.ApplicationWindow):
self._manifest = []
self._pending_scrub_global = 0.0
self._scrub_pending = False # throttle flag for scrub updates
self._telemetry = None
# Core components
self._timeline = Timeline()
@@ -158,11 +160,17 @@ class ChtWindow(Adw.ApplicationWindow):
def _on_scene_threshold(self, val):
if self._lifecycle.stream_mgr:
old = self._lifecycle.stream_mgr.scene_threshold
self._lifecycle.stream_mgr.scene_threshold = val
if self._telemetry:
self._telemetry.event("scene_threshold_changed", {"from": old, "to": val})
def _on_min_chunk_changed(self, panel, val):
import cht.config
old = cht.config.TRANSCRIBE_MIN_CHUNK_S
cht.config.TRANSCRIBE_MIN_CHUNK_S = val
if self._telemetry:
self._telemetry.event("min_chunk_changed", {"from": old, "to": val})
def _on_lines_per_group_changed(self, panel, val):
import cht.config
@@ -268,6 +276,8 @@ class ChtWindow(Adw.ApplicationWindow):
self._connect_btn.add_css_class("destructive-action")
mgr = self._lifecycle.start(session_id=session_id)
self._telemetry = Telemetry(mgr.session_dir)
mgr.telemetry = self._telemetry
self._monitor.set_recording(mgr.recording_path)
self._monitor.set_live_source(mgr.relay_url)
@@ -285,12 +295,13 @@ class ChtWindow(Adw.ApplicationWindow):
def _on_live_toggle(self):
if self._timeline.state.live:
# Live → Scrub: don't load growing MKV, let user pick a segment
if self._telemetry:
self._telemetry.event("mode_switch", {"from": "live", "to": "scrub"})
self._timeline.toggle_live(live_player_pos=self._monitor.get_live_position())
# Refresh manifest so scrub bar shows completed segments
self._update_scrub_bar_manifest()
else:
# Scrub → Live: restore recording path, refresh GUI, resume
if self._telemetry:
self._telemetry.event("mode_switch", {"from": "scrub", "to": "live"})
mgr = self._lifecycle.stream_mgr
if mgr:
self._monitor.set_recording(mgr.recording_path)
@@ -442,6 +453,10 @@ class ChtWindow(Adw.ApplicationWindow):
mgr = self._lifecycle.stream_mgr
last_session_id = mgr.session_id if mgr and not mgr.readonly else None
if self._telemetry:
self._telemetry.close()
self._telemetry = None
self._lifecycle.stop()
if self._proxy_mgr: