Files
live555/README.md
Roman Gaufman f4a4e8fb05 Add inter-packet gap monitoring and fix RTCP CPU spinning
## Key Changes

### 1. Inter-packet Gap Monitoring for Proxy Server
- Added -D option with 10-second default timeout for dead stream detection
- Implemented ProxyRTSPClient::checkInterPacketGaps_() functionality
- Automatic stream reset when no packets received within timeout period
- Enhanced proxy server reliability for network interruptions and camera reboots
- Updated method signatures across ProxyServerMediaSession components

### 2. RTCP CPU Spinning Fix
- Fixed infinite loop in RTCPInstance::incomingReportHandler1()
- Added buffer state reset and graceful return instead of break
- Enhanced logging for troubleshooting malformed RTCP packets
- Prevents 100% CPU usage with buggy RTP/RTCP-over-TCP implementations

### 3. Enhanced Documentation
- Updated README.md with comprehensive feature documentation
- Added usage examples for new -D option with different timeout values
- Documented all production reliability improvements
- Updated modifications.patch with proper file exclusions

### 4. Minor Improvements
- Updated copyright years to 2025 across multiple files
- Enhanced TLS state management with setupContinue() method
- Fixed SRTP initialization and ROC handling
- Improved BufferedPacket destructor to prevent stack overflow
- Updated task scheduler for better event loop handling

## Technical Details
- Added fTotNumPacketsReceived and fInterPacketGapMaxTime tracking
- Implemented packet counting across all media subsessions
- Enhanced ProxyRTSPClient constructor with interPacketGapMaxTime parameter
- Added proper task cleanup and delayed task scheduling
- Fixed method signature propagation throughout proxy subsystem

These changes significantly improve live555's production reliability,
particularly for deployment with buggy IP cameras and unstable networks,
while maintaining complete backward compatibility.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 12:26:14 +10:00

79 lines
3.0 KiB
Markdown

# live555 - Enhanced Fork
This is an enhanced fork of the live555 streaming media library with several robustness improvements for production use.
## Build Instructions
```bash
./genMakefiles linux
make -j4
```
Replace "linux" with your platform, e.g. avr32-linux, cygwin, freebsd, iphoneos, linux, linux-64bit, macosx, openbsd, solaris-64bit, etc (see config.PLATFORM files)
## Key Executables
After building, you'll find these important executables:
* `./testProgs/testRTSPClient` - Basic RTSP client for receiving streams
* `./testProgs/openRTSP` - Full-featured RTSP client with many options
* `./proxyServer/live555ProxyServer` - RTSP proxy server with enhanced reliability
* `./mediaServer/live555MediaServer` - RTSP media server for serving static files
## Enhanced Features
This fork includes several improvements over the upstream live555 library:
### 1. Increased Buffer Sizes
- `OutPacketBuffer::maxSize` increased from 60KB to **2MB** across all components
- `StreamParser` bank size increased from 150KB to **600KB**
- `fileSinkBufferSize` increased from 100KB to **600KB**
**Benefits**: Better compatibility with high-bitrate streams and buggy IP cameras that send oversized frames.
### 2. RTSP Server Port Reuse
- Added `-DALLOW_RTSP_SERVER_PORT_REUSE=1` compile flag
- Enables immediate port reuse when restarting services
**Benefits**: Faster service restarts without waiting for TIME_WAIT state. **Warning**: Never run multiple instances on the same port!
### 3. RTCP Error Handling
- Fixed CPU spinning issue with buggy RTP/RTCP-over-TCP implementations
- Added graceful buffer reset instead of infinite loops
- Enhanced logging for troubleshooting network issues
**Benefits**: Prevents 100% CPU usage when dealing with malformed RTCP packets from buggy cameras.
### 4. Dead Stream Detection (Proxy Server)
- New `-D <seconds>` option for inter-packet gap monitoring (default: 10 seconds)
- Automatic detection and reset of dead upstream streams
- Configurable timeout for different network conditions
**Usage**:
```bash
# Use default 10-second timeout
./proxyServer/live555ProxyServer rtsp://camera.example.com/stream
# Use custom 30-second timeout
./proxyServer/live555ProxyServer -D 30 rtsp://camera.example.com/stream
# Disable dead stream detection
./proxyServer/live555ProxyServer -D 0 rtsp://camera.example.com/stream
```
**Benefits**: Automatically recovers from network interruptions, camera reboots, and upstream server issues.
## Production Reliability
These enhancements make live555 significantly more robust for production deployments:
- **Handles buggy IP cameras** with oversized frames and malformed packets
- **Automatically recovers** from network interruptions and dead streams
- **Prevents resource exhaustion** from CPU spinning and memory issues
- **Faster service recovery** with port reuse functionality
- **Better observability** with enhanced logging for troubleshooting
## Compatibility
All changes maintain full API compatibility with upstream live555. Existing applications will benefit from the improvements without code changes.