When an old connection closed while a new one started, the audio cleanup
would hold audioMutex for up to 37 seconds during CGO disconnect calls,
blocking the new session from initializing.
Use capture-clear-release pattern to minimize mutex hold time:
- Capture references to sources/relays while holding mutex
- Clear globals immediately so new sessions can proceed
- Release mutex before calling blocking Stop/Disconnect operations
This eliminates the 37-second hang during connection transitions.
- Use mono audio instead of stereo for microphone input
- Add cleanup to stop audio track on component unmount
- Explicitly set AudioTrack to nil when creation fails
- Replace mutex-protected inputSource with atomic.Pointer for lock-free reads
- Eliminate ~100 mutex operations per second in audio packet hot path
- Add defer pattern for safer mutex unlock in enable/disable functions
- Add error logging for audio write failures
- Consolidate Makefile lint commands for brevity
- Prevent concurrent getUserMedia requests to fix toggle flakiness
- Add automatic track recovery when microphone track ends unexpectedly
- Fix auto-enable to only trigger on session start, not when toggling setting
- Ensure backend RPC is sent when auto-enable triggers
- Properly clean up old tracks before requesting new ones
* feat: add web route for sending WOL package to given mac addr
```
adds a new route /device/send-wol/:mac-addr to send the magic WOL package
to the specified mac-addr.
Method is POST and is protected.
Useful for custom wake up scripts: example is sending HTTP request through iOS shortcut
Test plan:
calling the API with curl
```
$ curl -X POST http://<jetkvm-ip>/device/send-wol/xx:xx:xx:xx:xx:xx
WOL sent to xx:xx:xx:xx:xx:xx
```
and observing the magic packet on my laptop/PC:
```
$ ncat -u -l 9 -k | xxd
00000000: ffff ffff ffff d050 9978 a620 d050 9978 .......P.x. .P.x
00000010: a620 d050 9978 a620 d050 9978 a620 d050 . .P.x. .P.x. .P
00000020: 9978 a620 d050 9978 a620 d050 9978 a620 .x. .P.x. .P.x.
00000030: d050 9978 a620 d050 9978 a620 d050 9978 .P.x. .P.x. .P.x
00000040: a620 d050 9978 a620 d050 9978 a620 d050 . .P.x. .P.x. .P
00000050: 9978 a620 d050 9978 a620 d050 9978 a620 .x. .P.x. .P.x.
```
calling the api with invalid mac addr returns HTTP 400 error
```
$ curl -X POST -v http://<jetkvm-ip>/device/send-wol/abcd
...
* Request completely sent off
< HTTP/1.1 400 Bad Request
...
...
Invalid mac address provided
* Resolve golint complaint
---------
Co-authored-by: Marc Brooks <IDisposable@gmail.com>
When browsers recreate audio tracks during long sessions, the backend
now properly handles the new track instead of ignoring it. Old track
handlers detect when they've been superseded and exit cleanly to
prevent goroutine leaks.
- Add AudioInputAutoEnable and AudioOutputEnabled fields to backend config
- Implement RPC methods for get/set audio input auto-enable preference
- Load audio output enabled state from config on startup
- Make manual microphone toggle call backend to enable audio pipeline
- Auto-enable preference now persists across incognito sessions
- Reset microphone state to off when reaching login pages
- Fix issue where manual mic toggle required auto-enable to be on
Implement session-based microphone control with optional auto-enable:
- Microphone disabled by default, only requests permission when enabled
- Added persistent "Auto-enable Microphone" setting in audio settings
- Setting syncs to backend and works across browsers/devices
- Auto-enable respects secure context (HTTPS/localhost only)
- Refactored secure context check into reusable utility function
- Removed unused audioInputEnabled store properties
Added new audio-related UI components and improved localization for multiple languages. The SettingsItem component now supports badge links and variants, enhancing the user experience. Updated the AudioPopover to include quick audio controls for speakers and microphone, with descriptions and HTTPS-only warnings where applicable.
Included the installation script for audio dependencies in the Docker build context preparation. This ensures that the necessary audio components are available during the build process.
Temporarily remove the ability to switch between HDMI and USB audio
output sources. The application now uses USB audio (hw:1,0) exclusively
until HDMI audio capture issues are resolved.
Changes:
- Remove AudioOutputSource config field
- Remove audio source switching logic and UI
- Hardcode USB audio output device
- Remove related RPC methods
The previous default EDID did not advertise audio capabilities,
preventing HDMI audio capture from working. This update ensures
the JetKVM properly identifies itself to source devices and
enables audio capture out of the box.
Changes:
- Display identifies as "JetKVM HDMI" (manufacturer ID: JTK)
- Includes full audio support (2/6/8-channel LPCM, up to 192 kHz)
- Advertises all TC358743XBG capabilities (1080p60, YCbCr, Deep Color)
This allows HDMI audio to work by default without manual EDID
configuration.
Browser autoplay policy blocks audio without user interaction.
Store audio elements in ref and trigger playback when user clicks
the existing 'Manually start stream' button.