pcm: dmix: Workaround for binary incompatibility
PATCH 1/1 pcm: dmix: Workaround for binary incompatibility
The commit 1a9bd0f04481 ("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 is a one-time workaround, and we may need to reconsider more about a breakage in future...
--- src/pcm/pcm_direct.c | 8 ++++---- src/pcm/pcm_direct.h | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-)
src/pcm/pcm_direct.c +4 -4
@@ -615,7 +615,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct) }return ret; } - direct->shmptr->recoveries++; + direct->shmptr->s.recoveries++; semerr =snd_pcm_direct_semaphore_up (direct,DIRECT_IPC_SEM_CLIENT );if (semerr <0 ) {
@@ -631,11 +631,11 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)*/ int snd_pcm_direct_client_chk_xrun (snd_pcm_direct_t *direct,snd_pcm_t *pcm) { -if (direct->shmptr->recoveries != direct->recoveries) { +if (direct->shmptr->s.recoveries != direct->recoveries) {/* no matter how many xruns we missed - * so don't increment but just update to actual counter */ - direct->recoveries = direct->shmptr->recoveries; + direct->recoveries = direct->shmptr->s.recoveries; pcm->fast_ops->drop (pcm);/* trigger_tstamp update is missing in drop callbacks */ gettimestamp (&direct->trigger_tstamp, pcm->tstamp_type);
@@ -1539,7 +1539,7 @@ int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dm dmix->slave_buffer_size = spcm->buffer_size; dmix->slave_period_size = dmix->shmptr->s.period_size; dmix->slave_boundary = spcm->boundary; - dmix->recoveries = dmix->shmptr->recoveries; + dmix->recoveries = dmix->shmptr->s.recoveries; ret =snd_pcm_mmap (spcm);if (ret <0 ) {
src/pcm/pcm_direct.h +1 -2
@@ -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;
Signature · 1 line
2.13.0