Open
Conversation
Owner
Author
|
@aditpape please review |
aditpape
reviewed
Jan 19, 2018
| if (io->state == SND_PCM_STATE_RUNNING) { | ||
| areas = snd_pcm_ioplug_mmap_areas(io); | ||
|
|
||
| while (xfer < nframes) { |
There was a problem hiding this comment.
where is the improvement? Doesn't this still copy nframes w/o checking availability ?
Owner
Author
There was a problem hiding this comment.
I will change the commit message.
With this commit the JACK buffer will only be filled with silence in case this plugin is not in RUNNING state e.g. in PREPARED or XRUN
aditpape
reviewed
Jan 19, 2018
|
|
||
| if (io->state == SND_PCM_STATE_RUNNING) { | ||
| areas = snd_pcm_ioplug_mmap_areas(io); | ||
| const snd_pcm_channel_area_t *areas = snd_pcm_ioplug_mmap_areas(io); |
There was a problem hiding this comment.
this change can go into the previous commit.
aditpape
reviewed
Jan 19, 2018
|
|
||
| /* split the snd_pcm_area_copy() function into two parts | ||
| * if the data to copy passes the buffer wrap around | ||
| */ |
There was a problem hiding this comment.
nice to add comment, but it does not belong to the commit topic...
f6c39bd to
9d8aba4
Compare
Owner
Author
|
Changes:
Diff: @aditpape Please give me a ping when you are finished with the review and I could try to upstream |
9d8aba4 to
db97a17
Compare
db97a17 to
62d8982
Compare
added 5 commits
February 24, 2018 11:42
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 ALSA audio buffer at once without calling snd_pcm_avail_update() in between. For example when the hw_ptr will be updated with hw_ptr += buffer_size and it is using the buffer_size as wrap around hw_ptr %= buffer_size would result in the same value as before the add operation. Due to that the user application would not recognize that the complete audio buffer was copied. Signed-off-by: Timo Wischer <twischer@de.adit-jv.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
when the JACK thread is requesting too many audio frames Playback: Without this commit the ALSA audio buffer will be played with endless repeats as long as the user application has not provided new audio data. Therefore this garbage will be played as long as the user application has not called snd_pcm_stop() after an Xrun. With this fix the rest of the JACK buffer will be filled with silence. Capture: Without this commit the audio data in the ALSA buffer would be overwritten. With this commit the new data from the JACK buffer will not be copied. Therefore the existing data in the ALSA buffer will not be overwritten. Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
…bles This variable will be used to exchange the status of the stream between the ALSA and JACK thread. In future commits it will also be used to signal DRAINING state from the ALSA to JACK thread and to signal XRUN state form the JACK to ALSA thread Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Only increasing the hw_ptr is not sufficient because it will not be evaluated by the ALSA library to detect an Xrun. In addition there is a raise where and Xrun detected by the JACK thread could not be detected in the ALSA thread. - In playback use case - The hw_ptr will be increased by the JACK thread (hw_ptr > appl_ptr => over run) - But the ALSA thread increases the appl_ptr before evaluating the hw_ptr - Therefore the hw_ptr < appl_ptr again - ALSA will not detect the over run which was already detected by the JACK thread Therefore an additional variable is required to report an Xrun from the JACK thread to ALSA. Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Block on drain till available samples played Without this commit the JACK thread will be stopped before the ALSA buffer was completely forwarded to the JACK daemon. Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
62d8982 to
b160cfa
Compare
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.
No description provided.