fix the audio rtp av issue on flushing - #163
Merged
Merged
Conversation
- Replace av.audio.fifo.AudioFifo with a NumPy-based pending buffer for better control over partial chunks. - Add `flush_partial_on_error` parameter to allow emitting zero-padded final chunks when a stream ends or fails. - Implement proper read/write timeouts (rw_timeout) and JUTURNA_THREAD_JOIN_TIMEOUT in av.open to prevent hanging. - Update timestamp logic to use elapsed time instead of purely block-based indexing. - Improve error logging and handling of ExitError during demuxing. - Add configuration support for `flush_partial` in config.toml.
b3by
reviewed
Apr 20, 2026
Collaborator
|
Looking good! |
This was referenced Apr 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the AudioRtpAv node to enhance its stability and data integrity during streaming.
The primary focus is replacing the internal PyAV FIFO with a manual NumPy-based buffering system.
This change allows the node to handle partial audio chunks more gracefully, specifically by providing the option to flush and pad remaining data with zeros when a stream is interrupted or closed.
Additionally, this update introduces robust timeout management to prevent the node from hanging during network failures and corrects the timestamp calculation logic in the emitted payloads.
PR type
Select all the labels that apply to this PR.
Key modifications and changes
av.audio.fifo.AudioFifowith a NumPy `_pending[ array to store incoming samples.flush_partial_on_errorparameter and_flush_pendingmethod to ensure no data is lost upon exit; partial chunks are now padded with zeros to match the expected block size.rw_timeoutto the default options and integratedJUTURNA_THREAD_JOIN_TIMEOUTinto theav.opencall to ensure the node can recover from unresponsive network resources._emit_chunkmethod to calculate start and end times based on the actual number of samples processed (elapsed time) rather than simple block indices.av.error.ExitErrorand upgraded "source unavailable" logs from INFO to ERROR level for better visibility during failures.config.tomlto include the partial flush toggle by defaultAffected components
Built-in Node:
juturna.nodes.source._audio_rtp_av