Hello community, here is the log from the commit of package alsa checked in at Wed Apr 5 17:09:04 CEST 2006. -------- --- alsa/alsa.changes 2006-03-29 12:17:49.000000000 +0200 +++ alsa/alsa.changes 2006-04-03 17:00:40.000000000 +0200 @@ -1,0 +2,6 @@ +Mon Apr 3 15:58:14 CEST 2006 - tiwai@suse.de + +- fix skipping sounds with dmix on aoss (#162771, #162442) +- fix stutering playback of KDE sounds (#162261) + +------------------------------------------------------------------- New: ---- alsa-lib-dmix-max-periods.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ alsa.spec ++++++ --- /var/tmp/diff_new_pack.Z0CZ2E/_old 2006-04-05 17:08:26.000000000 +0200 +++ /var/tmp/diff_new_pack.Z0CZ2E/_new 2006-04-05 17:08:26.000000000 +0200 @@ -21,7 +21,7 @@ Autoreqprov: on Summary: Advanced Linux Sound Architecture Version: 1.0.11 -Release: 21 +Release: 22 Source1: ftp://ftp.alsa-project.org/pub/lib/alsa-lib-%{package_version}.tar.bz2 Source2: ftp://ftp.alsa-project.org/pub/util/alsa-utils-%{package_version}.tar.bz2 # Source5: ftp://ftp.alsa-project.org/pub/oss/alsa-oss-%{package_version}.tar.bz2 @@ -71,6 +71,7 @@ Patch33: alsa-lib-dmix-2-periods-fix.diff Patch34: alsa-lib-32bit-compat-fix.diff Patch35: alsa-lib-applptr-sync-fix.diff +Patch36: alsa-lib-dmix-max-periods.diff Patch50: alsa-utils-speaker-test-5.1-fix.diff Patch51: alsa-utils-speaker-test-buffer-fix.diff Patch52: alsa-utils-alsaconf-lspci-fix.diff @@ -155,6 +156,7 @@ %patch33 -p1 %patch34 -p1 %patch35 -p1 +%patch36 -p1 cd .. cd alsa-utils*/. # %patch2 -p1 @@ -438,6 +440,9 @@ %doc alsa-lib*/doc/doxygen/html/* %changelog -n alsa +* Mon Apr 03 2006 - tiwai@suse.de +- fix skipping sounds with dmix on aoss (#162771, #162442) +- fix stutering playback of KDE sounds (#162261) * Wed Mar 29 2006 - tiwai@suse.de - fix the bogus -EPIPE detection (and thus may lead to hang up) in 32bit compat mode (ALSA bug#1938). ++++++ alsa-lib-dmix-max-periods.diff ++++++ Index: alsa-lib/src/conf/alsa.conf =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-lib/src/conf/alsa.conf,v retrieving revision 1.26 diff -u -r1.26 alsa.conf --- alsa-lib/src/conf/alsa.conf 21 Mar 2006 10:19:43 -0000 1.26 +++ alsa-lib/src/conf/alsa.conf 3 Apr 2006 14:56:56 -0000 @@ -57,7 +57,7 @@ defaults.pcm.ipc_key 5678293 defaults.pcm.ipc_gid audio defaults.pcm.ipc_perm 0660 -defaults.pcm.dmix_variable_buffer true +defaults.pcm.dmix_max_periods 0 defaults.pcm.front.card defaults.pcm.card defaults.pcm.front.device defaults.pcm.device defaults.pcm.rear.card defaults.pcm.card Index: alsa-lib/src/conf/pcm/dmix.conf =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-lib/src/conf/pcm/dmix.conf,v retrieving revision 1.11 diff -u -r1.11 dmix.conf --- alsa-lib/src/conf/pcm/dmix.conf 21 Mar 2006 10:19:43 -0000 1.11 +++ alsa-lib/src/conf/pcm/dmix.conf 3 Apr 2006 14:56:56 -0000 @@ -92,9 +92,4 @@ default 16 } } - # Allow apps different buffer sizes - variable_buffer_size { - @func refer - name defaults.pcm.dmix_variable_buffer - } } Index: alsa-lib/src/pcm/pcm_direct.c =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-lib/src/pcm/pcm_direct.c,v retrieving revision 1.57 diff -u -r1.57 pcm_direct.c --- alsa-lib/src/pcm/pcm_direct.c 24 Mar 2006 14:51:26 -0000 1.57 +++ alsa-lib/src/pcm/pcm_direct.c 3 Apr 2006 14:56:56 -0000 @@ -697,7 +697,7 @@ &dshare->shmptr->hw.period_time); if (err < 0) return err; - if (! dshare->variable_buffer_size) { + if (dshare->max_periods < 0) { err = hw_param_interval_refine_one(params, SND_PCM_HW_PARAM_BUFFER_SIZE, &dshare->shmptr->hw.buffer_size); if (err < 0) @@ -711,13 +711,13 @@ (1<<SND_PCM_HW_PARAM_BUFFER_SIZE)| (1<<SND_PCM_HW_PARAM_BUFFER_TIME))) { int changed; + unsigned int max_periods = dshare->max_periods; + if (max_periods < 2) + max_periods = dshare->slave_buffer_size / dshare->slave_period_size; do { changed = 0; - /* Set min/max size to [2:1024] since INT_MAX as the - * upper-limit results in a too big buffer on some apps. - */ err = hw_param_interval_refine_minmax(params, SND_PCM_HW_PARAM_PERIODS, - 2, 1024); + 2, max_periods); if (err < 0) return err; changed |= err; @@ -1382,17 +1382,19 @@ return (direction << 1) + (device << 2) + (subdevice << 8) + (card << 12); } -int snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root, +static int snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root, snd_config_t *sconf, int direction) { return _snd_pcm_direct_get_slave_ipc_offset(root, sconf, direction, 0); } -int snd_pcm_direct_parse_open_conf(snd_config_t *conf, struct snd_pcm_direct_open_conf *rec) +int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf, + int stream, struct snd_pcm_direct_open_conf *rec) { snd_config_iterator_t i, next; int ipc_key_add_uid = 0; + snd_config_t *n; int err; rec->slave = NULL; @@ -1401,10 +1403,18 @@ rec->ipc_perm = 0600; rec->ipc_gid = -1; rec->slowptr = 0; - rec->variable_buffer_size = 0; + rec->max_periods = 0; + + /* read defaults */ + if (snd_config_search(root, "defaults.pcm.dmix_max_periods", &n) >= 0) { + long val; + err = snd_config_get_integer(n, &val); + if (err >= 0) + rec->max_periods = val; + } snd_config_for_each(i, next, conf) { - snd_config_t *n = snd_config_iterator_entry(i); + n = snd_config_iterator_entry(i); const char *id; if (snd_config_get_id(n, &id) < 0) continue; @@ -1488,11 +1498,12 @@ rec->slowptr = err; continue; } - if (strcmp(id, "variable_buffer_size") == 0) { - err = snd_config_get_bool(n); + if (strcmp(id, "max_periods") == 0) { + long val; + err = snd_config_get_integer(n, &val); if (err < 0) return err; - rec->variable_buffer_size = err; + rec->max_periods = val; continue; } SNDERR("Unknown field %s", id); @@ -1502,11 +1513,16 @@ SNDERR("slave is not defined"); return -EINVAL; } - if (ipc_key_add_uid) - rec->ipc_key += getuid(); if (!rec->ipc_key) { SNDERR("Unique IPC key is not defined"); return -EINVAL; } + if (ipc_key_add_uid) + rec->ipc_key += getuid(); + err = snd_pcm_direct_get_slave_ipc_offset(root, rec->slave, stream); + if (err < 0) + return err; + rec->ipc_key += err; + return 0; } Index: alsa-lib/src/pcm/pcm_direct.h =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-lib/src/pcm/pcm_direct.h,v retrieving revision 1.22 diff -u -r1.22 pcm_direct.h --- alsa-lib/src/pcm/pcm_direct.h 20 Mar 2006 18:21:15 -0000 1.22 +++ alsa-lib/src/pcm/pcm_direct.h 3 Apr 2006 14:56:56 -0000 @@ -117,7 +117,7 @@ snd_timer_t *timer; /* timer used as poll_fd */ int interleaved; /* we have interleaved buffer */ int slowptr; /* use slow but more precise ptr updates */ - int variable_buffer_size; /* allow the variable buffer size */ + int max_periods; /* max periods (-1 = fixed periods, 0 = max buffer size) */ unsigned int channels; /* client's channels */ unsigned int *bindings; union { @@ -187,7 +187,6 @@ void snd_pcm_direct_clear_timer_queue(snd_pcm_direct_t *dmix); int snd_pcm_direct_set_timer_params(snd_pcm_direct_t *dmix); int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dmix, const char *client_name); -int snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root, snd_config_t *sconf, int direction); int snd_timer_async(snd_timer_t *timer, int sig, pid_t pid); struct timespec snd_pcm_hw_fast_tstamp(snd_pcm_t *pcm); @@ -197,9 +196,9 @@ mode_t ipc_perm; int ipc_gid; int slowptr; - int variable_buffer_size; + int max_periods; snd_config_t *slave; snd_config_t *bindings; }; -int snd_pcm_direct_parse_open_conf(snd_config_t *conf, struct snd_pcm_direct_open_conf *rec); +int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf, int stream, struct snd_pcm_direct_open_conf *rec); Index: alsa-lib/src/pcm/pcm_dmix.c =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-lib/src/pcm/pcm_dmix.c,v retrieving revision 1.72 diff -u -r1.72 pcm_dmix.c --- alsa-lib/src/pcm/pcm_dmix.c 24 Mar 2006 14:51:26 -0000 1.72 +++ alsa-lib/src/pcm/pcm_dmix.c 3 Apr 2006 14:56:56 -0000 @@ -437,6 +437,7 @@ if (err < 0) return err; /* fallthru */ + snd_pcm_dmix_sync_area(pcm); case SNDRV_PCM_STATE_PREPARED: case SNDRV_PCM_STATE_SUSPENDED: case STATE_RUN_PENDING: @@ -487,8 +488,7 @@ static void reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix) { dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr; - if (! dmix->variable_buffer_size || - pcm->buffer_size > pcm->period_size * 2) + if (pcm->buffer_size > pcm->period_size * 2) return; /* If we have too litte periods, better to align the start position * to the period boundary so that the interrupt can be handled properly @@ -851,7 +851,7 @@ pcm->private_data = dmix; dmix->state = SND_PCM_STATE_OPEN; dmix->slowptr = opts->slowptr; - dmix->variable_buffer_size = opts->variable_buffer_size; + dmix->max_periods = opts->max_periods; dmix->sync_ptr = snd_pcm_dmix_sync_ptr; if (first_instance) { @@ -1092,10 +1092,9 @@ struct slave_params params; struct snd_pcm_direct_open_conf dopen; int bsize, psize; - int ipc_offset; int err; - err = snd_pcm_direct_parse_open_conf(conf, &dopen); + err = snd_pcm_direct_parse_open_conf(root, conf, stream, &dopen); if (err < 0) return err; @@ -1134,13 +1133,6 @@ params.period_size = psize; params.buffer_size = bsize; - ipc_offset = snd_pcm_direct_get_slave_ipc_offset(root, sconf, stream); - if (ipc_offset < 0) { - snd_config_delete(sconf); - return ipc_offset; - } - dopen.ipc_key += ipc_offset; - err = snd_pcm_dmix_open(pcmp, name, &dopen, ¶ms, root, sconf, stream, mode); if (err < 0) Index: alsa-lib/src/pcm/pcm_dshare.c =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-lib/src/pcm/pcm_dshare.c,v retrieving revision 1.37 diff -u -r1.37 pcm_dshare.c --- alsa-lib/src/pcm/pcm_dshare.c 20 Mar 2006 18:21:15 -0000 1.37 +++ alsa-lib/src/pcm/pcm_dshare.c 3 Apr 2006 14:56:56 -0000 @@ -662,7 +662,7 @@ pcm->private_data = dshare; dshare->state = SND_PCM_STATE_OPEN; dshare->slowptr = opts->slowptr; - dshare->variable_buffer_size = opts->variable_buffer_size; + dshare->max_periods = opts->max_periods; dshare->sync_ptr = snd_pcm_dshare_sync_ptr; if (first_instance) { @@ -835,10 +835,9 @@ struct slave_params params; struct snd_pcm_direct_open_conf dopen; int bsize, psize; - int ipc_offset; int err; - err = snd_pcm_direct_parse_open_conf(conf, &dopen); + err = snd_pcm_direct_parse_open_conf(root, conf, stream, &dopen); if (err < 0) return err; @@ -869,13 +868,6 @@ params.period_size = psize; params.buffer_size = bsize; - ipc_offset = snd_pcm_direct_get_slave_ipc_offset(root, sconf, stream); - if (ipc_offset < 0) { - snd_config_delete(sconf); - return ipc_offset; - } - dopen.ipc_key += ipc_offset; - err = snd_pcm_dshare_open(pcmp, name, &dopen, ¶ms, root, sconf, stream, mode); if (err < 0) Index: alsa-lib/src/pcm/pcm_dsnoop.c =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-lib/src/pcm/pcm_dsnoop.c,v retrieving revision 1.37 diff -u -r1.37 pcm_dsnoop.c --- alsa-lib/src/pcm/pcm_dsnoop.c 20 Mar 2006 18:21:15 -0000 1.37 +++ alsa-lib/src/pcm/pcm_dsnoop.c 3 Apr 2006 14:56:56 -0000 @@ -544,7 +544,7 @@ pcm->private_data = dsnoop; dsnoop->state = SND_PCM_STATE_OPEN; dsnoop->slowptr = opts->slowptr; - dsnoop->variable_buffer_size = opts->variable_buffer_size; + dsnoop->max_periods = opts->max_periods; dsnoop->sync_ptr = snd_pcm_dsnoop_sync_ptr; if (first_instance) { @@ -707,10 +707,9 @@ struct slave_params params; struct snd_pcm_direct_open_conf dopen; int bsize, psize; - int ipc_offset; int err; - err = snd_pcm_direct_parse_open_conf(conf, &dopen); + err = snd_pcm_direct_parse_open_conf(root, conf, stream, &dopen); if (err < 0) return err; @@ -741,13 +740,6 @@ params.period_size = psize; params.buffer_size = bsize; - ipc_offset = snd_pcm_direct_get_slave_ipc_offset(root, sconf, stream); - if (ipc_offset < 0) { - snd_config_delete(sconf); - return ipc_offset; - } - dopen.ipc_key += ipc_offset; - err = snd_pcm_dsnoop_open(pcmp, name, &dopen, ¶ms, root, sconf, stream, mode); if (err < 0) Index: alsa-lib/src/pcm/pcm_rate.c =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-lib/src/pcm/pcm_rate.c,v retrieving revision 1.88 diff -u -r1.88 pcm_rate.c --- alsa-lib/src/pcm/pcm_rate.c 30 Mar 2006 10:15:03 -0000 1.88 +++ alsa-lib/src/pcm/pcm_rate.c 3 Apr 2006 14:56:56 -0000 @@ -617,7 +617,12 @@ static int snd_pcm_rate_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) { + snd_pcm_rate_t *rate = pcm->private_data; snd_pcm_rate_hwsync(pcm); + /* call slave's delay callback although the value is overwritten. + * it's needed for a better sync of dmix on aoss. + */ + snd_pcm_delay(rate->gen.slave, delayp); if (pcm->stream == SND_PCM_STREAM_PLAYBACK) *delayp = snd_pcm_mmap_playback_hw_avail(pcm); else ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun...