-
Notifications
You must be signed in to change notification settings - Fork 1
Use atomic access with memory barriers #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
twischer-adit
wants to merge
13
commits into
master
Choose a base branch
from
jack_synchronisation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
when no audio data was copied Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
instead of using buffer_size as wrap around. This is required to detect Xruns. It is also required to allow the JACK thread to processes the whole buffer without a snd_pcm_avail_update() call in between. Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
when the JACK thread is requesting to many frames In playback use case fill the JACK buffer with silence. Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
to avoid issues with architeture which are using a different size for unsigned int Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
because the JACK process callback will be called before io->state == SND_PCM_STATE_RUNNING Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
…locking Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
volatile is not sufficient for guaranteeing the order of buffer access and hardware pointer update. In playback it could happen that the hardware pointer is updated but the audio data is not yet forwarded to the JACK daemon. Therefore the audio data could be overwritten by the ALSA application before it was copied to the JACK daemon. Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
This replaces the additional draining and activated variables. The state has to be accessed with memory barriers to guarantee the order of execution. e.g. to guarantee that snd_pcm_state not changes from DRAINING to RUNNING Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
To guarantee that the execution order. e.g. In playback case do not updating the application pointer before the audio data was copied to the buffer Additionally guarantee that the read of the application pointer is atomic and an invalid value will not be read. Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
because it accesses io->state and a read to this variable can result in an invalid value because there is no synchronisation used. Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
jack_areas contains the pointer to the JACK buffers Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
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.
for variables which will be accessed by the ALSA and JACK thread
Has to be rebased when #1 was upstreamed