i-rinat / apulse

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

Failure setting up channels #40

Open ismaell opened 8 years ago

ismaell commented 8 years ago

The call tosnd_pcm_hw_params_set_channels in do_connect_pcm may fail, it should probably be replaced by one of it's alternatives, or at least just not abort if it fails.

sovietspaceship2 commented 7 years ago

It does for me

[apulse] [error] do_connect_pcm, snd_pcm_hw_params_set_channels, Invalid argument

with Telegram Desktop

i-rinat commented 7 years ago

All calls could fail.

In case of snd_pcm_hw_params_set_channels() failing, I don't know what to do. In that case application requested a particular number of channels (1 or 2 usually), but audiodriver said it can't provide that. Should apulse convert/split/mix data in that case?

Also, is this dmix-enabled device? I think, ALSA's plugins should handle format convertions by default.

ismaell commented 7 years ago

@sovietspaceship Install alsacap and check with alsacap -d default that the device is configured properly.

You'll probably need to use plug:dmix (playback) and plug:dsnoop (recording) unless you have a high-end card.

You should get something like this:

$ alsacap -d default
*** Exploring configuration space of device `default' for playback ***
1..10000 channels
Sampling rate 4000..4294967295 Hz
Sample formats: S8, U8, S16_LE, S16_BE, U16_LE, U16_BE, S24_LE, S24_BE, U24_LE, U24_BE, S32_LE, S32_BE, U32_LE, U32_BE, FLOAT_LE, FLOAT_BE, FLOAT64_LE, FLOAT64_BE, MU_LAW, A_LAW, IMA_ADPCM, S24_3LE, S24_3BE, U24_3LE, U24_3BE, S20_3LE, S20_3BE, U20_3LE, U20_3BE, S18_3LE, S18_3BE, U18_3LE, U18_3BE

$ alsacap -R -d default
*** Exploring configuration space of device `default' for recording ***
1..10000 channels
Sampling rate 4000..4294967295 Hz
Sample formats: S8, U8, S16_LE, S16_BE, U16_LE, U16_BE, S24_LE, S24_BE, U24_LE, U24_BE, S32_LE, S32_BE, U32_LE, U32_BE, FLOAT_LE, FLOAT_BE, FLOAT64_LE, FLOAT64_BE, MU_LAW, A_LAW, IMA_ADPCM, S24_3LE, S24_3BE, U24_3LE, U24_3BE, S20_3LE, S20_3BE, U20_3LE, U20_3BE, S18_3LE, S18_3BE, U18_3LE, U18_3BE
ismaell commented 7 years ago

I still think it should handle the configuration more dynamically...

sovietspaceship2 commented 7 years ago

I'm already using dmix and dsnoop; alsacap -d default outputs

Exploring configuration space of device `default' for playback 1..10000 channels Sampling rate 4000..4294967295 Hz Sample formats: S8, U8, S16_LE, S16_BE, U16_LE, U16_BE, S24_LE, S24_BE, U24_LE, U24_BE, S32_LE, S32_BE, U32_LE, U32_BE, FLOAT_LE, FLOAT_BE, FLOAT64_LE, FLOAT64_BE, MU_LAW, A_LAW, IMA_ADPCM, S24_3LE, S24_3BE, U24_3LE, U24_3BE, S20_3LE, S20_3BE, U20_3LE, U20_3BE, S18_3LE, S18_3BE, U18_3LE, U18_3BE Buffer size range from 170 to 733007751 Period size range from 85 to 91628833 Significant bits: 0

Latest version of Telegram segfaults running under apulse. I opened an issue on their repo because it's probably their fault.

ismaell commented 7 years ago

Can you take a backtrace with GDB?

i-rinat commented 7 years ago

Latest version of Telegram segfaults running under apulse.

This is very similar to #43, which was kind of fixed. Also, latest Telegram app seems to be working through apulse just fine. It uses some not implemented functions, but plays audio anyway.