Skip to content

feat(WebrtcCamerastreamer): logging and recovery#1731

Merged
pedrolamas merged 2 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/webrtc-camera-streamer-improvements
Nov 7, 2025
Merged

feat(WebrtcCamerastreamer): logging and recovery#1731
pedrolamas merged 2 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/webrtc-camera-streamer-improvements

Conversation

@pedrolamas

Copy link
Copy Markdown
Member

Improves error handling and logging on the WebRTC Camera Streamer handler, and also includes code that will switch whether to send iceServers or not on retry.

Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
@pedrolamas pedrolamas added this to the 1.34.5 milestone Nov 6, 2025
@pedrolamas pedrolamas requested a review from Copilot November 6, 2025 13:31
@pedrolamas pedrolamas added the FR - Enhancement New feature or request label Nov 6, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the WebRTC camera streamer component to improve code organization and add error resilience for ICE server compatibility issues.

  • Extracts inline fetch calls into separate helper methods (sendInitialRequest, sendRemoteCandidatesRequest, sendOfferRequest, ensureResponseOk)
  • Implements a fallback mechanism that toggles ICE server inclusion on request failures
  • Adds response validation with content-type checking

Comment on lines +213 to +214
await this.ensureResponseOk(response)
}

Copilot AI Nov 6, 2025

Copy link

Choose a reason for hiding this comment

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

The ensureResponseOk method consumes the response body by calling response.text() when validation fails. However, for successful responses in sendRemoteCandidatesRequest and sendOfferRequest, the response body is never consumed, which may cause resource leaks or prevent connection reuse in some browsers. Consider consuming the response in the success case as well, e.g., await response.text() after ensureResponseOk, or modify ensureResponseOk to always consume the body.

Copilot uses AI. Check for mistakes.
Comment on lines +230 to +231
await this.ensureResponseOk(response)
}

Copilot AI Nov 6, 2025

Copy link

Choose a reason for hiding this comment

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

The ensureResponseOk method consumes the response body by calling response.text() when validation fails. However, for successful responses in sendRemoteCandidatesRequest and sendOfferRequest, the response body is never consumed, which may cause resource leaks or prevent connection reuse in some browsers. Consider consuming the response in the success case as well, e.g., await response.text() after ensureResponseOk, or modify ensureResponseOk to always consume the body.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

A fair point, but AFAIK we can indeed leave to the browser to collect unreferenced responses and dispose of them, so that should be fine to leave as it currently stands.

@pedrolamas pedrolamas merged commit 978ef60 into fluidd-core:develop Nov 7, 2025
4 checks passed
@pedrolamas pedrolamas deleted the pedrolamas/webrtc-camera-streamer-improvements branch November 7, 2025 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FR - Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants