pcm: dmix: Workaround for binary incompatibility

The commit 1a9bd0f044 ("pcm: direct: Fix for sync issue on xrun
recover") introduced a new field "recoveries" in
snd_pcm_direct_share_t.  Unfortunately this caused two issues:

- It changed the size of the struct which is used as the magic key
- The struct size differs between 32bit and 64bit due to alignment

The former brought the incompatibility with the older alsa-lib,
e.g. when you run an app with an older alsa-lib via LD_PRELOAD, it
doesn't work any longer.

The latter is more serious, it disallows running 32bit apps dmix with
64bit together.

As a workaround, put recoveries field to the unused field
"s.xfer_align", so that the struct is in an old form.  This makes the
dmix again binary-compatible with 1.1.3 and older versions, and also
fix the incompatibility between 32/64 bits.

This is a one-time workaround, and we may need to reconsider more
about a breakage in future...

Fixes: 1a9bd0f044 ("pcm: direct: Fix for sync issue on xrun recover")
Reported-and-tested-by: Cheng Sun <chengsun9@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2017-05-26 14:37:59 +02:00
parent 79f735fbc1
commit eae572ef5e
2 changed files with 5 additions and 6 deletions

View file

@ -66,7 +66,6 @@ typedef struct {
char socket_name[256]; /* name of communication socket */
snd_pcm_type_t type; /* PCM type (currently only hw) */
int use_server;
unsigned int recoveries; /* no of executed recoveries on slave*/
struct {
unsigned int format;
snd_interval_t rate;
@ -95,7 +94,7 @@ typedef struct {
unsigned int stop_threshold;
unsigned int silence_threshold;
unsigned int silence_size;
unsigned int xfer_align; /* not used */
unsigned int recoveries; /* no of executed recoveries on slave*/
unsigned long long boundary;
unsigned int info;
unsigned int msbits;