Closed tphakala closed 3 weeks ago
The recent changes introduce a multi-source audio processing capability, replacing single audio buffer handling with a map of audio buffers. This affects various components, including the Processor
, DatabaseAction
, and several functions related to audio capture and processing. New fields like Source
have been added to structs to track the origin of audio data. Additionally, concurrency control and logging improvements have been made to enhance robustness and traceability.
File Path | Change Summary |
---|---|
internal/analysis/processor/actions.go |
Modified DatabaseAction to use AudioBuffers map, updated Execute method to call myaudio.ReadSegmentFromCaptureBuffer . |
internal/analysis/processor/processor.go |
Updated Processor struct to use AudioBuffers map, added Source to PendingDetection , modified New function parameters. |
internal/analysis/processor/speciesconfig.go |
Added logging for loading species config and conditional debug logging. |
internal/analysis/processor/workers.go |
Updated getDefaultActions method to handle AudioBuffers map. |
internal/analysis/queue/queue.go |
Added Source field to Results struct. |
internal/analysis/realtime.go |
Initialized ring buffers for audio sources, updated buffer initialization, and adjusted audio capture routine. |
internal/birdnet/analyze.go |
Added concurrency control to Predict method, included source and clipName in observation.New call. |
internal/birdnet/birdnet.go |
Added sync.Mutex to BirdNET struct. |
internal/datastore/model.go |
Commented out InputFile field, added Source field to Note struct. |
internal/myaudio/audiobuffer.go |
Introduced audioBuffers map, mutex for concurrency, and new buffer management functions. |
internal/myaudio/buffers.go |
Enhanced buffer management for multiple audio sources, added PCM data validation. |
internal/myaudio/capture.go |
Updated CaptureAudio function to use new buffer management functions. |
internal/myaudio/process.go |
Updated ProcessData function to include source parameter, added Source field to Results struct. |
internal/myaudio/rstp.go |
Modified captureAudioRTSP to use new buffer management functions. |
internal/observation/observation.go |
Updated New function to include source parameter, set Source field in datastore.Note struct. |
sequenceDiagram
participant Settings
participant Processor
participant BirdNET
participant AudioSource
participant AudioBuffer
participant DataStore
Settings->>Processor: Initialize with settings
Processor->>AudioSource: Capture audio data
AudioSource->>AudioBuffer: Write data to buffer
AudioBuffer->>Processor: Notify data available
Processor->>BirdNET: Send audio segment for analysis
BirdNET->>DataStore: Store analysis results with source info
DataStore-->>Processor: Acknowledge storage
In a forest of code, where buffers reside,
The streams now flow with sources wide.
From single paths to maps we glide,
With mutex locks and logs to guide.
Each note now sings its origin's pride,
In data's dance, we now confide.
Hopping forward, side by side. 🐇🎶
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
…ndividual buffers for different audio sources