diff options
author | Oswald Buddenhagen <oswald.buddenhagen@gmx.de> | 2023-04-20 13:33:23 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2023-04-21 12:21:04 +0200 |
commit | 9f656705c5faa18afb26d922cfc64f9fd103c38d (patch) | |
tree | e3ded34bd862102da4bab1f1329e9a3f31e186a3 /include/uapi/sound/asound.h | |
parent | ALSA: Use of_property_read_bool() for boolean properties (diff) | |
download | linux-9f656705c5faa18afb26d922cfc64f9fd103c38d.tar.xz linux-9f656705c5faa18afb26d922cfc64f9fd103c38d.zip |
ALSA: pcm: rewrite snd_pcm_playback_silence()
The auto-silencer supports two modes: "thresholded" to fill up "just
enough", and "top-up" to fill up "as much as possible". The two modes
used rather distinct code paths, which this patch unifies. The only
remaining distinction is how much we actually want to fill.
This fixes a bug in thresholded mode, where we failed to use new_hw_ptr,
resulting in under-fill.
Top-up mode is now more well-behaved and much easier to understand in
corner cases.
This also updates comments in the proximity of silencing-related data
structures.
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230420113324.877164-1-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/uapi/sound/asound.h')
-rw-r--r-- | include/uapi/sound/asound.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 7eecc99ddef7..0aa955aa8246 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -429,9 +429,14 @@ struct snd_pcm_sw_params { snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ - snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ - snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ - snd_pcm_uframes_t silence_size; /* silence block size */ + /* + * The following two thresholds alleviate playback buffer underruns; when + * hw_avail drops below the threshold, the respective action is triggered: + */ + snd_pcm_uframes_t stop_threshold; /* - stop playback */ + snd_pcm_uframes_t silence_threshold; /* - pre-fill buffer with silence */ + snd_pcm_uframes_t silence_size; /* max size of silence pre-fill; when >= boundary, + * fill played area with silence immediately */ snd_pcm_uframes_t boundary; /* pointers wrap point */ unsigned int proto; /* protocol version */ unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */ |