Skip to content
Snippets Groups Projects
  1. Feb 19, 2019
  2. Feb 14, 2019
  3. Jan 29, 2019
  4. Jan 25, 2019
  5. Jan 09, 2019
    • Takashi Iwai's avatar
      pcm: Preserve period_event in snd_pcm_hw_sw_params() call · 9c1439a7
      Takashi Iwai authored
      
      snd_pcm_hw_sw_params() in pcm_hw.c tries to abuse the reserved bits
      for passing period_Event flag.  In this hackish way, we clear the
      reserved bits at beginning, and restore before returning.  However,
      the code paths that return earlier don't restore the value, hence when
      user calls this function twice, it may pass an unexpected value.
      
      This patch fixes the failure, restoring the value always before
      returning from the function.
      
      Reported-by: default avatarJamey Sharp <jamey@minilop.net>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9c1439a7
  6. Jan 07, 2019
  7. Jan 01, 2019
  8. Dec 30, 2018
  9. Dec 19, 2018
    • Takashi Iwai's avatar
      pcm: ioplug: Fix the regression of pulse plugin drain · d7ba06af
      Takashi Iwai authored
      
      The recent change to support the drain via polling caused a regression
      for pulse plugin; with speaker-test -c2 -twav with pulse, it leads to
      either no sounds or stall.
      
      The only sensible behavior change in the commit wrt pulse plugin is
      that now it starts the stream before calling drain callback.  This
      supposed to be correct, but it seems hitting a pulse plugin bug.
      
      The start before drain callback is only a matter of consistency, and
      since this doesn't work for the single existing plugin using drain
      callback, we don't need to stick with this behavior.
      
      For addressing the regression, we check the presence of the drain
      callback and start the stream only when it doesn't exist, i.e. only in
      drain-via-poll mode.
      
      Fixes: ce2095c4 ("pcm: ioplug: Implement proper drain behavior")
      Reported-by: default avatarDiego Viola <diego.viola@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d7ba06af
  10. Dec 10, 2018
    • Timo Wischer's avatar
      pcm: extplug: Keep format and channels the same if requested · ee64b4b8
      Timo Wischer authored
      
      Without this patch it is not possible to link the channel and format
      parameter if snd_pcm_extplug_set_param_*() or
      snd_pcm_extplug_set_slave_param_*() is called. Therefore the client and
      slave parameter can differ. So the extplug has to implement conversion.
      
      To avoid this the new snd_pcm_extplug_set_param_link() function can be
      called.
      As a reproduction sceanrio the following extplug source code can be used:
      
      ===
      static snd_pcm_sframes_t my_transfer(snd_pcm_extplug_t *e,
      	const snd_pcm_channel_area_t *da, snd_pcm_uframes_t dof,
      	const snd_pcm_channel_area_t *sa, snd_pcm_uframes_t sof,
      	snd_pcm_uframes_t s) {
      	return s;
      }
      static const snd_pcm_extplug_callback_t my_own_callback = {
      	.transfer = my_transfer
      };
      SND_PCM_PLUGIN_DEFINE_FUNC(my_plug) {
      	snd_config_iterator_t i, next;
      	snd_config_t *slave = NULL;
      	snd_pcm_extplug_t *myplug;
      	snd_config_for_each(i, next, conf) {
      		snd_config_t *n = snd_config_iterator_entry(i);
      		const char *id;
      		if (snd_config_get_id(n, &id) < 0)
      			continue;
      		if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0)
      			continue;
      		if (strcmp(id, "slave") == 0) {
      			slave = n;
      			continue;
      		}
      		return -EINVAL;
      	}
      	myplug = calloc(1, sizeof(*myplug));
      	myplug->version = SND_PCM_EXTPLUG_VERSION;
      	myplug->callback = &my_own_callback;
      	snd_pcm_extplug_create(myplug, name, root, slave, stream, mode);
      
      	snd_pcm_extplug_set_param_minmax(myplug,
      		SND_PCM_EXTPLUG_HW_CHANNELS, 1, 16);
      //	snd_pcm_extplug_set_param_link(myplug, SND_PCM_EXTPLUG_HW_CHANNELS, 1);
      
      	*pcmp = myplug->pcm;
      	return 0;
      }
      SND_PCM_PLUGIN_SYMBOL(my_plug);
      ===
      
      To use this plugin the following ALSA configuration is required:
      
      pcm.myplug {
          type my_plug
          slave.pcm hw:Dummy
      }
      
      With this configuration without this patch
      snd_pcm_hw_params_get_channels_max() will always return 16 channels
      independent of the supported channels of the dummy device. Due to that for
      example the start up of JACK would fail:
      
      $ modprobe snd_dummy
      $ jackd -d alsa -P myplug
      ALSA: cannot set channel count to 16 for playback
      ALSA: cannot configure playback channel
      
      Signed-off-by: default avatarTimo Wischer <twischer@de.adit-jv.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      ee64b4b8
  11. Nov 29, 2018
    • Takashi Iwai's avatar
      ucm: Set default include path · c9fcf983
      Takashi Iwai authored
      
      Many UCM profiles include the UCM profile components under ucm/*
      subdirectories and thusly put <searchdir:ucm> at each place.  This is
      rather cumbersome.
      
      This patch makes the UCM parser to set the default include path, so
      that each profile no longer needs to set searchdir.  All the
      <searchdir:ucm> lines currently found in the profiles are removed
      gracefully, too.
      
      For the needed implementation, a new helper,
      _snd_config_load_with_include() is introduced.  It's not exported,
      only for the use inside alsa-lib.
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c9fcf983
  12. Nov 28, 2018
  13. Nov 21, 2018
    • Kirill Marinushkin's avatar
      pcm: dshare: Fix segfault when not binding channel 0 · d3dfef24
      Kirill Marinushkin authored
      
      Configuration to reproduce:
      
      ~~~~
      pcm.share_right {
        type dshare
        ipc_key 73
        ipc_perm 0666
        slave {
          pcm "hw:0,0"
        }
        bindings {
          # the seagfault happens when we don't bind channel 0
          1 1
        }
      }
      ~~~~
      
      Execute to reproduce:
      
      ~~~~
      $ aplay -D plug:share_right test.wav
      Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
      Segmentation fault
      ~~~~
      
      For channels whithout binding, values are set to UINT_MAX in function
      `snd_pcm_direct_parse_bindings()`:
      
      ~~~~
      	for (chn = 0; chn < count; chn++)
      		bindings[chn] = UINT_MAX;		/* don't route */
      ~~~~
      
      But, these values are not checked when playing, which causes the segfault.
      
      This commit fixes the issue.
      
      Signed-off-by: default avatarKirill Marinushkin <kmarinushkin@birdec.tech>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d3dfef24
  14. Nov 13, 2018
    • Laxmi Devi's avatar
      pcm: dmix: Add option to allow alignment of slave pointers · 6b058fda
      Laxmi Devi authored
      
      These changes are required due to the kernel
      commit 07b7acb51d283d8469696c906b91f1882696a4d4
      ("ASoC: rsnd: update pointer more accurate")
      
      Issue is that snd_pcm_wait() goes back to waiting because the hw_ptr
      is not period aligned. Therefore snd_pcm_wait() will block for a longer
      time as required.
      
      With these rcar driver changes the exact position of the dma is returned.
      During snd_pcm_start they read hw_ptr as reference, and this hw_ptr
      is now not period aligned, and is a little ahead over the period while it
      is read. Therefore when the avail is calculated during snd_pcm_wait(),
      it is missing the avail_min by a few frames.
      
      An additional option hw_ptr_alignment is provided to dmix configuration,
      to allow the user to configure the slave application and hw pointer
      alignment at startup
      
      [ Slight indentation and parentheses removals by tiwai ]
      
      Signed-off-by: default avatarLaxmi Devi <Laxmi.Devi@in.bosch.com>
      Signed-off-by: default avatarTimo Wischer <twischer@de.adit-jv.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6b058fda
  15. Nov 02, 2018
  16. Oct 24, 2018
  17. Oct 18, 2018
Loading