Commit Graph

55 Commits

Author SHA1 Message Date
Alex P ef5c25efcf Updates: integrate all dev branch changes 2025-10-01 15:50:39 +03:00
Alex P bdcac6a468 [WIP] Updates: update build flows to work with the CGO jetkvm_native 2025-10-01 10:04:42 +03:00
Alex P f2edfa66f0 [WIP] Cleanup: PR Cleanup 2025-09-20 00:54:14 +03:00
Alex P a8b58b5d34 [WIP] Cleanup: removed redundant code 2025-09-16 15:17:49 +03:00
Alex P 1f88dab95f [WIP] Maintainability Improvement: Add debug logging throughout the audio system for easy debugging and troubleshooting 2025-09-16 15:05:08 +03:00
Alex P fb98c4edcb [WIP] Maintainability: Add debug / trace logs to make it easy to debug audio input issues 2025-09-16 11:11:18 +03:00
Alex P e894470ca8 [WIP] Cleanup: function naming 2025-09-16 07:33:34 +00:00
Alex P 996016b0da [WIP] Cleanup: remove unnecessary complexity 2025-09-15 23:00:03 +00:00
Alex P b040b8feaf [WIP] Optimizations: Optimize audio system 2025-09-15 21:22:02 +00:00
Alex P 0e76023c39 Improvement (Maintainability): Make all C code more manageable by moving it to its own dedicated file 2025-09-11 13:27:10 +03:00
Alex P 5da357ba01 [WIP] Cleanup: Remove hid optimization code, as it is out of scope 2025-09-09 23:31:58 +00:00
Alex P a5d1ef1225 refactor(audio): optimize performance and simplify code
- Replace mutex locks with atomic operations for counters
- Remove redundant logging calls to reduce overhead
- Simplify error handling and buffer validation
- Add exponential backoff for audio relay stability
- Streamline CGO audio operations for hotpath optimization
2025-09-09 09:12:05 +00:00
Alex P 3c6184d0e8 [Milestone] Improvement: In-flight audio output quality update 2025-09-09 07:44:37 +00:00
Alex P 2bc7e50391 [WIP] Cleanup, Refactor: Reduce PR complexity, common IPC layer 2025-09-09 07:08:32 +00:00
Alex P 89e68f5cdb [WIP] Change playback latency spikes on Audio Output Quality changes 2025-09-08 22:55:19 +00:00
Alex P 6f10010d71 refactor(audio): remove redundant config variable assignments
Replace repeated local config variable assignments with direct Config access
to reduce memory allocations and improve code maintainability
2025-09-08 21:04:07 +00:00
Alex P df58e04846 feat(audio): implement zero-copy batch processing with reference counting
Add batch reference counting and zero-copy frame management for optimized audio processing. Includes:
- BatchReferenceManager for efficient reference counting
- ZeroCopyFrameSlice utilities for frame management
- BatchZeroCopyProcessor for high-performance batch operations
- Adaptive optimization interval based on stability metrics
- Improved memory management with zero-copy frames
2025-09-08 09:08:07 +00:00
Alex P 6890f17a54 refactor(audio): consolidate supervision logic into base implementation
Move common supervision loop logic to BaseSupervisor with configurable parameters
Simplify input/output supervisor implementations by using base template
Update function comments to be more concise
2025-09-08 05:53:06 +00:00
Alex P d3bbe1bf0a refactor(audio): standardize component logging names and cleanup
- Add component name constants for consistent logging across audio modules
- Remove redundant debug logs and outdated comments
- Delete obsolete naming standards documentation file
2025-09-05 21:12:17 +00:00
Alex P 4075057c2b [WIP] Cleanup: Reduce PR Complexity 2025-09-04 22:06:48 +00:00
Alex P cdf6731639 [WIP] Performance Updates:
Add LSB depth parameter for improved bit allocation and disable MMAP access for compatibility.
Adjust buffer sizing logic to better handle constrained environments while maintaining stability.
2025-09-04 08:47:40 +00:00
Alex P a3702dadd9 Cleanup: reduce PR complexity 2025-09-03 22:35:52 +00:00
Alex P 2568660149 feat(metrics): add configurable metrics collection and performance optimizations
- Add config flags to enable/disable metrics collection, goroutine monitoring, and latency profiling
- Optimize batch processor with configurable queue sizes and thread pinning thresholds
- Skip metrics operations when disabled to reduce overhead
- Update default config with performance-related settings
2025-09-03 20:18:07 +00:00
Alex P 5c55da0787 perf(audio): optimize metrics collection and logging overhead
- Replace direct atomic updates with sampling to reduce contention
- Simplify metrics tracking by removing buffering and using direct updates
- Optimize logging by adding level checks and sampling
- Improve validation performance using cached config values
2025-09-03 19:41:20 +00:00
Alex P 260f62efc3 perf(audio): optimize audio processing paths and reduce overhead
- Replace CGO function variable aliases with direct function calls to eliminate indirection
- Simplify audio frame validation by using cached max size and removing error formatting
- Optimize buffer pool operations by removing metrics collection and streamlining cache access
- Improve batch audio processor by pre-calculating values and reducing config lookups
- Streamline IPC message processing with inline validation and reduced error logging
2025-09-03 17:51:08 +00:00
Alex P a741f05829 fix(audio): add proper locking for config cache updates
Add mutex locking around config cache expiration checks to prevent race conditions. The cache now properly checks initialization status before attempting updates.
2025-09-03 17:08:19 +00:00
Alex P a557987629 perf(audio): optimize hotpath by removing redundant checks and logging
- Skip logging in frame validation to reduce overhead
- Only update cache when expired to avoid unnecessary operations
- Remove duplicate config caching system and simplify buffer handling
- Optimize batch processing with pre-allocated buffers and conditional time tracking
2025-09-03 16:55:39 +00:00
Alex P 5353c1cab2 perf(audio): optimize opus decode-write with separate buffers
- Add PCM buffer pool and config for optimized decode-write operations
- Implement separate buffer handling in CGO audio processing
- Update batch processor to support both legacy and optimized paths
2025-09-03 16:28:25 +00:00
Alex P 370178e43b fix(audio): remove arm architecture restriction from cgo build tags 2025-09-03 15:49:07 +00:00
Alex P 9f1dd28ad6 feat(audio): add batch write processing and improve thread management
- Add batch write processing functionality to match existing read processing
- Improve thread pinning logic with separate controls for read/write
- Add new batch processing configuration parameters
- Update build tags to exclude arm architecture
2025-09-03 15:21:35 +00:00
Alex P 2ab90e76e0 feat(audio): add validation cache fields to AudioConfigCache
Add atomic fields to AudioConfigCache for validation parameters to enable lock-free access
Optimize validation functions to use cached values for common cases
Move AudioFrameBatch to separate file and update validation logic
2025-09-03 14:48:41 +00:00
Alex P 1b7198aec2 feat(audio): implement sized buffer pool and config caching
Add SizedBufferPool for efficient memory management with size tracking and statistics
Introduce AudioConfigCache to minimize GetConfig() calls in hot paths
Add batch processing support for audio frames to reduce CGO overhead
Extend AudioBufferPoolDetailedStats with total bytes and average size metrics
2025-09-03 14:00:12 +00:00
Alex P 8110be6cc6 feat(audio): optimize audio processing with batch processing and goroutine monitoring
- Add batch audio processing to reduce CGO call overhead
- Implement goroutine monitoring and cleanup for leak prevention
- Optimize buffer pool with TTL-based cache and latency-aware cleanup
- Add configurable parameters for batch processing and monitoring
- Improve CGO audio read performance with config caching
2025-09-03 12:10:54 +00:00
Alex P 950ca2bd99 fix(audio): improve process termination handling in input supervisor
Add more robust process state checking and error handling during audio input server shutdown. Use signal 0 to verify process existence before killing and handle various edge cases. Also improve logging to better track shutdown outcomes.
2025-09-01 11:08:13 +00:00
Alex P dfbf9249b9 fix(audio): improve audio initialization and process termination handling
- Add retry logic for CGO audio initialization
- Enhance process termination checks in input supervisor
- Skip initialization check in cgo_audio to avoid compilation issues
- Add proper error handling for audio system initialization failures
2025-09-01 10:24:26 +00:00
Alex P 758bbbfff6 feat(audio): add latency histogram metrics collection and visualization
- Add LatencyHistogramData interface and implement histogram collection in granular metrics
- Create LatencyHistogram component for visualizing latency distribution
- Update audio metrics events to include histogram data
- Add comprehensive tests for histogram functionality
- Improve error handling for OPUS encoder parameter updates
- Optimize validation cache initialization
2025-08-28 00:24:30 +00:00
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 6355dd87be feat(audio): add pool hit tracking and optimize buffer management
refactor(ui): extract audio config display and status indicator components
refactor(audio): simplify validation and error handling
refactor(config): remove duplicate audio quality constants
perf(buffer): optimize buffer pool allocation and tracking
docs(audio): streamline package documentation
2025-08-27 19:37:34 +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 b1f85db7de feat(audio): enhance error handling and add device health monitoring
- Implement robust error recovery with progressive backoff in audio streaming
- Add comprehensive device health monitoring system
- Improve ALSA device handling with enhanced retry logic
- Refactor IPC message handling to use shared pools
- Add validation utilities for audio frames and configuration
- Introduce atomic utilities for thread-safe metrics tracking
- Update latency histogram to use configurable buckets
- Add documentation for new metrics and configuration options
2025-08-26 12:51:11 +00:00
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 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 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 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 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 6ecb829334 Fix: linter errors 2025-08-22 22:28:15 +00:00
Alex P aeb7a12c72 Fix: linting errors 2025-08-22 22:07:35 +00:00
Alex P dee8a0b5a1 Fix: golangci-lint 2025-08-22 21:21:09 +00:00
Alex P 629cdf59a7 perf(audio): optimize audio processing with batching and atomic operations
- Implement batch audio processing to reduce CGO overhead
- Replace mutexes with atomic operations for contention management
- Add buffer pooling to reduce allocations
- Optimize microphone operation cooldown with lock-free approach
- Improve error handling with pre-allocated error objects
2025-08-13 14:49:08 +00:00