Skip to content

Conversation

@eliteprox
Copy link
Collaborator

@eliteprox eliteprox commented Sep 15, 2025

This pull request adds automatic model loading to StreamProcessor and adds a "frame overlay" utility for rendering video output when frame processors are busy (i.e. warmup, reload, etc.) to ensure the encoder stays running with consistent frame throughput during long stream starts or parameter updates.

The change also ensures that /health state for StreamServer begins in LOADING state and changes to IDLE once the model_loader handler returns.

New Example and Documentation Updates:

  • Added a comprehensive example examples/overlay_example.py demonstrating non-blocking model loading, server health transitions, automatic frame overlays, and real-time parameter updates.
  • Updated the README to reference new example files for green tint processing and model loading overlays.
  • Added setting.json for tests and launch.json for new frame loading example

Overlay and Progress Bar Support:

  • Updated TrickleClient to support optional overlay configuration, instantiate an overlay controller, and apply overlays during video frame processing, extend configuration through StreamServer

    overlay_config=OverlayConfig(
    mode=OverlayMode.PROGRESSBAR,
    message="Loading...",
    enabled=True,
    auto_timeout_seconds=1.0,
    ),

  • Added OverlayConfig, OverlayMode, and OverlayController in pytrickle/__init__.py for easier integration and usage in client/server applications.

  • Ensured overlay controller state is reset on client start/stop to prevent stale overlays.

@eliteprox eliteprox marked this pull request as ready for review September 15, 2025 22:29
@eliteprox eliteprox changed the title load_model sync, attach frame processor to server health state Implement non-blocking model preloading with accurate health state management Sep 20, 2025
@eliteprox eliteprox changed the title Implement non-blocking model preloading with accurate health state management Implement non-blocking model loading with accurate health state management Sep 20, 2025
@eliteprox eliteprox marked this pull request as draft September 25, 2025 19:57
@eliteprox eliteprox self-assigned this Oct 1, 2025
@eliteprox eliteprox marked this pull request as ready for review October 27, 2025 17:32
@eliteprox eliteprox force-pushed the fix/load-model-sync branch from 64f3073 to 6962fc0 Compare October 27, 2025 18:55
@eliteprox eliteprox requested a review from pschroedl October 28, 2025 21:51
@eliteprox eliteprox requested a review from JJassonn69 October 31, 2025 16:46
@eliteprox eliteprox changed the title Implement non-blocking model loading with accurate health state management Implement non-blocking model loading with health state transition Nov 3, 2025
@eliteprox eliteprox force-pushed the fix/load-model-sync branch 4 times, most recently from 15ea366 to 2b17af1 Compare November 6, 2025 00:09
@JJassonn69
Copy link
Contributor

Tested the changes with the decorated example/grayscale_chipmunk_example.py and it works without hiccups. No need to invoke await processor._frame_processor.load_model() internal function anymore.

self._auto_loading_active
or (
cfg
and cfg.enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can all the cfg checks be in a function in the LoadingConfig class? Both sides of the if block check the same values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in refactor with loading_config class

…e and rendering.

- Updated TrickleClient to utilize LoadingOverlayController for loading state management.
- Enhanced loading configuration handling in StreamServer and FrameProcessor.
- Updated tests to reflect changes in loading behavior and ensure proper functionality.
- Consolidated timestamp updates in LoadingOverlayController to streamline manual loading state handling.
- Fixed boolean parsing logic for manual loading overlay in StreamServer for clarity.
- Updated comments in stream_processor to clarify the purpose of VideoProcessingResult.WITHHELD.
…overlay module

- Moved LoadingConfig and LoadingMode definitions from loading_config to frame_overlay.
- Updated LoadingOverlayController to utilize new frame_overlay module for loading state management.
- Removed deprecated loading_config and loading_overlay_controller modules.
- Adjusted imports across the codebase to reflect the new structure, ensuring consistent loading behavior handling.
- Updated the parameter update process to run synchronously, improving clarity and reducing complexity.
- Enhanced logging for parameter updates to provide better feedback on success and failure.
- Adjusted the loading overlay example to not block on parameter updates, while demonstrating frame processing delay
@eliteprox eliteprox changed the title Implement non-blocking model loading with health state transition feat: Implement auto-model loading with health state transition, add frame overlay for video processors Nov 22, 2025
@eliteprox eliteprox changed the title feat: Implement auto-model loading with health state transition, add frame overlay for video processors feat: auto-model loading with health state transition, frame overlay for video processors Nov 22, 2025
- Renamed LoadingConfig, LoadingMode, and LoadingOverlayController to OverlayConfig, OverlayMode, and OverlayController for improved clarity.
- Updated all references across the codebase to reflect the new naming conventions.
- Removed the loading_overlay_example.py file as it is no longer needed.
- Changed the overlay mode in OverlayConfig and related components to PROGRESSBAR for improved clarity
- Updated all relevant references in the codebase and tests to reflect this change.
…lback logic

- Added a check in TrickleClient to skip frames when the processor returns None.
- Updated OverlayController to clarify the return value when overlay is disabled or in passthrough mode, ensuring processed frames can be None.
- Improved fallback logic to use original_frame only when overlay logic applies.
Copy link
Contributor

@ad-astra-video ad-astra-video left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved! Nice work on sticking with this one.

The frame overlay feature is a nice base to build on and some additional fixes bundled in to this to get things in a good state.

Update the PR name and add a description of all significant things changed and squash and merge!

@eliteprox eliteprox changed the title feat: auto-model loading with health state transition, frame overlay for video processors feat(client): Add frame overlay, call model_loader automatically on server startup Nov 23, 2025
@eliteprox eliteprox changed the title feat(client): Add frame overlay, call model_loader automatically on server startup feat(client): Add frame overlay, call model_loader on server startup Nov 23, 2025
@eliteprox eliteprox changed the title feat(client): Add frame overlay, call model_loader on server startup feat(client, server): Add frame overlay, call model_loader on server startup Nov 23, 2025
@eliteprox eliteprox merged commit 04e8e05 into main Nov 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants