i-rinat / apulse

PulseAudio emulation for ALSA
MIT License
609 stars 35 forks source link

Cannot answer incoming calls #24

Closed mtbc closed 9 years ago

mtbc commented 9 years ago

Skype works well for me in that I can make the standard test call and hear myself back. However, if somebody calls me, and I click to answer, that window disappears but I still hear the ringing and see,

[apulse] [error] do_connect_pcm, snd_pcm_open, Device or resource busy
[apulse] [error] do_connect_pcm, snd_pcm_open, Device or resource busy

I am using the v0.1.5 tag, invoked with,

$ APULSE_CAPTURE_DEVICE=plughw:1,0,0 APULSE_PLAYBACK_DEVICE=plughw:1,0,0 schroot apulse skype

My Skype is 4.3.0.37 under a 32-bit chroot.

i-rinat commented 9 years ago

plughw:1,0,0

Are you sure your device have that name? Usually there only two numbers separated by comma.

Another reason of busy device is ALSA pulseaudio plugin. It causes a loop with apulse if installed. It's used to send audio from all ALSA clients to PulseAudio server. Usually that's fine, since PulseAudio itself opens hardware device directly. But apulse relies on dmix, so when it plays audio, it gets piped to apulse again.

mtbc commented 9 years ago

It's card, device, subdevice: the last is optional. For input I have,

card 1: G4ME1 [Sennheiser 3D G4ME1], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

and for output,

card 1: G4ME1 [Sennheiser 3D G4ME1], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

and these do work fine for the outgoing test call. Everything is the same if I use plughw:1,0 instead.

Those two Device or resource busy error messages appear exactly when I click the "Answer" button for an incoming call; up to that point, everything works fine.

I suppose I must have the ALSA pulseaudio plugin: I don't on my normal system, but within my 32-bit chroot I see from Skype's Debian package that skype depends upon libasound2-plugins, so it is installed in the chroot as a Skype requirement.

$ dpkg --status skype | grep ^Depends:
Depends: libc6 (>= 2.3.6-6~), libc6 (>= 2.7), libgcc1 (>= 1:4.1.1), libqt4-dbus (>= 4:4.5.3), libqt4-network (>= 4:4.8.0), libqt4-xml (>= 4:4.5.3), libqtcore4 (>= 4:4.7.0~beta1), libqtgui4 (>= 4:4.8.0), libqtwebkit4 (>= 2.1.0~2011week13), libstdc++6 (>= 4.2.1), libx11-6, libxext6, libxss1, libxv1, libssl1.0.0, libpulse0, libasound2-plugins

I don't know if there's an easy way to tell if that plugin is actually being used.

i-rinat commented 9 years ago

Try to move file /usr/share/alsa/alsa.conf.d/pulse.conf somewhere, and try again.

mtbc commented 9 years ago

Alas, still exactly the same problem with an empty /usr/share/alsa/alsa.conf.d both inside and outside the chroot: outgoing calls work fine, but those two error lines appear the moment I click "answer".

mtbc commented 9 years ago

(Also, no mentions of pulse in the regular alsa.conf.)

i-rinat commented 9 years ago

The only difference I can imagine between calling and receiving calls is ring sound played. So when one answers the call, two streams are played simultaneously. Perhaps dmix doesn't work.

Are you sure that when you call

$ APULSE_CAPTURE_DEVICE=plughw:1,0,0 APULSE_PLAYBACK_DEVICE=plughw:1,0,0 schroot bash

environment variable APULSE_PLAYBACK_DEVICE is set properly?

mtbc commented 9 years ago

Aha, thank you for the clue! :+1: My problem was indeed that dmix wasn't properly configured in my .asoundrc. Now it all works fine. :smiley:

rstrlcpy commented 9 years ago

Could you please show your .asoundrc?

mtbc commented 9 years ago

I am having it use only the Sennheiser PC 163D gaming headset that I have plugged in via USB:

pcm.dmixer {
  type dmix
  ipc_key 1024
  slave {
    pcm "iec958:G4ME1"
    period_time 0
    period_size 1024
    buffer_size 8192
    rate 44100
  }

  bindings {
    0 0
    1 1
  }
}

pcm.asymed {
  type asym
  playback.pcm "dmixer"
  capture.pcm "iec958:G4ME1"
}

pcm.dsp0 {
  type plug
  slave.pcm "asymed"
}

pcm.!default {
  type plug
  slave.pcm "asymed"
}

pcm.default {
  type plug
  slave.pcm "asymed"
}

ctl.mixer0 {
  type iec958
  card G4ME1
}