Skip to contentSkip to conversation

Rate or plug plugin issue with snd-pcsp

DISCUSSION Alexander E. Patrakov 2 participants 2 messages Jun 3, 2014 – Jun 5, 2014

lore
Share & tools
lore
#0 lore raw

Hello.

While testing application support for weird-rate cards (such as snd-pcsp), I found a bug in alsa-lib. Alsa-plugins are installed, so the "libspeex (builtin)" rate converter is used. This bug already exists in alsa-plugins 1.0.27.2, so not a regression and thus should not block 1.0.28.

$ file test.wav
test.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 32000 Hz
$ aplay -vvv -D plughw:pcsp test.wav
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 32000 Hz, Stereo
aplay: set_params:1297: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: NONE
PERIOD_TIME: (125006 125007)
PERIOD_SIZE: NONE
PERIOD_BYTES: (16000 16004)
PERIODS: (3 4)
BUFFER_TIME: 500000
BUFFER_SIZE: 16000
BUFFER_BYTES: 64000
TICK_TIME: 0

The pcsp device supports the sample rate of 37286 Hz.

Files with 44100 Hz sample rate work fine.

$ aplay -vv -D plughw:pcsp -f cd /dev/zero
Playing raw data '/dev/zero' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Plug PCM: Route conversion PCM (sformat=S16_LE)
  Transformation table:
    0 <- 0*0,5 + 1*0,5
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 44100
  exact rate   : 44100 (44100/1)
  msbits       : 16
  buffer_size  : 22050
  period_size  : 5512
  period_time  : 125006
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 5512
  period_event : 0
  start_threshold  : 22050
  stop_threshold   : 22050
  silence_threshold: 0
  silence_size : 0
  boundary     : 6206523236469964800
Slave: Rate conversion PCM (37286, sformat=S16_LE)
Converter: libspeex (builtin)
Protocol version: 10002
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 44100
  exact rate   : 44100 (44100/1)
  msbits       : 16
  buffer_size  : 22050
  period_size  : 5512
  period_time  : 125006
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 5512
  period_event : 0
  start_threshold  : 22050
  stop_threshold   : 22050
  silence_threshold: 0
  silence_size : 0
  boundary     : 6206523236469964800
Slave: Hardware PCM card 2 'pcsp' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 37286
  exact rate   : 37286 (37286/1)
  msbits       : 16
  buffer_size  : 18644
  period_size  : 4661
  period_time  : 125006
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 4661
  period_event : 0
  start_threshold  : 18644
  stop_threshold   : 18644
  silence_threshold: 0
  silence_size : 0
  boundary     : 5247819465793470464
  appl_ptr     : 0
  hw_ptr       : 0
#+                                                 | 00%^C
Signature · 1 line
Alexander E. Patrakov
#1 lore raw
Quoted 2 lines

While testing application support for weird-rate cards (such as

snd-pcsp), I found a bug in alsa-lib. Alsa-plugins are installed, so the "libspeex (builtin)" rate converter is used. This bug already exists in alsa-plugins 1.0.27.2, so not a regression and thus should not block 1.0.28.

Quoted 3 lines
$ file test.wav
test.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit,

stereo 32000 Hz

Quoted 3 lines
$ aplay -vvv -D plughw:pcsp test.wav
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 32000 Hz,

Stereo

Quoted 17 lines
aplay: set_params:1297: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: NONE
PERIOD_TIME: (125006 125007)
PERIOD_SIZE: NONE
PERIOD_BYTES: (16000 16004)
PERIODS: (3 4)
BUFFER_TIME: 500000
BUFFER_SIZE: 16000
BUFFER_BYTES: 64000
TICK_TIME: 0
Quoted 1 line

The pcsp device supports the sample rate of 37286 Hz.

PERIOD_SIZE: NONE

Seem driver bug which use sndrv_pcm_rate_knot when only support single rate and

The constraint refinement need driver usIng equal size periods

snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS)