snd_pcm_peri..._stream_lock(9)
π snd_pcm_peri..._stream_lock(9) π
okay bestie, welcome to the Kernel API Manual β¨ β today's main character is snd_pcm_peri..._stream_lock(9), and no, the ellipsis is not me being dramatic, it's literally in the name π. Let's get into it.
πΈ NAME πΈ
snd_pcm_period_elapsed_under_stream_lock β update the status of runtime for the next period under acquired lock of PCM substream. That's the whole errand, and it ate. π
β¨ SYNOPSIS β¨
void snd_pcm_period_elapsed_under_stream_lock (struct snd_pcm_substream
*substream );
That's the signature, copy it exactly, no edits, iykyk π«Ά.
π ARGUMENTS π
substreamβ the instance of pcm substream. Your PCM substream bestie, basically.
π¦ DESCRIPTION π¦
So when a batch of audio data frames β same size as the period of buffer β has already been processed in audio data transmission, this is the function that gets called. Like, the audio frames have had their moment, and now this function gets the call. π§
Once it's called, it updates the status of runtime with the latest position of audio data transmission; it checks overrun and underrun over buffer; it awakens user processes from waiting for available audio data frames; it samples audio timestamp; and it performs stop or drain the PCM substream according to configured threshold. It's giving very busy, very iconic, very "I do five jobs in one moment" energy. π
This function is intended to use for the case that PCM driver operates audio data frames under acquired lock of PCM substream β e.g. in callback of any operation of snd_pcm_ops in process context. In any interrupt context, it's preferrable to use snd_pcm_period_elapsed instead since lock of PCM substream should be acquired in advance. So yeah: process context with the lock already acquired? This one. Interrupt context? Take the snd_pcm_period_elapsed route, bestie. π¦
Developer should pay enough attention that some callbacks in snd_pcm_ops are done by the call of function:
- β (the page has an empty bullet here β no callback name provided)
- β (another empty bullet β still no callback name)
- β (third empty bullet β we are absolutely not inventing them)
Like, the original really did leave those three bullet slots blank. No cap. Don't come for me, I'm just preserving the lore. π
Even if more than one periods have elapsed since the last call, you have to call this only once. Only once, okay? Not me spam-calling it. π
π SEE ALSO π
Kernel file ./sound/core/pcm_lib.c is in the mix, plus these SEE ALSO icons:
snd_pcm_set_ops(9)snd_pcm_set_sync_per_card(9)snd_interval_refine(9)snd_interval_div(9)snd_interval_muldivk(9)snd_interval_mulkdiv(9)snd_interval_ratnum(9)snd_interval_ratden(9)snd_interval_list(9)snd_interval_ranges(9)snd_pcm_hw_rule_add(9)snd_pcm_hw_constraint_mask(9)snd_pcm_hw_constraint_mask64(9)snd_pcm_hw_constraint_integer(9)snd_pcm_hw_constraint_minmax(9)snd_pcm_hw_constraint_list(9)snd_pcm_hw_constraint_ranges(9)snd_pcm_hw_constraint_ratnums(9)snd_pcm_hw_constraint_ratdens(9)snd_pcm_hw_constraint_msbits(9)snd_pcm_hw_constraint_step(9)snd_pcm_hw_constraint_pow2(9)snd_pcm_hw_rule_noresample(9)snd_pcm_hw_param_value(9)snd_pcm_hw_param_first(9)snd_pcm_hw_param_last(9)snd_pcm_hw_params_bits(9)snd_pcm_lib_ioctl(9)snd_pcm_period_elapsed(9)snd_pcm_add_chmap_ctls(9)
That's the page, bestie. Signing off from ./sound/core, dated October 2026, for snd_pcm_peri..._stream_lock(9) β mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms