mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
dmix - Allow more flexible buffer sizes
With the patch, dmix allows apps to use more flexible buffer sizes. The max buffer size is unlimited, and the minimal buffer size is (period size * 2). The buffer size is aligned to period size. The period size is still bound to the period size of slave PCM. To back to the old behavior (the fixed buffer size), you can set defaults.pcm.dmix_variable_buffer false in your configuration.
This commit is contained in:
parent
8ef339762a
commit
7e6c920836
7 changed files with 83 additions and 57 deletions
|
|
@ -760,12 +760,8 @@ static snd_pcm_fast_ops_t snd_pcm_dmix_fast_ops = {
|
|||
* \brief Creates a new dmix PCM
|
||||
* \param pcmp Returns created PCM handle
|
||||
* \param name Name of PCM
|
||||
* \param ipc_key IPC key for semaphore and shared memory
|
||||
* \param ipc_perm IPC permissions for semaphore and shared memory
|
||||
* \param ipc_gid IPC group ID for semaphore and shared memory
|
||||
* \param opts Direct PCM configurations
|
||||
* \param params Parameters for slave
|
||||
* \param bindings Channel bindings
|
||||
* \param slowptr Slow but more precise pointer updates
|
||||
* \param root Configuration root
|
||||
* \param sconf Slave configuration
|
||||
* \param stream PCM Direction (stream)
|
||||
|
|
@ -776,10 +772,8 @@ static snd_pcm_fast_ops_t snd_pcm_dmix_fast_ops = {
|
|||
* changed in future.
|
||||
*/
|
||||
int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
||||
key_t ipc_key, mode_t ipc_perm, int ipc_gid,
|
||||
struct snd_pcm_direct_open_conf *opts,
|
||||
struct slave_params *params,
|
||||
snd_config_t *bindings,
|
||||
int slowptr,
|
||||
snd_config_t *root, snd_config_t *sconf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
|
|
@ -801,13 +795,13 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
goto _err_nosem;
|
||||
}
|
||||
|
||||
ret = snd_pcm_direct_parse_bindings(dmix, bindings);
|
||||
ret = snd_pcm_direct_parse_bindings(dmix, opts->bindings);
|
||||
if (ret < 0)
|
||||
goto _err_nosem;
|
||||
|
||||
dmix->ipc_key = ipc_key;
|
||||
dmix->ipc_perm = ipc_perm;
|
||||
dmix->ipc_gid = ipc_gid;
|
||||
dmix->ipc_key = opts->ipc_key;
|
||||
dmix->ipc_perm = opts->ipc_perm;
|
||||
dmix->ipc_gid = opts->ipc_gid;
|
||||
dmix->semid = -1;
|
||||
dmix->shmid = -1;
|
||||
|
||||
|
|
@ -842,7 +836,8 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
pcm->fast_ops = &snd_pcm_dmix_fast_ops;
|
||||
pcm->private_data = dmix;
|
||||
dmix->state = SND_PCM_STATE_OPEN;
|
||||
dmix->slowptr = slowptr;
|
||||
dmix->slowptr = opts->slowptr;
|
||||
dmix->variable_buffer_size = opts->variable_buffer_size;
|
||||
dmix->sync_ptr = snd_pcm_dmix_sync_ptr;
|
||||
|
||||
if (first_instance) {
|
||||
|
|
@ -1132,8 +1127,7 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
dopen.ipc_key += ipc_offset;
|
||||
|
||||
err = snd_pcm_dmix_open(pcmp, name, dopen.ipc_key, dopen.ipc_perm, dopen.ipc_gid,
|
||||
¶ms, dopen.bindings, dopen.slowptr,
|
||||
err = snd_pcm_dmix_open(pcmp, name, &dopen, ¶ms,
|
||||
root, sconf, stream, mode);
|
||||
if (err < 0)
|
||||
snd_config_delete(sconf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue