diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index f23e83b236..37ddc898c1 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -24,7 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/platform/base_platform_info.h" #include "calls/calls_panel.h" #include "webrtc/webrtc_video_track.h" -#include "webrtc/webrtc_camera_utilities.h" +#include "webrtc/webrtc_media_devices.h" #include "data/data_user.h" #include "data/data_session.h" #include "facades.h" @@ -350,7 +350,7 @@ void Call::setupOutgoingVideo() { _videoOutgoing->stateValue( ) | rpl::start_with_next([=](Webrtc::VideoState state) { if (state != Webrtc::VideoState::Inactive - && Webrtc::GetCamerasList().empty()) { + && Webrtc::GetVideoInputList().empty()) { _videoOutgoing->setState(Webrtc::VideoState::Inactive); } else if (_state.current() != State::Established && state != started @@ -710,6 +710,8 @@ void Call::createAndStartController(const MTPDphoneCall &call) { auto encryptionKeyValue = std::make_shared>(); memcpy(encryptionKeyValue->data(), _authKey.data(), 256); + const auto &settings = Core::App().settings(); + const auto weak = base::make_weak(this); tgcalls::Descriptor descriptor = { .config = tgcalls::Config{ @@ -726,6 +728,12 @@ void Call::createAndStartController(const MTPDphoneCall &call) { .encryptionKey = tgcalls::EncryptionKey( std::move(encryptionKeyValue), (_type == Type::Outgoing)), + .mediaDevicesConfig = tgcalls::MediaDevicesConfig{ + .audioInputId = settings.callInputDeviceID().toStdString(), + .audioOutputId = settings.callOutputDeviceID().toStdString(), + .inputVolume = settings.callInputVolume() / 100.f, + .outputVolume = settings.callOutputVolume() / 100.f, + }, .videoCapture = _videoCapture, .stateUpdated = [=](tgcalls::State state) { crl::on_main(weak, [=] { @@ -810,14 +818,6 @@ void Call::createAndStartController(const MTPDphoneCall &call) { } raw->setIncomingVideoOutput(_videoIncoming->sink()); - - const auto &settings = Core::App().settings(); - raw->setAudioOutputDevice( - settings.callOutputDeviceID().toStdString()); - raw->setAudioInputDevice( - settings.callInputDeviceID().toStdString()); - raw->setOutputVolume(settings.callOutputVolume() / 100.0f); - raw->setInputVolume(settings.callInputVolume() / 100.0f); raw->setAudioOutputDuckingEnabled(settings.callAudioDuckingEnabled()); } diff --git a/Telegram/SourceFiles/core/core_settings.h b/Telegram/SourceFiles/core/core_settings.h index 95d9b597df..e05f7d1a7d 100644 --- a/Telegram/SourceFiles/core/core_settings.h +++ b/Telegram/SourceFiles/core/core_settings.h @@ -176,13 +176,17 @@ public: _autoLock = value; } [[nodiscard]] QString callOutputDeviceID() const { - return _callOutputDeviceID; + return _callOutputDeviceID.isEmpty() + ? u"default"_q + : _callOutputDeviceID; } void setCallOutputDeviceID(const QString &value) { _callOutputDeviceID = value; } [[nodiscard]] QString callInputDeviceID() const { - return _callInputDeviceID; + return _callInputDeviceID.isEmpty() + ? u"default"_q + : _callInputDeviceID; } void setCallInputDeviceID(const QString &value) { _callInputDeviceID = value; diff --git a/Telegram/SourceFiles/platform/win/specific_win.cpp b/Telegram/SourceFiles/platform/win/specific_win.cpp index 1600396ca9..4facf6c06b 100644 --- a/Telegram/SourceFiles/platform/win/specific_win.cpp +++ b/Telegram/SourceFiles/platform/win/specific_win.cpp @@ -593,6 +593,7 @@ bool OpenSystemSettings(SystemSettingsType type) { if (type == SystemSettingsType::Audio) { crl::on_main([] { WinExec("control.exe mmsys.cpl", SW_SHOW); + //QDesktopServices::openUrl(QUrl("ms-settings:sound")); }); } return true; diff --git a/Telegram/SourceFiles/settings/settings_calls.cpp b/Telegram/SourceFiles/settings/settings_calls.cpp index 01b1bf5fd7..e44f5b1135 100644 --- a/Telegram/SourceFiles/settings/settings_calls.cpp +++ b/Telegram/SourceFiles/settings/settings_calls.cpp @@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/application.h" #include "core/core_settings.h" #include "calls/calls_instance.h" +#include "webrtc/webrtc_media_devices.h" #include "facades.h" #ifdef slots @@ -68,10 +69,10 @@ void Calls::setupContent() { const auto content = Ui::CreateChild(this); const auto getId = [](const auto &device) { - return QString::fromStdString(device.id); + return device.id; }; const auto getName = [](const auto &device) { - return QString::fromStdString(device.displayName); + return device.name; }; const auto &settings = Core::App().settings(); @@ -79,7 +80,7 @@ void Calls::setupContent() { if (settings.callOutputDeviceID() == qsl("default")) { return tr::lng_settings_call_device_default(tr::now); } - const auto &list = VoIP::EnumerateAudioOutputs(); + const auto list = Webrtc::GetAudioOutputList(); const auto i = ranges::find( list, settings.callOutputDeviceID(), @@ -93,7 +94,7 @@ void Calls::setupContent() { if (settings.callInputDeviceID() == qsl("default")) { return tr::lng_settings_call_device_default(tr::now); } - const auto &list = VoIP::EnumerateAudioInputs(); + const auto list = Webrtc::GetAudioInputList(); const auto i = ranges::find( list, settings.callInputDeviceID(), @@ -115,7 +116,7 @@ void Calls::setupContent() { ), st::settingsButton )->addClickHandler([=] { - const auto &devices = VoIP::EnumerateAudioOutputs(); + const auto &devices = Webrtc::GetAudioOutputList(); const auto options = ranges::view::concat( ranges::view::single(tr::lng_settings_call_device_default(tr::now)), devices | ranges::view::transform(getName) @@ -132,11 +133,10 @@ void Calls::setupContent() { const auto deviceId = option ? devices[option - 1].id : "default"; - Core::App().settings().setCallOutputDeviceID( - QString::fromStdString(deviceId)); + Core::App().settings().setCallOutputDeviceID(deviceId); Core::App().saveSettingsDelayed(); if (const auto call = Core::App().calls().currentCall()) { - call->setCurrentAudioDevice(false, deviceId); + call->setCurrentAudioDevice(false, deviceId.toStdString()); } }); Ui::show(Box( @@ -171,7 +171,7 @@ void Calls::setupContent() { }; outputSlider->resize(st::settingsAudioVolumeSlider.seekSize); outputSlider->setPseudoDiscrete( - 201, + 101, [](int val) { return val; }, settings.callOutputVolume(), updateOutputVolume); @@ -191,7 +191,7 @@ void Calls::setupContent() { ), st::settingsButton )->addClickHandler([=] { - const auto &devices = VoIP::EnumerateAudioInputs(); + const auto devices = Webrtc::GetAudioInputList(); const auto options = ranges::view::concat( ranges::view::single(tr::lng_settings_call_device_default(tr::now)), devices | ranges::view::transform(getName) @@ -208,14 +208,13 @@ void Calls::setupContent() { const auto deviceId = option ? devices[option - 1].id : "default"; - Core::App().settings().setCallInputDeviceID( - QString::fromStdString(deviceId)); + Core::App().settings().setCallInputDeviceID(deviceId); Core::App().saveSettingsDelayed(); if (_micTester) { stopTestingMicrophone(); } if (const auto call = Core::App().calls().currentCall()) { - call->setCurrentAudioDevice(true, deviceId); + call->setCurrentAudioDevice(true, deviceId.toStdString()); } }); Ui::show(Box( diff --git a/Telegram/ThirdParty/libtgvoip b/Telegram/ThirdParty/libtgvoip index 6e82b6e456..7563a96b8f 160000 --- a/Telegram/ThirdParty/libtgvoip +++ b/Telegram/ThirdParty/libtgvoip @@ -1 +1 @@ -Subproject commit 6e82b6e45664c1f80b9039256c99bebc76d34672 +Subproject commit 7563a96b8f8e86b7a5fd1ce783388adf29bf4cf9 diff --git a/Telegram/ThirdParty/tgcalls b/Telegram/ThirdParty/tgcalls index 3e4c5e2c23..c6c78d6872 160000 --- a/Telegram/ThirdParty/tgcalls +++ b/Telegram/ThirdParty/tgcalls @@ -1 +1 @@ -Subproject commit 3e4c5e2c23b644fe9b2444e291c32d7efa31db41 +Subproject commit c6c78d68729ce16cff2bee868939780788443963 diff --git a/Telegram/cmake/lib_tgcalls.cmake b/Telegram/cmake/lib_tgcalls.cmake index 1928ef5d6a..7ec007fd53 100644 --- a/Telegram/cmake/lib_tgcalls.cmake +++ b/Telegram/cmake/lib_tgcalls.cmake @@ -170,6 +170,8 @@ remove_target_sources(lib_tgcalls ${tgcalls_loc} platform/android/VideoCameraCapturer.h platform/android/VideoCapturerInterfaceImpl.cpp platform/android/VideoCapturerInterfaceImpl.h + reference/InstanceImplReference.cpp + reference/InstanceImplReference.h ) target_include_directories(lib_tgcalls diff --git a/Telegram/lib_webrtc b/Telegram/lib_webrtc index 4d0f0b8ef4..32957e8559 160000 --- a/Telegram/lib_webrtc +++ b/Telegram/lib_webrtc @@ -1 +1 @@ -Subproject commit 4d0f0b8ef41b7a7f8014cebb1dbc5549b06fde6f +Subproject commit 32957e855993b20c95fa714518ba4bc55ebcdd32