Skip to content

Conversation

@eliteprox
Copy link
Collaborator

@eliteprox eliteprox commented Dec 10, 2025

This pull request improves the accuracy and responsiveness of the server's internal state transitions and health reporting. The main focus is on ensuring the pipeline state automatically updates based on client and stream activity, and on cleaning up the health status payload for clarity and consistency.

State transition improvements:

  • The internal pipeline state now automatically transitions to OK when there are active streams or an active client, and to IDLE when there is no activity, provided the system is not in an error state. This logic is applied in both the set_active_client and update_active_streams methods for consistency. [1] [2]

  • The test for state transitions in test_state_integration.py is updated to expect the state to auto-transition to OK when a stream starts, reflecting the new behavior.

Health status reporting changes:

  • The health summary in server.py now consistently reports the status field instead of the legacy state field.

  • The get_pipeline_state method's returned dictionary is simplified: it now omits the redundant state, pipeline_state, and additional_info fields, and only includes the status and other essential pipeline indicators.

Before:
GET /stream/status

{
    "status": "IDLE",
    "state": "IDLE",
    "error_message": null,
    "pipeline_ready": true,
    "active_streams": 0,
    "startup_complete": true,
    "pipeline_state": "IDLE",
    "additional_info": {},
    "client_active": false
}

After:
GET /stream/status

{
    "status": "IDLE",
    "pipeline_ready": true,
    "active_streams": 0,
    "startup_complete": true,
    "client_active": false
}

While streaming:

{
    "status": "OK",
    "pipeline_ready": true,
    "active_streams": 1,
    "startup_complete": true,
    "client_active": true,
    "client_running": true,
    "fps": {
        "ingress_video_fps": 15.019144316458277,
        "ingress_audio_fps": 49.99638566362287,
        "egress_video_fps": 15.018221790956062,
        "egress_audio_fps": 49.9960214019784
    },
    "current_params": {
        "subscribe_url": "https://10.10.7.61:9995/ai/trickle/stream-vovnap-a426ba36",
        "publish_url": "https://10.10.7.61:9995/ai/trickle/stream-vovnap-a426ba36-out",
        "gateway_request_id": "stream-vovnap-a426ba36"
    }
}

@eliteprox eliteprox marked this pull request as draft December 10, 2025 17:13
@eliteprox eliteprox removed the request for review from ad-astra-video December 10, 2025 17:13
@eliteprox eliteprox marked this pull request as ready for review December 10, 2025 17:24
@eliteprox eliteprox changed the title fix(state, server): consolidate duplicate status fields and fix pipeline state API fix(state, server): consolidate duplicate status fields and fix server state response Dec 10, 2025
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.

stream/status request duplicates fields and returns inaccurate pipeline_state

2 participants