Re: [PATCH 1/2] ALSA: pcm: reinvent the stream synchronization ID API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 07. 05. 24 5:04, Takashi Sakamoto wrote:

+/**
+ * is sync id (clock id) empty?
+ */
+static inline bool pcm_sync_empty(const unsigned char *sync)
+{
+	return strnlen((const char *)sync, 16) == 0;
+}
+

For the sound card indexed by 0, it is problematic, since in the later
change, the first element of array has 0.

Oops. It was a thinko. I replaced this with a full zero comparison in v3 of this patch.

...

@@ -420,7 +414,8 @@ struct snd_pcm_hw_params {
  	unsigned int rate_num;		/* R: rate numerator */
  	unsigned int rate_den;		/* R: rate denominator */
  	snd_pcm_uframes_t fifo_size;	/* R: chip FIFO size in frames */
-	unsigned char reserved[64];	/* reserved for future */
+	unsigned char sync[16];		/* R: synchronization ID (perfect sync - one clock source) */
+	unsigned char reserved[48];	/* reserved for future */
  };
enum {

As long as I checked, the above change are safe for
backward-compatibility and compat ioctl. They keep the same size of
structure and the same offset of member in each of i386/ILP32/LP64 data
models,

Thank you for this verification and review.

+	*(__u32 *)runtime->sync = cpu_to_le32(substream->pcm->card->number);
+	memset(runtime->sync + 4, 0, sizeof(runtime->sync) - 4);
+	strncpy(runtime->sync + 4, "P16V", 4);
The serialization would not keep the same data before the change, since
the third, fourth, and fifth elements are 0x31, 0x36, and 0x56, instead
of 0x10, 0x56, and 0x00.

It does not matter. See the extended comment for snd_pcm_set_sync_per_card in v3. The ID should be used only for a comparison among PCM devices without any interpretation.

				Thank you,
					Jaroslav

--
Jaroslav Kysela <perex@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.





[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux