mirror of https://github.com/jetkvm/kvm.git
[WIP] Cleanup: removed redundant code
This commit is contained in:
parent
b23cc50d6c
commit
a8b58b5d34
|
@ -298,8 +298,6 @@ func (c *AudioConfigCache) GetBufferTooLargeError() error {
|
||||||
return c.bufferTooLargeDecodeWrite
|
return c.bufferTooLargeDecodeWrite
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removed duplicate config caching system - using AudioConfigCache instead
|
|
||||||
|
|
||||||
// updateCacheIfNeeded updates cache only if expired to avoid overhead
|
// updateCacheIfNeeded updates cache only if expired to avoid overhead
|
||||||
func updateCacheIfNeeded(cache *AudioConfigCache) {
|
func updateCacheIfNeeded(cache *AudioConfigCache) {
|
||||||
if cache.initialized.Load() {
|
if cache.initialized.Load() {
|
||||||
|
@ -464,7 +462,6 @@ var (
|
||||||
batchProcessingCount atomic.Int64
|
batchProcessingCount atomic.Int64
|
||||||
batchFrameCount atomic.Int64
|
batchFrameCount atomic.Int64
|
||||||
batchProcessingTime atomic.Int64
|
batchProcessingTime atomic.Int64
|
||||||
// Batch time tracking removed
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetBufferFromPool gets a buffer from the pool with at least the specified capacity
|
// GetBufferFromPool gets a buffer from the pool with at least the specified capacity
|
||||||
|
@ -618,7 +615,7 @@ func CGOAudioClose() { cgoAudioClose() }
|
||||||
func CGOAudioReadEncode(buf []byte) (int, error) { return cgoAudioReadEncode(buf) }
|
func CGOAudioReadEncode(buf []byte) (int, error) { return cgoAudioReadEncode(buf) }
|
||||||
func CGOAudioPlaybackInit() error { return cgoAudioPlaybackInit() }
|
func CGOAudioPlaybackInit() error { return cgoAudioPlaybackInit() }
|
||||||
func CGOAudioPlaybackClose() { cgoAudioPlaybackClose() }
|
func CGOAudioPlaybackClose() { cgoAudioPlaybackClose() }
|
||||||
func CGOAudioDecodeWriteLegacy(buf []byte) (int, error) { return cgoAudioDecodeWrite(buf) }
|
|
||||||
func CGOAudioDecodeWrite(opusData []byte, pcmBuffer []byte) (int, error) {
|
func CGOAudioDecodeWrite(opusData []byte, pcmBuffer []byte) (int, error) {
|
||||||
return cgoAudioDecodeWriteWithBuffers(opusData, pcmBuffer)
|
return cgoAudioDecodeWriteWithBuffers(opusData, pcmBuffer)
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,6 @@ func (aim *AudioInputManager) Stop() {
|
||||||
|
|
||||||
aim.logComponentStop(AudioInputManagerComponent)
|
aim.logComponentStop(AudioInputManagerComponent)
|
||||||
|
|
||||||
// Flush any pending sampled metrics before stopping
|
|
||||||
aim.flushPendingMetrics()
|
|
||||||
|
|
||||||
// Stop the IPC-based audio input
|
// Stop the IPC-based audio input
|
||||||
aim.ipcManager.Stop()
|
aim.ipcManager.Stop()
|
||||||
|
|
||||||
|
@ -120,8 +117,6 @@ func (aim *AudioInputManager) WriteOpusFrame(frame []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
aim.recordFrameProcessed(len(frame))
|
|
||||||
aim.updateLatency(processingTime)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -164,8 +159,6 @@ func (aim *AudioInputManager) WriteOpusFrameZeroCopy(frame *ZeroCopyAudioFrame)
|
||||||
|
|
||||||
// Update metrics
|
// Update metrics
|
||||||
atomic.AddInt64(&aim.framesSent, 1)
|
atomic.AddInt64(&aim.framesSent, 1)
|
||||||
aim.recordFrameProcessed(frame.Length())
|
|
||||||
aim.updateLatency(processingTime)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,12 +59,6 @@ func (bam *BaseAudioManager) resetMetrics() {
|
||||||
bam.metrics.AverageLatency = 0
|
bam.metrics.AverageLatency = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// flushPendingMetrics is now a no-op since we use direct atomic updates
|
|
||||||
func (bam *BaseAudioManager) flushPendingMetrics() {
|
|
||||||
// No-op: metrics are now updated directly without local buffering
|
|
||||||
// This function is kept for API compatibility
|
|
||||||
}
|
|
||||||
|
|
||||||
// getBaseMetrics returns a copy of the base metrics
|
// getBaseMetrics returns a copy of the base metrics
|
||||||
func (bam *BaseAudioManager) getBaseMetrics() BaseAudioMetrics {
|
func (bam *BaseAudioManager) getBaseMetrics() BaseAudioMetrics {
|
||||||
return BaseAudioMetrics{
|
return BaseAudioMetrics{
|
||||||
|
@ -77,8 +71,6 @@ func (bam *BaseAudioManager) getBaseMetrics() BaseAudioMetrics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// logComponentStart logs component start with consistent format
|
// logComponentStart logs component start with consistent format
|
||||||
func (bam *BaseAudioManager) logComponentStart(component string) {
|
func (bam *BaseAudioManager) logComponentStart(component string) {
|
||||||
bam.logger.Debug().Str("component", component).Msg("starting component")
|
bam.logger.Debug().Str("component", component).Msg("starting component")
|
||||||
|
|
|
@ -104,19 +104,11 @@ func (aom *AudioOutputIPCManager) WriteOpusFrame(frame *ZeroCopyAudioFrame) erro
|
||||||
return fmt.Errorf("output frame validation failed: %w", err)
|
return fmt.Errorf("output frame validation failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
start := time.Now()
|
|
||||||
|
|
||||||
// Send frame to IPC server
|
// Send frame to IPC server
|
||||||
if err := aom.server.SendFrame(frame.Data()); err != nil {
|
if err := aom.server.SendFrame(frame.Data()); err != nil {
|
||||||
aom.recordFrameDropped()
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update metrics
|
|
||||||
processingTime := time.Since(start)
|
|
||||||
aom.recordFrameProcessed(frame.Length())
|
|
||||||
aom.updateLatency(processingTime)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,22 +122,14 @@ func (aom *AudioOutputIPCManager) WriteOpusFrameZeroCopy(frame *ZeroCopyAudioFra
|
||||||
return fmt.Errorf("audio output server not initialized")
|
return fmt.Errorf("audio output server not initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
start := time.Now()
|
|
||||||
|
|
||||||
// Extract frame data
|
// Extract frame data
|
||||||
frameData := frame.Data()
|
frameData := frame.Data()
|
||||||
|
|
||||||
// Send frame to IPC server (zero-copy not available, use regular send)
|
// Send frame to IPC server (zero-copy not available, use regular send)
|
||||||
if err := aom.server.SendFrame(frameData); err != nil {
|
if err := aom.server.SendFrame(frameData); err != nil {
|
||||||
aom.recordFrameDropped()
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update metrics
|
|
||||||
processingTime := time.Since(start)
|
|
||||||
aom.recordFrameProcessed(len(frameData))
|
|
||||||
aom.updateLatency(processingTime)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@ import (
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Removed unused AudioOutputStreamer struct - actual streaming uses direct functions
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
outputStreamingRunning int32
|
outputStreamingRunning int32
|
||||||
outputStreamingCancel context.CancelFunc
|
outputStreamingCancel context.CancelFunc
|
||||||
|
|
|
@ -17,8 +17,6 @@ const (
|
||||||
AudioOutputSupervisorComponent = "audio-output-supervisor"
|
AudioOutputSupervisorComponent = "audio-output-supervisor"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// AudioOutputSupervisor manages the audio output server subprocess lifecycle
|
// AudioOutputSupervisor manages the audio output server subprocess lifecycle
|
||||||
type AudioOutputSupervisor struct {
|
type AudioOutputSupervisor struct {
|
||||||
*BaseSupervisor
|
*BaseSupervisor
|
||||||
|
|
|
@ -163,5 +163,4 @@ func RecordSocketBufferMetrics(conn net.Conn, component string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Socket buffer sizes recorded for debugging if needed
|
// Socket buffer sizes recorded for debugging if needed
|
||||||
// Removed detailed metrics as they weren't being used
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue