History

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.

Oswald Buddenhagen committed 3 years ago

Commit 9f656701 parent 0d19bd46 files · +66 −71Browse files

Showing the changes to include/uapi (1 of 6 files). Show all

Unified · Split

include/uapi/sound/asound.h+8−3
@@ -429,9 +429,14 @@ struct snd_pcm_sw_params { · 428 unmodified lines
429 snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */429 snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
430 snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */430 snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */
431 snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */431 snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
432 snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */432 /*
433 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */433 * The following two thresholds alleviate playback buffer underruns; when
434 snd_pcm_uframes_t silence_size; /* silence block size */434 * hw_avail drops below the threshold, the respective action is triggered:
435 */
436 snd_pcm_uframes_t stop_threshold; /* - stop playback */
437 snd_pcm_uframes_t silence_threshold; /* - pre-fill buffer with silence */
438 snd_pcm_uframes_t silence_size; /* max size of silence pre-fill; when >= boundary,
439 * fill played area with silence immediately */
435 snd_pcm_uframes_t boundary; /* pointers wrap point */440 snd_pcm_uframes_t boundary; /* pointers wrap point */
436 unsigned int proto; /* protocol version */441 unsigned int proto; /* protocol version */
437 unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */442 unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t