Commit Graph

14 Commits

Author SHA1 Message Date
Alex P ece36ce5fd feat(audio): optimize validation and add dynamic opus encoder configuration
Consolidate audio frame validation functions into a single optimized implementation and add dynamic OPUS encoder parameter updates based on quality settings. Initialize validation cache at startup for consistent performance.

Add latency profiler for end-to-end audio pipeline monitoring. Update test cases to use unified validation function and initialize cache.

The changes improve performance by reducing function call overhead and enabling runtime optimization of audio encoding parameters based on quality presets.
2025-08-27 23:44:16 +00:00
Alex P 25363cef90 perf(audio): replace frame validation with ultra-fast version
Use ValidateAudioFrameUltraFast in critical audio paths to reduce processing overhead
Reduce minimum frame size to 1 byte to allow smaller frames
2025-08-27 22:44:34 +00:00
Alex P 50e04192bf refactor(audio): standardize log levels and messages across components
- Change Info logs to Debug for routine operations
- Standardize log message formatting to lowercase
- Improve error message clarity and consistency
- Add new metrics for device health and memory monitoring
- Simplify config constants documentation
2025-08-27 18:11:06 +00:00
Alex P dc2db8ed2d feat(audio): add comprehensive input validation and base components
refactor(audio): restructure metrics and supervisor components into base implementations
feat(audio): add validation for all audio configurations and frames
fix(audio): fix atomic alignment in metrics structures
refactor(audio): consolidate common functionality into base manager and supervisor
feat(audio): add output IPC manager and config validation
2025-08-27 17:47:39 +00:00
Alex P 6a68e23d12 refactor(audio): improve error handling and memory management
- remove redundant error logging in audio supervisor stop calls
- add buffer pool for memory optimization in audio relay and ipc
- return default metrics when process is not running
- add channel closed flags to prevent double closing
- standardize component naming and logging
- add comprehensive documentation for audio components
- improve test coverage with new unit tests
2025-08-26 14:36:07 +00:00
Alex P e4ed2b8fad refactor(audio): rename audio components for clarity and add validation
Rename audio server/client components to be more specific (AudioOutputServer/Client). Add new validation.go and ipc_common.go files for shared IPC functionality. Improve error handling and cleanup in input/output IPC components.

Disable granular metrics logging to reduce log pollution. Reset metrics on failed start and ensure proper cleanup. Add common IPC message interface and optimized message pool for reuse.
2025-08-26 10:42:25 +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 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 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
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 0ed84257f6 Improvements, Fixes: enhanced audio metrics (including prometheus format), fixed lint errors 2025-08-22 23:20:22 +00:00
Alex P 3c1e9b8dc2 Fix: audio subprocess handling, avg atency audio metric 2025-08-22 22:21:41 +00:00
Alex P aeb7a12c72 Fix: linting errors 2025-08-22 22:07:35 +00:00
Alex P 423d5775e3 [WIP] Performance Enhancements: move audion processing into a separate process 2025-08-22 12:04:30 +00:00