telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
25.89k stars 5.13k forks source link

bug: input device from call settings should also be used for voice message recording #26489

Closed voidpointer0x00 closed 1 year ago

voidpointer0x00 commented 1 year ago

Steps to reproduce

  1. Set the input device to anything but system's default device. <= everything works as expected
  2. Record a voice message. <= fallback to default input stream happens

Expected behaviour

Telegram should respect it's own settings :)

Actual behaviour

The application fallbacks to system's default input source avoiding any streams from the configuration. While changing the settings: image image

When recording a vocie message: image system settings: image

Operating system

EndeavourOS Linux 6.4.1-arch2-1

Version of Telegram Desktop

4.8.4-2

Installation source

Other (unofficial) source

Crash ID

No response

Logs

The only related lines:

[2023.07.08 22:21:37] Audio Info: recreating audio device and reattaching the tracks
[2023.07.08 22:21:39] Audio Info: Closing audio playback device.
[2023.07.08 22:21:49] Audio Info: recreating audio device and reattaching the tracks
[2023.07.08 22:21:51] Audio Info: Closing audio playback device.
voidpointer0x00 commented 1 year ago

A possible solution is to use CurrentAudioInputName() function on alcCaptureOpenDevice(...) call instead of nullptr as the first device argument. https://github.com/telegramdesktop/tdesktop/blob/8bd9293a490332c28b77a3c712f57bb41db780bf/Telegram/SourceFiles/settings/settings_calls.h#L71 https://github.com/telegramdesktop/tdesktop/blob/8bd9293a490332c28b77a3c712f57bb41db780bf/Telegram/SourceFiles/media/audio/media_audio_capture.cpp#L245-L246

#include "settings/settings_calls.h"
// ...
using Settings::CurrentAudioInputName;
d->device = alcCaptureOpenDevice(CurrentAudioInputName().toLatin1().data(), kCaptureFrequency, AL_FORMAT_MONO16, kCaptureFrequency / 5);

It builds, but I cannot test whether it works, because it does not link on my system for the following reason (perhaps, a protobuf 23.4 related issue https://github.com/Cockatrice/Cockatrice/issues/4825):

[ 52%] Linking CXX static library liblib_base_crash_report_writer.a
[ 52%] Built target lib_base_crash_report_writer
/usr/bin/ld: ../cmake/external/cld3/libexternal_cld3_bundled.a(sentence.pb.cc.o): undefined reference to symbol '_ZN4absl12lts_2023012512log_internal21CheckOpMessageBuilder7ForVar2Ev'
/usr/bin/ld: /usr/lib/libabsl_log_internal_check_op.so.2301.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

UPD: fixed by changing find_package(protobuf REQUIRED) to find_package(protobuf REQUIRED CONFIG) in CMakeLists.txt files, but then I'm getting other errors that I don't know how to fix (not a C++ dev) :)

[ 52%] Linking CXX executable ../telegram-desktop
/usr/bin/ld: liblib_tgcalls.a(DesktopInterface.cpp.o): in function `std::enable_if<is_base_of_v<webrtc::webrtc_sequence_checker_internal::SequenceCheckerImpl, webrtc::SequenceChecker>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::type webrtc::webrtc_sequence_checker_internal::ExpectationToString<webrtc::SequenceChecker>(webrtc::SequenceChecker const*)':
DesktopInterface.cpp:(.text._ZN6webrtc32webrtc_sequence_checker_internal19ExpectationToStringINS_15SequenceCheckerEEENSt9enable_ifIX12is_base_of_vINS0_19SequenceCheckerImplET_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE4typeEPKS5_[_ZN6webrtc32webrtc_sequence_checker_internal19ExpectationToStringINS_15SequenceCheckerEEENSt9enable_ifIX12is_base_of_vINS0_19SequenceCheckerImplET_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE4typeEPKS5_]+0x2e): undefined reference to `webrtc::webrtc_sequence_checker_internal::SequenceCheckerImpl::ExpectationToString[abi:cxx11]() const'
collect2: error: ld returned 1 exit status
make[2]: *** [Telegram/CMakeFiles/Telegram.dir/build.make:12027: telegram-desktop] Error 1
ilya-fedin commented 1 year ago

No, it shouldn't as it's clearly specified as call settings.

ilya-fedin commented 1 year ago

DesktopInterface.cpp:(.text._ZN6webrtc32webrtc_sequence_checker_internal19ExpectationToStringINS_15SequenceCheckerEEENSt9enable_ifIX12is_base_of_vINS0_19SequenceCheckerImplET_EENSt7cxx1112basic_stringIcSt11chartraitsIcESaIcEEEE4typeEPKS5[_ZN6webrtc32webrtc_sequence_checker_internal19ExpectationToStringINS_15SequenceCheckerEEENSt9enable_ifIX12is_base_of_vINS0_19SequenceCheckerImplET_EENSt7cxx1112basic_stringIcSt11chartraitsIcESaIcEEEE4typeEPKS5]+0x2e): undefined reference to `webrtc::webrtc_sequence_checker_internal::SequenceCheckerImpl::ExpectationToString[abi:cxx11]() const'

tdesktop's and tg_owt's CMAKE_BUILD_TYPE must match.

voidpointer0x00 commented 1 year ago

No, it shouldn't as it's clearly specified as call settings.

Well, then maybe a "voice message input device" setting should be introduced? 😄

ilya-fedin commented 1 year ago

There's already a feature request for that

voidpointer0x00 commented 1 year ago

There's already a feature request for that

I can't seem to find it, could you please reference the issue or PR?

ilya-fedin commented 1 year ago

Really? изображение