summaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2024-06-25 20:25:46 +0300
committerTakashi Iwai <tiwai@suse.de>2024-07-02 10:53:21 +0300
commitf05c1ffc274516ef101d2e0f860bcb9b08c6c622 (patch)
tree6e57abd9c85b75d301ad83377b22aa86ad1d3344 /include/sound
parent5b707581c072bcef086ef4c122a2ea81470a1027 (diff)
downloadlinux-f05c1ffc274516ef101d2e0f860bcb9b08c6c622.tar.xz
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
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/pcm.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 3edd7a7346da..dbce137d8806 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -93,6 +93,7 @@ struct snd_pcm_ops {
#define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2
/* 3 is absent slot. */
#define SNDRV_PCM_IOCTL1_FIFO_SIZE 4
+#define SNDRV_PCM_IOCTL1_SYNC_ID 5
#define SNDRV_PCM_TRIGGER_STOP 0
#define SNDRV_PCM_TRIGGER_START 1
@@ -401,7 +402,7 @@ struct snd_pcm_runtime {
snd_pcm_uframes_t silence_start; /* starting pointer to silence area */
snd_pcm_uframes_t silence_filled; /* already filled part of silence area */
- union snd_pcm_sync_id sync; /* hardware synchronization ID */
+ unsigned char sync[16]; /* hardware synchronization ID */
/* -- mmap -- */
struct snd_pcm_mmap_status *status;