grishka / libtgvoip

VoIP library for Telegram clients
The Unlicense
387 stars 156 forks source link

Incorrect pulseaudio availability check/device enumeration #27

Closed ilyaluk-old closed 7 years ago

ilyaluk-old commented 7 years ago

Problem: Telegram Desktop hangs after key exchange in accepted call.

I have libpulse installed on my system, but I'm not using pulseaudio, hence pulseaudio daemon is not running.

So, AudioOutputPulse::IsAvailable() returns true. Then, here AudioOutputPulse::EnumerateDevices is being called, which calls pa_mainloop_iterate(ml, 1, NULL).

Looks like this call blocks thread if pulseaudio daemon is not running.

grishka commented 7 years ago

TDesktop doesn't support any kind of audio device selection to begin with so this method is never called as of the current version

ilyaluk-old commented 7 years ago

Yep, it doesn't support device selection, but this method called on VoIPController creation. Telegram Desktop release 1.1.7

#3  0x0000000000e66312 in tgvoip::audio::AudioOutputPulse::EnumerateDevices(std::vector<tgvoip::AudioOutputDevice, std::allocator<tgvoip::AudioOutputDevice> >&) ()
#4  0x0000000000e62330 in tgvoip::audio::AudioOutput::EnumerateDevices(std::vector<tgvoip::AudioOutputDevice, std::allocator<tgvoip::AudioOutputDevice> >&) ()
#5  0x0000000000e5a717 in tgvoip::VoIPController::EnumerateAudioOutputs() ()
#6  0x0000000000e503e7 in tgvoip::VoIPController::VoIPController() ()
#7  0x00000000008c2755 in Calls::Call::createAndStartController(MTPDphoneCall const&) ()
grishka commented 7 years ago

Thank you for pointing out, I added it for debugging purposes and forgot to remove.

grishka commented 7 years ago

Should be fine now