How to start playback in Alsa with memory mapped IO?

278 Views Asked by At

When I call snd_pcm_start getting EPIPE error. Expected because there’s no data, I’m supposed to fill initial samples first.

When I call snd_pcm_status_dump, I’m getting following file written:

state       : PREPARED
trigger_time: 0.000000
tstamp      : 0.000000
delay       : 0
avail       : 12288
avail_max   : 0

A moment later after receiving first frames (from a source outside Alsa) I call snd_pcm_avail_update, snd_pcm_avail_update returns 0 telling me there’s no free space to decode into.

How do I start audio playback? For completeness, here’s the output of snd_pcm_dump debug function:

Plug PCM: Hardware PCM card 0 'bcm2835 ALSA' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 12288
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 0
  stop_threshold   : 12288
  silence_threshold: 0
  silence_size : 0
  boundary     : 1610612736
  appl_ptr     : 0
  hw_ptr       : 0
0

There are 0 best solutions below