mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
update audio device when changed automatically in sdk
This commit is contained in:
parent
58eb93d13b
commit
ac03de6663
5 changed files with 50 additions and 1 deletions
|
|
@ -491,6 +491,7 @@ void CallModel::onVideoDisplayErrorOccurred(const std::shared_ptr<linphone::Call
|
|||
|
||||
void CallModel::onAudioDeviceChanged(const std::shared_ptr<linphone::Call> &call,
|
||||
const std::shared_ptr<linphone::AudioDevice> &audioDevice) {
|
||||
lInfo() << log().arg("audio device changed");
|
||||
emit audioDeviceChanged(call, audioDevice);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -626,3 +626,12 @@ void CoreModel::onFriendListRemoved(const std::shared_ptr<linphone::Core> &core,
|
|||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void CoreModel::onAudioDevicesListUpdated(const std::shared_ptr<linphone::Core> &core) {
|
||||
emit audioDevicesListUpdated(core);
|
||||
}
|
||||
|
||||
void CoreModel::onAudioDeviceChanged(const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::AudioDevice> &device) {
|
||||
emit audioDeviceChanged(core, device);
|
||||
}
|
||||
|
|
@ -206,6 +206,9 @@ private:
|
|||
const std::string &url) override;
|
||||
virtual void onFriendListRemoved(const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::FriendList> &friendList) override;
|
||||
virtual void onAudioDevicesListUpdated(const std::shared_ptr<linphone::Core> &core) override;
|
||||
virtual void onAudioDeviceChanged(const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::AudioDevice> &device) override;
|
||||
|
||||
signals:
|
||||
void accountAdded(const std::shared_ptr<linphone::Core> &core, const std::shared_ptr<linphone::Account> &account);
|
||||
|
|
@ -289,6 +292,9 @@ signals:
|
|||
bool checkRequestedByUser);
|
||||
void friendListRemoved(const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::FriendList> &friendList);
|
||||
void audioDevicesListUpdated(const std::shared_ptr<linphone::Core> &core);
|
||||
void audioDeviceChanged(const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::AudioDevice> &device);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -81,6 +81,20 @@ SettingsModel::SettingsModel() {
|
|||
QObject::connect(CoreModel::getInstance().get(), &CoreModel::lastCallEnded, this, [this]() {
|
||||
if (mCaptureGraphListenerCount > 0) createCaptureGraph(); // Repair the capture graph
|
||||
});
|
||||
QObject::connect(CoreModel::getInstance().get(), &CoreModel::audioDevicesListUpdated, this,
|
||||
[this](const std::shared_ptr<linphone::Core> &core) {
|
||||
lInfo() << log().arg("audio device list updated");
|
||||
updateCallSettings();
|
||||
});
|
||||
QObject::connect(
|
||||
CoreModel::getInstance().get(), &CoreModel::audioDeviceChanged, this,
|
||||
[this](const std::shared_ptr<linphone::Core> &core, const std::shared_ptr<linphone::AudioDevice> &device) {
|
||||
lInfo() << log().arg("audio device changed");
|
||||
if (device) lInfo() << "device :" << device->getDeviceName();
|
||||
emit playbackDeviceChanged(getPlaybackDevice());
|
||||
emit captureDeviceChanged(getCaptureDevice());
|
||||
emit ringerDeviceChanged(getRingerDevice());
|
||||
});
|
||||
}
|
||||
|
||||
SettingsModel::~SettingsModel() {
|
||||
|
|
@ -173,9 +187,10 @@ void SettingsModel::stopCaptureGraph() {
|
|||
|
||||
// Force a call on the 'detect' method of all audio filters, updating new or removed devices
|
||||
void SettingsModel::accessCallSettings() {
|
||||
// Audio
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
startCaptureGraph();
|
||||
|
||||
// Audio
|
||||
CoreModel::getInstance()->getCore()->reloadSoundDevices();
|
||||
emit captureDevicesChanged(getCaptureDevices());
|
||||
emit playbackDevicesChanged(getPlaybackDevices());
|
||||
|
|
@ -191,6 +206,23 @@ void SettingsModel::accessCallSettings() {
|
|||
emit videoDevicesChanged(getVideoDevices());
|
||||
}
|
||||
|
||||
void SettingsModel::updateCallSettings() {
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
|
||||
// Audio
|
||||
emit captureDevicesChanged(getCaptureDevices());
|
||||
emit playbackDevicesChanged(getPlaybackDevices());
|
||||
emit playbackDeviceChanged(getPlaybackDevice());
|
||||
emit ringerDevicesChanged(getRingerDevices());
|
||||
emit ringerDeviceChanged(getRingerDevice());
|
||||
emit captureDeviceChanged(getCaptureDevice());
|
||||
emit playbackGainChanged(getPlaybackGain());
|
||||
emit captureGainChanged(getCaptureGain());
|
||||
|
||||
// Video
|
||||
emit videoDevicesChanged(getVideoDevices());
|
||||
}
|
||||
|
||||
void SettingsModel::closeCallSettings() {
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
stopCaptureGraph();
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ public:
|
|||
|
||||
bool getIsInCall() const;
|
||||
void accessCallSettings();
|
||||
void updateCallSettings();
|
||||
void closeCallSettings();
|
||||
|
||||
void startCaptureGraph();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue