Commit a6acc43
Add automatic HDMI sample rate change detection
Detects when HDMI source changes audio sample rate (44.1kHz ↔ 48kHz)
and triggers automatic reconnection with zero overhead in happy path.
Implementation:
- Added is_capture parameter to handle_alsa_error()
- On 2nd -EPIPE error in capture path, query TC358743 for current rate
- If rate changed, log error and return -1 to trigger reconnection
- OutputRelay's existing retry logic handles full reinitialization
When sample rate changes occur:
- Wrong hardware_frame_size causes immediate -EPIPE errors
- Detection happens within 40-60ms (2-3 frames)
- Automatic recovery via OutputRelay reconnection
- No manual RestartAudioOutput() needed
Overhead analysis:
- Happy path: ZERO overhead (no checks when audio working)
- Error path: ~100-500μs ioctl on 2nd failure only
- Only checks once per error sequence (not repeatedly)
Handles real-world scenarios:
- User switches HDMI source device
- Source changes video resolution with different audio format
- HDMI hotplug/unplug events
- Source switches between PCM 44.1kHz and 48kHz
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 357e2e6 commit a6acc43
1 file changed
+17
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
| 368 | + | |
368 | 369 | | |
369 | 370 | | |
370 | 371 | | |
| |||
377 | 378 | | |
378 | 379 | | |
379 | 380 | | |
380 | | - | |
| 381 | + | |
381 | 382 | | |
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
385 | 386 | | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
386 | 400 | | |
387 | 401 | | |
388 | 402 | | |
| |||
841 | 855 | | |
842 | 856 | | |
843 | 857 | | |
844 | | - | |
| 858 | + | |
845 | 859 | | |
846 | 860 | | |
847 | 861 | | |
| |||
1067 | 1081 | | |
1068 | 1082 | | |
1069 | 1083 | | |
1070 | | - | |
| 1084 | + | |
1071 | 1085 | | |
1072 | 1086 | | |
1073 | 1087 | | |
| |||
0 commit comments