Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 10, 2025

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 as request.video.rtcp_interval * 5 * 1000. This resulted in very aggressive timeouts (typically 5-25 seconds) that would trigger when RTCP communication had issues, particularly:

  • High bitrate streams that some Apple devices/home hubs couldn't handle properly
  • Network congestion or packet loss affecting RTCP messages
  • HomeKit attempting to reconfigure streams to lower bitrates (which were ignored)

Solution

  1. Implemented conservative timeout bounds: Added minimum timeout of 30 seconds and maximum of 5 minutes to prevent premature stream termination while still catching truly inactive devices
  2. Fixed initial timeout handling: Added proper initial timeout when streams start, since RTCP messages might be delayed
  3. Added debug logging: Added logging to help troubleshoot timeout issues when debug mode is enabled

The timeout calculation now uses:

const timeout = Math.max(30000, Math.min(baseTimeout, 300000))

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

  • All existing tests pass
  • Added comprehensive unit tests for timeout calculation logic
  • Verified builds and linting pass

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.

@donavanbecker donavanbecker changed the base branch from latest to beta-4.1.0 September 10, 2025 11:18
@donavanbecker donavanbecker marked this pull request as ready for review September 10, 2025 11:18
@Copilot Copilot AI changed the title [WIP] No Camera Streams Since Move from 2.4.6 beta to v3.0.3. Spins But No Stream Fix camera streaming timeout issue causing premature stream termination Sep 10, 2025
Copilot finished work on behalf of donavanbecker September 10, 2025 11:26
@Copilot Copilot AI requested a review from donavanbecker September 10, 2025 11:26
@donavanbecker donavanbecker merged commit d78adfb into beta-4.1.0 Sep 10, 2025
@donavanbecker donavanbecker deleted the copilot/fix-772 branch September 10, 2025 12:00
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.

No Camera Streams Since Move from 2.4.6 beta to v3.0.3. Spins But No Stream
2 participants