Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/display_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self):
logger.info("Display modes initialized in %.3f seconds", time.time() - init_time)

self.force_change = False
self._next_live_priority_check = 0.0 # timestamp for throttled live priority checks
self._next_live_priority_check = 0.0 # monotonic timestamp for throttled live priority checks

# All sports and content managers now handled via plugins
logger.info("All sports and content managers now handled via plugin system")
Expand Down Expand Up @@ -1727,7 +1727,7 @@ def run(self):
)

target_duration = max_duration
start_time = time.time()
start_time = time.monotonic()

def _should_exit_dynamic(elapsed_time: float) -> bool:
if not dynamic_enabled:
Expand Down Expand Up @@ -1793,8 +1793,8 @@ def _should_exit_dynamic(elapsed_time: float) -> bool:

# Check for live priority every ~30s so live
# games can interrupt long display durations
elapsed = time.time() - start_time
now = time.time()
elapsed = time.monotonic() - start_time
now = time.monotonic()
if not self.on_demand_active and now >= self._next_live_priority_check:
self._next_live_priority_check = now + 30.0
live_mode = self._check_live_priority()
Expand Down Expand Up @@ -1843,7 +1843,7 @@ def _should_exit_dynamic(elapsed_time: float) -> bool:
time.sleep(display_interval)
self._tick_plugin_updates()

elapsed = time.time() - start_time
elapsed = time.monotonic() - start_time
if elapsed >= target_duration:
logger.debug(
"Reached standard target duration %.2fs for mode %s",
Expand Down Expand Up @@ -1875,7 +1875,7 @@ def _should_exit_dynamic(elapsed_time: float) -> bool:

# Check for live priority every ~30s so live
# games can interrupt long display durations
now = time.time()
now = time.monotonic()
if not self.on_demand_active and now >= self._next_live_priority_check:
self._next_live_priority_check = now + 30.0
live_mode = self._check_live_priority()
Expand Down Expand Up @@ -1915,13 +1915,13 @@ def _should_exit_dynamic(elapsed_time: float) -> bool:
and not loop_completed
and not needs_high_fps
):
elapsed = time.time() - start_time
elapsed = time.monotonic() - start_time
remaining_sleep = max(0.0, max_duration - elapsed)
if remaining_sleep > 0:
self._sleep_with_plugin_updates(remaining_sleep)

if dynamic_enabled:
elapsed_total = time.time() - start_time
elapsed_total = time.monotonic() - start_time
cycle_done = self._plugin_cycle_complete(manager_to_display)

# Log cycle completion status and metrics
Expand Down
4 changes: 4 additions & 0 deletions src/vegas_mode/render_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ def should_recompose(self) -> bool:
if buffer_status['staging_count'] > 0:
return True

# Trigger recompose when pending updates affect visible segments
if self.stream_manager.has_pending_updates_for_visible_segments():
return True

return False

def hot_swap_content(self) -> bool:
Expand Down
15 changes: 15 additions & 0 deletions src/vegas_mode/stream_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,21 @@ def mark_plugin_updated(self, plugin_id: str) -> None:

logger.debug("Plugin %s marked for update", plugin_id)

def has_pending_updates(self) -> bool:
"""Check if any plugins have pending updates awaiting processing."""
with self._buffer_lock:
return len(self._pending_updates) > 0

def has_pending_updates_for_visible_segments(self) -> bool:
"""Check if pending updates affect plugins currently in the active buffer."""
with self._buffer_lock:
if not self._pending_updates:
return False
active_ids = {
seg.plugin_id for seg in self._active_buffer if seg.images
}
return bool(active_ids & self._pending_updates.keys())

def process_updates(self) -> None:
"""
Process pending plugin updates.
Expand Down