Tdesktop: Client doesn't switch output devices

Created on 1 Jun 2015  Â·  44Comments  Â·  Source: telegramdesktop/tdesktop

It's not really a bug I guess.
The thing is the sound will always play through the default sound device set when the windows app was started. If you switch the default sound device afterwards it will still play through the default sound device set when the app was started.
This is annoying because I often switch between speakers and headset.

bug

Most helpful comment

Linux+pulseaudio. Telegram shows at the pavucontrol app list, but I am unable to switch its output.
I was willing to listen audio messages on USB headset, but I can't change from normal speakers.
Thanks!

All 44 comments

I can confirm this issue. Reopening the application fixes this but if it would switch to the default device that would be better!

This actually really is a bug, and it's pretty annoying. My sound card has two output devices that switch automatically when I plug in my headphones. So every time I plug or unplug them, telegram sound goes through the wrong device and I have to relaunch it.
The sound should always go through the default device.
P.S. I'm using Windows 10 and TDesktop v0.9.15

+1

Problem is for me that I have to enable my bluetooth headset when Windows is already started, meaning that Telegram is also already started. It would be great to just have an option for a default output device at the settings.

@Atomkraftzwerg or just use the default output device (surprise) by default.

Okay, also an issue here, and damn annoying.

Would be happy if Telegram could detect this change.

Can confirm this issue. Seems like Windows changed something in the audiodriver in 8 or 10. Everything works fine on W7 but not on 10.

@Skaronator I thought it doesn't work anywhere..

@john-preston My guess is that @Skaronator has different driver settings in Windows 7 resulting in only one audio output device instead of two.

I'm now on Windows 10 and I use SoundSwitch to switch between my speakers ("Lautsprecher") and headset ("Kopfhörer"). And when I switch between the devices does it still play on the device that was the default device on boot.

image

Its pretty annoying and I can just quote @TempleClause

If you switch the default sound device afterwards it will still play through the default sound device set when the app was started.
This is annoying because I often switch between speakers and headset.

That's another matter. You shouldn't need soundswitch in the first place for the records.
And without that, switching is broken in W7 too.

I can confirm that this issue is still not fixed. I'm also using SoundSwitch and can confirm @Skaronator report but I'm in Windows 7 and not on W10.

Is it that hard to fix this?

Problem persistent on Windows and Linux, maybe it's in something in tdesktop cross-platform code.

@Erusy apparently...

@z3ntu This is how OpenAL works, it doesn't offer a way to follow the default audio output device changing :(

Found kind of glitch/cheat:
First I configure /etc/openal/alsoft.conf :
#allow-moves = false
to
allow-moves = true
Then restarted tdesktop and launched pavucontrol.
In tdesktop started recording and while holding LMB moved cursor to pavucontrol window.
While holding LMB pressed RMB — this allowed operate in pavucontrol window and continue recording in tdesktop. Default device was not recognized, but I can pick one another and this worked.
But for some reason only once, second time sound was recorded (red dot is moving/flashing), but no message formed.
Option allowing not to hold LMB while recording will be reasonable workaround for this problem, maybe…

@Erusy Does changing the output device also work with that method?

On my system tdesktop output stream is always working, and output device changing also works and this setting survives restart, so I just don't need to use LMB-RMB-cheat.
But I've just tested it and it works too.
By the way this is not very usable, and works rarely.

Linux+pulseaudio. Telegram shows at the pavucontrol app list, but I am unable to switch its output.
I was willing to listen audio messages on USB headset, but I can't change from normal speakers.
Thanks!

Also seeing this on Linux + Phonon GStreamer.

This is a huge problem with the hdmi audio
When I leave the sleep mode on my laptop sometime my avr is not initialised so windows use the onboard sound card and after return on the hdmi , so everytime i need to relaunch telegram for be able to listen a video or a listen an audio message because telegram is stuck on a non-existent output

I start to be tired of this problem , please fix it
I have no problem with other software

The same problem (Ubuntu 16.10 Bluetooth A2DP phones).

Looks like it's fixed in 1.0.3 alpha!
At least on Windows (according to changelog, it should work now on Vista and later)

Not fixed on Linux at all

For me in 1.0.37, Linux (Arch Linux and Pulseaudio) it's fixed as-in there isn't a constant sound stream active in the "Playback" tab in pavucontrol (equivalent is "Applications" in the Plasma Audio Volume Settings) anymore since it was fixed. So it's working on my machine as wanted.

This issue is still there with Telegram for OSX Sierra (all up to date).

Any news on this?
It's really annoying to have to relaunch Telegram every time I connect my headphones or I want to record a voice message with Stereo Mix.

@afliw The audio device is recreated each time nothing is playing so it should use default device starting from at least a sound output pause.

I have Telegram 1.1.23 alpha installed on Ubuntu 17.10 and can't switch output channel.

> pacmd move-sink-input $put-telegram-channel-id $another-audio-sink-id                                                                                                                                                         
Moved failed.

See #2231

It still does not work on Linux. pactl move-sink-input $SINK_NUMBER 2 outputs Failure: Invalid argument if SINK_NUMBER corresponds to "telegram-desktop". If SINK_NUMBER corresponds to Audacious, the command works. ArchLinux.

is kinda sad that after almost 4 years now this is not fixed ....are you serious ?

@john-preston can we do something with this issue?

at least ability to change preferable input/output device from settings?

@senid231 What OS are you on? TDesktop for Windows already has output options in Settings, can't say for Linux/macOS though

On linux if any there's this issue IIRC: https://github.com/telegramdesktop/tdesktop/issues/3459#issuecomment-397711149

I solved this bug by next: the first i disabled (off) all the device except necessary for me
image next i can to change device for telegram

@MasterGroosha I'm using Linux debian stretch

@mirh it works, but stream is recreated on every play/pause so after resume video/audio you must switch output again

@NMelis I done same thing to make it work

I think a solution would be to add input/output to settings or to create input when app starts and do not destroy it until it ends.

I work around this issue by first connecting my bluetooth headphones, restarting the pulseaudio daemon with a pause in between, and then reconnecting my bluetooth headphones all over again.

I use this for the restart:

pulseaudio -k && sleep 3 && pulseaudio --start

After a restart of Telegram, It then works as well and as sane as all other programs.

(Somehow the initial BT connection is necessary before pulseaudio restart)

Maybe the DONT_MOVE flag here is related to this? (this flag comes from Telegram when requesting the audio device)

$ pacmd list-sink-inputs
2 sink input(s) available.
    index: 25
        (...)
    index: 33
        driver: <protocol-native.c>
        flags: DONT_MOVE START_CORKED
        state: RUNNING
        sink: 0 <alsa_output.usb-Plantronics_Wireless_Audio_Plantronics_Wireless_Audio-00.analog-stereo>
        volume: front-left: 68812 / 105% / 1,27 dB,   front-right: 68812 / 105% / 1,27 dB
                balance 0,00
        muted: no
        current latency: 55,48 ms
        requested latency: 16,00 ms
        sample spec: float32le 2ch 48000Hz
        channel map: front-left,front-right
                     Estéreo
        resample method: speex-float-1
        module: 14
        client: 28 <Telegram>
        properties:
                media.role = hex:
                phonon.streamid = hex:
                media.name = "Playback Stream"
                application.name = "Telegram"
                native-protocol.peer = "UNIX socket client"
                native-protocol.version = "32"
                application.process.id = "2423"
                application.process.user = "facundo"
                application.process.host = "blackfx"
                application.process.binary = "Telegram"
                application.language = "es_AR.UTF-8"
                window.x11.display = ":0"
                application.process.machine_id = "5121f437f343485b960c244df78aa216"
                application.process.session_id = "1"
                module-stream-restore.id = "sink-input-by-application-name:Telegram"

Inspired by this nice reporting, I followed the sources breadcrumb trail first uselessly in platform/linux/ and then eventually in https://github.com/telegramdesktop/tdesktop/blob/bec39d89e19670eb436dc794a8f20b657cb87c71/Telegram/SourceFiles/media/audio/media_audio.cpp#L133-L136

After checking for pulse audio in OAL, here you are.
Which as I already linked is the workaround you get in #3459

EDIT: openal maintainer said that "I'll be able to change that when I can get confirmation that KDE's not broken anymore"

https://github.com/kcat/openal-soft/commit/c135629eae544b0e7785803b98987c1ab1eb95ca
This should have been fixed whenever you build against openal 1.20.

This should have been fixed whenever you build against openal 1.20.

That was already done 3 months ago
https://github.com/telegramdesktop/tdesktop/issues/2231#event-3113582743

Was this page helpful?
0 / 5 - 0 ratings