0

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
Soonts
  • 20,079
  • 9
  • 57
  • 130
  • When are you calling `snd_pcm_start()`? Show your code! – CL. Jun 10 '20 at 16:13
  • @CL Never called. As I wrote, when I called, I was getting EPIPE. Couldn’t provide data either because `snd_pcm_avail_update` said there's no space for it. I’ve already managed to resolve that somehow by doing random changes, but if someone will write the correct calling sequence for starting a playback with memory mapped IO + poll-based updates, pretty sure it will be useful for other people. There’re no samples nor documentation for that use case, despite it’s the only use case worth doing in practice for 99% of apps who play compressed audio. – Soonts Jun 10 '20 at 16:58

0 Answers0