]> www.infradead.org Git - linux.git/commit
ALSA: pcm: reinvent the stream synchronization ID API
authorJaroslav Kysela <perex@perex.cz>
Tue, 25 Jun 2024 17:25:46 +0000 (19:25 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 2 Jul 2024 07:53:21 +0000 (09:53 +0200)
commitf05c1ffc274516ef101d2e0f860bcb9b08c6c622
tree6e57abd9c85b75d301ad83377b22aa86ad1d3344
parent5b707581c072bcef086ef4c122a2ea81470a1027
ALSA: pcm: reinvent the stream synchronization ID API

Until the commit e11f0f90a626 ("ALSA: pcm: remove SNDRV_PCM_IOCTL1_INFO
internal command"), there was a possibility to pass information
about the synchronized streams to the user space. The mentioned
commit removed blindly the appropriate code with an irrelevant comment.

The revert may be appropriate, but since this API was lost for several
years without any complains, it's time to improve it. The hardware
parameters may change the used stream clock source (e.g. USB hardware)
so move this synchronization ID to hw_params as read-only field.

It seems that pipewire can benefit from this API (disable adaptive
resampling for perfectly synchronized PCM streams) now.

Note that the contents of ID is not supposed to be used for direct
comparison with a specific byte sequence. The "empty" case is when
all bytes are zero (driver does not offer this information)
and all other cases must be only used for equal comparison among
PCM streams (including different sound cards) if they are using
identical hardware clock.

Cc: Takashi Sakamoto <takaswie@kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240625172836.589380-2-perex@perex.cz
include/sound/pcm.h
include/uapi/sound/asound.h
sound/core/pcm_lib.c
sound/core/pcm_native.c
sound/pci/emu10k1/p16v.c