Skip to content

Conversation

@nglmercer
Copy link
Contributor

The client state handling and network tasks have been significantly refactored to prevent resource deadlocks and unbounded memory growth. This includes proper buffering of media before publication, graceful shutdown procedures, and enhanced logging for connection status.

Key changes:

  • Added bounded media buffers with LRU eviction for video/audio frames to prevent memory leaks
  • Implemented structured background tasks for TCP reading/writing with proper cancellation
  • Added sequence header caching and pre-publication buffering to ensure stream continuity
  • Enhanced RTMP event handling to detect connection failures and reject streams appropriately
  • Improved logging for connection status, errors, and shutdown events
  • Simplified TLS connection setup and error propagation

The client state handling and network tasks have been significantly refactored to prevent
resource deadlocks and unbounded memory growth. This includes proper buffering of media
before publication, graceful shutdown procedures, and enhanced logging for connection status.

Key changes:
- Added bounded media buffers with LRU eviction for video/audio frames to prevent memory leaks
- Implemented structured background tasks for TCP reading/writing with proper cancellation
- Added sequence header caching and pre-publication buffering to ensure stream continuity
- Enhanced RTMP event handling to detect connection failures and reject streams appropriately
- Improved logging for connection status, errors, and shutdown events
- Simplified TLS connection setup and error propagation
@gg0074x gg0074x requested a review from SergioRibera January 18, 2026 23:20
@Juanperias
Copy link
Member

i feel that this code is ai-generated but i cant prove it

Copy link
Member

@Juanperias Juanperias left a comment

Choose a reason for hiding this comment

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

There are a lot of comments that simply clutter up the code and add nothing (I know these comments are made with AI).

Example:

        // FIXED: Collapsed nested if let
        if let Some(meta) = &state.prepublish_metadata
            && let Ok(res) = state.session.publish_metadata(meta)
        {
            Self::send_packet(tx, res);
        }

        // FIXED: Collapsed nested if let
       // ...

@Juanperias
Copy link
Member

Juanperias commented Jan 19, 2026

My opinion is no, this should not be merged! As long as the code is still riddled with AI slop. If the solution is correct, then fine, but there wasn't human intervention, which makes reviewing the PR extremely tedious, not to mention that the AI tends to break the codebase.

Even so, @SergioRibera is the one managing the project, so the final decision is up to him

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.

2 participants