Refactor audio output queue#500
Merged
Merged
Conversation
Collaborator
Author
|
To test the behaviour when the audio queue fills up, I modified the CLI apps' audio output threads to play back a small amount of extra audio samples beyond the ones arriving on the queue. |
Collaborator
Author
|
Prior to this change, the C CLI would drop 128 audio packets (6 seconds) if its queue filled up. Now it drops only a single packet. |
Collaborator
Author
|
Now that the 8-packet startup delay is gone, switching between audio subchannels using the keyboard is almost instantaneous. I'm liking that! |
Contributor
|
I found this to hugely improve playing iq recordings and live decoding while doing other things in the background. The small pauses due to dropped samples were less annoying than having no audio for 6 seconds. |
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.
Fixes #495.
Fixes #497.
Here I have fixed several issues related to audio output in the C and Python CLI applications:
push_audio_bufferfunction used a 100-ms timeout to avoid dropping audio output when reading from a file. This does not work correctly, as explained in Dropped audio samples when playing back recording in C CLI #495. Instead of the timeout, I've changed the code so that it blocks indefinitely while waiting for space in the output queue (if reading from an I/Q file) or aborts immediately and drops the audio packet (if receiving from an SDR).push_audio_bufferfunction briefly unlocked its mutex while performing amemcpy. After re-locking, it was necessary to re-check the value ofst->programin case it had changed. Since thememcpyshould be fast, I've changed the code to leave the mutex locked.