Fix camera streaming timeout issue causing premature stream termination #1515
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue where camera streams would stop working after upgrading from v2.4.6 beta to v3.0.3+. Users experienced cameras that would spin indefinitely in the Home app without establishing a stream, with logs showing "Device appears to be inactive. Stopping stream." after approximately 25 seconds.
Root Cause
The issue was in the timeout logic in
src/streamingDelegate.ts
where the timeout was calculated asrequest.video.rtcp_interval * 5 * 1000
. This resulted in very aggressive timeouts (typically 5-25 seconds) that would trigger when RTCP communication had issues, particularly:Solution
The timeout calculation now uses:
This ensures streams have sufficient time to establish proper RTCP communication without being prematurely terminated, while still maintaining reasonable timeouts for genuinely inactive devices.
Testing
Fixes #772.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.