Commit Graph

362 Commits

Author SHA1 Message Date
Alex P 6898a6ef1b feat(audio): add granular metrics collection and comprehensive error handling
- Implement granular metrics collection for latency and buffer pool operations
- Add detailed error messages with context for all IPC operations
- Enhance logging with additional operational details
- Introduce comprehensive test suite including unit and integration tests
- Add package documentation explaining architecture and components
2025-08-25 21:00:54 +00:00
Alex P 34f8829e8a refactor(audio): improve configuration handling and validation
- Replace hardcoded values with configurable parameters in output streamer
- Add detailed validation rules for socket buffer configuration
- Enhance CPU percent calculation with bounds checking and validation
- Document message format and validation for IPC communication
- Update latency monitor to use configurable thresholds
- Improve adaptive buffer calculations with validation and documentation
2025-08-25 20:36:26 +00:00
Alex P 60a6e6c5c5 refactor(audio): centralize config values and improve documentation
Move hardcoded values to config and add detailed validation rules documentation for audio components. Update function comments to clearly describe validation logic and thresholds.

The changes ensure consistent configuration management and better maintainability while providing comprehensive documentation of validation rules and system behavior.
2025-08-25 20:35:40 +00:00
Alex P c5216920b3 refactor(audio): centralize config constants and update usage
Move hardcoded values to config constants and update all references to use centralized configuration. Includes:
- Audio processing timeouts and intervals
- CGO sleep durations
- Batch processing parameters
- Event formatting and timeouts
- Process monitor calculations
2025-08-25 19:30:57 +00:00
Alex P 9e343b3cc7 refactor(audio): move hardcoded values to config for better flexibility
- Replace hardcoded values with configurable parameters in audio components
- Add new config fields for adaptive buffer sizes and frame pool settings
- Implement memory guard in ZeroCopyFramePool to prevent excessive allocations
2025-08-25 19:02:29 +00:00
Alex P 35a666ed31 refactor(audio): centralize configuration constants in audio module
Replace hardcoded values with centralized config constants for better maintainability and flexibility. This includes sleep durations, buffer sizes, thresholds, and various audio processing parameters.

The changes affect multiple components including buffer pools, latency monitoring, IPC, and audio processing. This refactoring makes it easier to adjust parameters without modifying individual files.

Key changes:
- Replace hardcoded sleep durations with config values
- Centralize buffer sizes and pool configurations
- Move thresholds and limits to config
- Update audio quality presets to use config values
2025-08-25 18:08:12 +00:00
Alex P 7ec583ed6a refactor(audio): centralize config and remove debug logs
- Move hardcoded constants to centralized config system
- Remove verbose debug logging statements
- Clean up unused code and improve error handling
2025-08-25 16:49:48 +00:00
Alex P d1c192bf8b feat(audio): add real-time USB audio config updates and validation
- Add audio device change listener in UI to update USB config
- Implement audio configuration validation before enabling USB audio
- Broadcast audio device change events for all state changes
2025-08-25 14:21:49 +00:00
Alex P c89d678963 refactor(audio): remove unused context from audio input manager
Simplify AudioInputIPCManager by removing unused context and cancellation logic. The context was not providing any meaningful functionality.

fix(ui): handle audio device changes with proper sync

Add delayed microphone state synchronization when audio devices change to prevent race conditions during USB audio reconfiguration.
2025-08-25 13:53:29 +00:00
Alex P 6f02870c90 fix(audio): improve audio device state management
Add proper cleanup for both audio input manager and output supervisor when disabling audio
Ensure complete shutdown of audio processes before USB reconfiguration
2025-08-25 13:19:29 +00:00
Alex P 1a0377bbdf Improvement: automatically resume audio when the audio usb gadget is re-enabled from settings 2025-08-25 12:36:04 +00:00
Alex P f24443e072 Improvement: automatically resume audio when the audio usb gadget is re-enabled from settings 2025-08-25 11:05:42 +00:00
Alex P 2afe2ca539 Fix: USB Gadgets updates 2025-08-25 10:41:53 +00:00
Alex P bc53523fbb Fix: USB Gadgets update 2025-08-25 09:19:03 +00:00
Alex P 44a35aa5c2 feat(audio): add socket buffer configuration and monitoring
Add socket buffer configuration support with metrics collection for audio IPC connections. This improves performance monitoring and allows tuning socket buffers for optimal audio streaming performance.

- Introduce SocketBufferConfig struct with default and high-load presets
- Add socket buffer configuration to AudioServer and AudioInputServer
- Implement socket buffer metrics collection (size, utilization, overflow)
- Add new Prometheus metrics for socket buffer monitoring
2025-08-24 23:56:58 +00:00
Alex P 3a28105f56 Fix: linting errors 2025-08-24 23:36:29 +00:00
Alex P a9a1082bcc Docs: Updated documentation 2025-08-24 23:15:46 +00:00
Alex e0f7b1d930
Merge branch 'dev' into feat/audio-support 2025-08-25 02:08:12 +03:00
Marc Brooks 5188717bb9 fix: useJsonRpc "any" issue
PR #743 didn't have all the files included in the commit.
Mea culpa, many apologies.
2025-08-24 22:58:35 +00:00
Alex Ballas 70e49a1cac chore: ensure that rpc messages get processed sequentially and avoid phantom and repeated key presses (#744) 2025-08-24 22:57:37 +00:00
Marc Brooks 9d40263eed fix: compiler error (#743)
Using { send } gives the resp a type instead of any
2025-08-24 22:54:26 +00:00
Adam Shiervani 0651faeceb feat: improve custom jiggler settings and add timezone support (#742)
* feat: add timezone support to jiggler and fix custom settings persistence

- Add timezone field to JigglerConfig with comprehensive IANA timezone list
- Fix custom settings not loading current values
- Remove business hours preset, add as examples in custom settings
- Improve error handling for invalid cron expressions

* fix: format jiggler.go with gofmt

* fix: add embedded timezone data and validation

- Import time/tzdata to embed timezone database in binary
- Add timezone validation in runJigglerCronTab() to gracefully fallback to UTC
- Add timezone to debug logging in rpcSetJigglerConfig
- Fixes 'unknown time zone' errors when system lacks timezone data

* refactor: add timezone field comments from jiggler options

* chore: move tzdata to backend

* refactor: fix JigglerSetting linting

- Adjusted useEffect dependency to include send function for better data fetching
- Modified layout classes for improved responsiveness and consistency
- Cleaned up code formatting for better readability

---------

Co-authored-by: Siyuan Miao <i@xswan.net>
2025-08-24 22:54:26 +00:00
Serhii 199cca83ed Update mount list for new Debian 13 release (#739)
* Update mount list for new Debian 13 release

* Keep Debian 12 Bookworm as old-stable release
2025-08-24 22:54:26 +00:00
Marc Brooks a3b2b46f49 Lint fix from last merge. (#733) 2025-08-24 22:54:26 +00:00
jackislanding f729675a3f Added crontab scheduler for jiggler (#316) 2025-08-24 22:54:26 +00:00
Marc Brooks 785a68d923 chore(ui)/package upgrades (#724)
| Package                          | From     | To           |
| -------------------------------- | ----------- | ------------ |
| @headlessui/react        | 2.2.4     | 2.2.7        |
| framer-motion              | 12.23.3 | 12.23.12 |
| react                                | 19.1.0   | 19.1.1     |
| react-dom                       | 19.1.0   | 19.1.1    |
| react-simple-keyboard | 3.8.93   | 3.8.106  |
|@eslint/js                         | 9.30.1   | 9.32.0    |
| @types/react                  | 19.1.8   | 19.1.9    |
| @types/react-dom         | 19.1.8   | 19.1.9   |
|eslint                                 | 9.30.1   | 9.32.0    |
|eslint-config-prettier       | 10.1.5   | 10.1.8   |
| typescript                         |  5.8.3    | 5.9.2     |
2025-08-24 22:54:26 +00:00
Alex P 57b7bafcc1 feat(audio): implement comprehensive audio optimization system
- Add AdaptiveOptimizer for real-time parameter adjustment based on latency metrics
- Add AdaptiveBufferConfig for dynamic buffer sizing based on system load
- Implement BatchAudioProcessor for reduced CGO call overhead
- Add AudioBufferPool with sync.Pool for optimized memory allocation
- Implement LatencyMonitor with exponential moving averages
- Add MemoryMetrics for comprehensive memory usage tracking
- Implement PriorityScheduler with SCHED_FIFO for real-time audio processing
- Add zero-copy operations to minimize memory copying in audio pipeline
- Enhance IPC architecture with intelligent frame dropping
- Add comprehensive Prometheus metrics for performance monitoring
- Implement triple-goroutine architecture for audio input processing
- Add adaptive buffering and performance feedback loops
2025-08-24 22:33:49 +00:00
Marc Brooks d952480c2a
fix: useJsonRpc "any" issue
PR #743 didn't have all the files included in the commit.
Mea culpa, many apologies.
2025-08-24 11:40:43 +02:00
Alex P 88679cda2f refactor(audio): improve process monitoring with dynamic clock ticks
- Extract monitoring constants and configuration into centralized locations
- Implement dynamic clock ticks detection for more accurate CPU metrics
- Add warmup samples and bounds checking for CPU percentage calculation
- Replace hardcoded values with constants for better maintainability
2025-08-23 23:35:38 +00:00
Alex P 76174f4486 refactor(audio): improve performance and simplify code structure
- Move audio server logic to dedicated package and simplify main.go
- Optimize buffer pool implementation and remove redundant logging
- Improve process monitoring with synchronized metrics updates
- Enhance microphone contention manager with simplified logic
- Replace mutex with atomic operations for metrics tracking
2025-08-23 22:54:01 +00:00
Alex P 27a999c58a [WIP] Updates: audio output & input subprocesses memory & cpu usage 2025-08-23 21:51:24 +00:00
Alex P ddc2f90016 [WIP] Updates: audio output & input subprocesses memory & cpu usage 2025-08-23 21:36:57 +00:00
Alex P 692f7ddb2d [WIP] Updates: audio output & input subprocesses memory & cpu usage 2025-08-23 21:19:28 +00:00
Alex P 38ad145863 [WIP] Updates: audio output & input subprocesses memory & cpu usage 2025-08-23 21:06:02 +00:00
Alex P 879ea5e472 Fix: fix audio input by reverting change 2025-08-23 16:41:45 +00:00
Alex P 2082b1a671 refactor(audio): rename audio-server flag to audio-output-server for clarity
docs: update development documentation with new make targets
refactor: simplify audio quality presets implementation
style: remove redundant comments and align error handling
chore: add lint-ui-fix target to Makefile
2025-08-23 12:18:33 +00:00
Alex P 5e28a6c429 feat(audio): add system memory endpoint and process metrics monitoring
- Add new /system/memory endpoint to expose total system memory
- Implement process metrics collection for audio and microphone processes
- Update UI to display real-time process metrics with charts
- Replace environment variable check with CLI flag for audio input server
- Improve audio metrics broadcasting with 1-second intervals
- Add memory usage capping for CPU percentage metrics
2025-08-23 11:41:03 +00:00
Alex P 0e1c896aa2 Fix: go lint errors 2025-08-22 23:23:07 +00:00
Alex P 0ed84257f6 Improvements, Fixes: enhanced audio metrics (including prometheus format), fixed lint errors 2025-08-22 23:20:22 +00:00
Alex P 32055f5762 Cleanup: remove polling fallback for /audio/mute status 2025-08-22 22:54:05 +00:00
Alex P 97bcb3c1ea Fix: linter errors 2025-08-22 22:29:48 +00:00
Alex P 6ecb829334 Fix: linter errors 2025-08-22 22:28:15 +00:00
Alex P e360348829 Fix: linter errors 2025-08-22 22:26:15 +00:00
Alex P 1e1677b35a Fix: linter errors 2025-08-22 22:23:50 +00:00
Alex P 3c1e9b8dc2 Fix: audio subprocess handling, avg atency audio metric 2025-08-22 22:21:41 +00:00
Alex P 62d4ec2f89 Fix: audio subprocess handling 2025-08-22 22:17:27 +00:00
Alex P aeb7a12c72 Fix: linting errors 2025-08-22 22:07:35 +00:00
Alex P 671d875890 Fix: literal /home/vscode in cache paths 2025-08-22 21:49:15 +00:00
Alex P 7129bd5521 Fix: workflow indentation 2025-08-22 21:43:51 +00:00
Alex P bd4fbef6dc Tweak: steps order 2025-08-22 21:43:17 +00:00