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,
|
void CallModel::onAudioDeviceChanged(const std::shared_ptr<linphone::Call> &call,
|
||||||
const std::shared_ptr<linphone::AudioDevice> &audioDevice) {
|
const std::shared_ptr<linphone::AudioDevice> &audioDevice) {
|
||||||
|
lInfo() << log().arg("audio device changed");
|
||||||
emit audioDeviceChanged(call, audioDevice);
|
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;
|
const std::string &url) override;
|
||||||
virtual void onFriendListRemoved(const std::shared_ptr<linphone::Core> &core,
|
virtual void onFriendListRemoved(const std::shared_ptr<linphone::Core> &core,
|
||||||
const std::shared_ptr<linphone::FriendList> &friendList) override;
|
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:
|
signals:
|
||||||
void accountAdded(const std::shared_ptr<linphone::Core> &core, const std::shared_ptr<linphone::Account> &account);
|
void accountAdded(const std::shared_ptr<linphone::Core> &core, const std::shared_ptr<linphone::Account> &account);
|
||||||
|
|
@ -289,6 +292,9 @@ signals:
|
||||||
bool checkRequestedByUser);
|
bool checkRequestedByUser);
|
||||||
void friendListRemoved(const std::shared_ptr<linphone::Core> &core,
|
void friendListRemoved(const std::shared_ptr<linphone::Core> &core,
|
||||||
const std::shared_ptr<linphone::FriendList> &friendList);
|
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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,20 @@ SettingsModel::SettingsModel() {
|
||||||
QObject::connect(CoreModel::getInstance().get(), &CoreModel::lastCallEnded, this, [this]() {
|
QObject::connect(CoreModel::getInstance().get(), &CoreModel::lastCallEnded, this, [this]() {
|
||||||
if (mCaptureGraphListenerCount > 0) createCaptureGraph(); // Repair the capture graph
|
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() {
|
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
|
// Force a call on the 'detect' method of all audio filters, updating new or removed devices
|
||||||
void SettingsModel::accessCallSettings() {
|
void SettingsModel::accessCallSettings() {
|
||||||
// Audio
|
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
startCaptureGraph();
|
startCaptureGraph();
|
||||||
|
|
||||||
|
// Audio
|
||||||
CoreModel::getInstance()->getCore()->reloadSoundDevices();
|
CoreModel::getInstance()->getCore()->reloadSoundDevices();
|
||||||
emit captureDevicesChanged(getCaptureDevices());
|
emit captureDevicesChanged(getCaptureDevices());
|
||||||
emit playbackDevicesChanged(getPlaybackDevices());
|
emit playbackDevicesChanged(getPlaybackDevices());
|
||||||
|
|
@ -191,6 +206,23 @@ void SettingsModel::accessCallSettings() {
|
||||||
emit videoDevicesChanged(getVideoDevices());
|
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() {
|
void SettingsModel::closeCallSettings() {
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
stopCaptureGraph();
|
stopCaptureGraph();
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ public:
|
||||||
|
|
||||||
bool getIsInCall() const;
|
bool getIsInCall() const;
|
||||||
void accessCallSettings();
|
void accessCallSettings();
|
||||||
|
void updateCallSettings();
|
||||||
void closeCallSettings();
|
void closeCallSettings();
|
||||||
|
|
||||||
void startCaptureGraph();
|
void startCaptureGraph();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue