Fix audio device selection by using the correct AudioDevice.
Fix stats display (percent showing, units, and rounded value).
This commit is contained in:
parent
b07eca28e4
commit
1d0e9f145b
4 changed files with 30 additions and 42 deletions
|
|
@ -345,9 +345,8 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
|
||||||
});
|
});
|
||||||
mCallModelConnection->makeConnectToCore(&CallCore::lSetInputAudioDevice, [this](QString id) {
|
mCallModelConnection->makeConnectToCore(&CallCore::lSetInputAudioDevice, [this](QString id) {
|
||||||
mCallModelConnection->invokeToModel([this, id]() {
|
mCallModelConnection->invokeToModel([this, id]() {
|
||||||
if (auto device = ToolModel::findAudioDevice(id)) {
|
auto device = ToolModel::findAudioDevice(id, linphone::AudioDevice::Capabilities::CapabilityRecord);
|
||||||
mCallModel->setInputAudioDevice(device);
|
if (device) mCallModel->setInputAudioDevice(device);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
mCallModelConnection->makeConnectToModel(&CallModel::inputAudioDeviceChanged, [this](const std::string &id) {
|
mCallModelConnection->makeConnectToModel(&CallModel::inputAudioDeviceChanged, [this](const std::string &id) {
|
||||||
|
|
@ -355,9 +354,8 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
|
||||||
});
|
});
|
||||||
mCallModelConnection->makeConnectToCore(&CallCore::lSetOutputAudioDevice, [this](QString id) {
|
mCallModelConnection->makeConnectToCore(&CallCore::lSetOutputAudioDevice, [this](QString id) {
|
||||||
mCallModelConnection->invokeToModel([this, id]() {
|
mCallModelConnection->invokeToModel([this, id]() {
|
||||||
if (auto device = ToolModel::findAudioDevice(id)) {
|
auto device = ToolModel::findAudioDevice(id, linphone::AudioDevice::Capabilities::CapabilityPlay);
|
||||||
mCallModel->setOutputAudioDevice(device);
|
if (device) mCallModel->setOutputAudioDevice(device);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
mCallModelConnection->makeConnectToModel(&CallModel::conferenceChanged, [this]() {
|
mCallModelConnection->makeConnectToModel(&CallModel::conferenceChanged, [this]() {
|
||||||
|
|
@ -410,12 +408,12 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
|
||||||
tr("Codec: %1 / %2 kHz").arg(Utils::coreStringToAppString(codecType)).arg(codecRate);
|
tr("Codec: %1 / %2 kHz").arg(Utils::coreStringToAppString(codecType)).arg(codecRate);
|
||||||
auto linAudioStats = call->getAudioStats();
|
auto linAudioStats = call->getAudioStats();
|
||||||
if (linAudioStats) {
|
if (linAudioStats) {
|
||||||
audioStats.mBandwidth = tr("Bande passante : %1 %2 %3 %4")
|
audioStats.mBandwidth = tr("Bande passante : %1 %2 kbits/s %3 %4 kbits/s")
|
||||||
.arg("↑")
|
.arg("↑")
|
||||||
.arg(linAudioStats->getUploadBandwidth())
|
.arg(round(linAudioStats->getUploadBandwidth()))
|
||||||
.arg("↓")
|
.arg("↓")
|
||||||
.arg(linAudioStats->getDownloadBandwidth());
|
.arg(round(linAudioStats->getDownloadBandwidth()));
|
||||||
audioStats.mLossRate = tr("Taux de perte: %1 \% %2 \%")
|
audioStats.mLossRate = tr("Taux de perte: %1% %2%")
|
||||||
.arg(linAudioStats->getSenderLossRate())
|
.arg(linAudioStats->getSenderLossRate())
|
||||||
.arg(linAudioStats->getReceiverLossRate());
|
.arg(linAudioStats->getReceiverLossRate());
|
||||||
audioStats.mJitterBufferSize =
|
audioStats.mJitterBufferSize =
|
||||||
|
|
@ -432,12 +430,12 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
|
||||||
tr("Codec: %1 / %2 kHz").arg(Utils::coreStringToAppString(codecType)).arg(codecRate);
|
tr("Codec: %1 / %2 kHz").arg(Utils::coreStringToAppString(codecType)).arg(codecRate);
|
||||||
auto linVideoStats = call->getVideoStats();
|
auto linVideoStats = call->getVideoStats();
|
||||||
if (stats) {
|
if (stats) {
|
||||||
videoStats.mBandwidth = tr("Bande passante : %1 %2 %3 %4")
|
videoStats.mBandwidth = tr("Bande passante : %1 %2 kbits/s %3 %4 kbits/s")
|
||||||
.arg("↑")
|
.arg("↑")
|
||||||
.arg(linVideoStats->getUploadBandwidth())
|
.arg(round(linVideoStats->getUploadBandwidth()))
|
||||||
.arg("↓")
|
.arg("↓")
|
||||||
.arg(linVideoStats->getDownloadBandwidth());
|
.arg(round(linVideoStats->getDownloadBandwidth()));
|
||||||
videoStats.mLossRate = tr("Taux de perte: %1 \% %2 \%")
|
videoStats.mLossRate = tr("Taux de perte: %1% %2%")
|
||||||
.arg(linVideoStats->getSenderLossRate())
|
.arg(linVideoStats->getSenderLossRate())
|
||||||
.arg(linVideoStats->getReceiverLossRate());
|
.arg(linVideoStats->getReceiverLossRate());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -293,14 +293,10 @@ QString SettingsModel::getCaptureDevice() const {
|
||||||
|
|
||||||
void SettingsModel::setCaptureDevice(const QString &device) {
|
void SettingsModel::setCaptureDevice(const QString &device) {
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
std::string devId = Utils::appStringToCoreString(device);
|
auto audioDevice = ToolModel::findAudioDevice(device, linphone::AudioDevice::Capabilities::CapabilityRecord);
|
||||||
auto list = CoreModel::getInstance()->getCore()->getExtendedAudioDevices();
|
if (audioDevice) {
|
||||||
auto audioDevice =
|
CoreModel::getInstance()->getCore()->setDefaultInputAudioDevice(audioDevice);
|
||||||
find_if(list.cbegin(), list.cend(),
|
CoreModel::getInstance()->getCore()->setInputAudioDevice(audioDevice);
|
||||||
[&](const std::shared_ptr<linphone::AudioDevice> &audioItem) { return audioItem->getId() == devId; });
|
|
||||||
if (audioDevice != list.cend()) {
|
|
||||||
CoreModel::getInstance()->getCore()->setDefaultInputAudioDevice(*audioDevice);
|
|
||||||
CoreModel::getInstance()->getCore()->setInputAudioDevice(*audioDevice);
|
|
||||||
emit captureDeviceChanged(device);
|
emit captureDeviceChanged(device);
|
||||||
resetCaptureGraph();
|
resetCaptureGraph();
|
||||||
} else qWarning() << "Cannot set Capture device. The ID cannot be matched with an existant device : " << device;
|
} else qWarning() << "Cannot set Capture device. The ID cannot be matched with an existant device : " << device;
|
||||||
|
|
@ -317,15 +313,10 @@ QString SettingsModel::getPlaybackDevice() const {
|
||||||
|
|
||||||
void SettingsModel::setPlaybackDevice(const QString &device) {
|
void SettingsModel::setPlaybackDevice(const QString &device) {
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
std::string devId = Utils::appStringToCoreString(device);
|
auto audioDevice = ToolModel::findAudioDevice(device, linphone::AudioDevice::Capabilities::CapabilityPlay);
|
||||||
|
if (audioDevice) {
|
||||||
auto list = CoreModel::getInstance()->getCore()->getExtendedAudioDevices();
|
CoreModel::getInstance()->getCore()->setDefaultOutputAudioDevice(audioDevice);
|
||||||
auto audioDevice =
|
CoreModel::getInstance()->getCore()->setOutputAudioDevice(audioDevice);
|
||||||
find_if(list.cbegin(), list.cend(),
|
|
||||||
[&](const std::shared_ptr<linphone::AudioDevice> &audioItem) { return audioItem->getId() == devId; });
|
|
||||||
if (audioDevice != list.cend()) {
|
|
||||||
CoreModel::getInstance()->getCore()->setDefaultOutputAudioDevice(*audioDevice);
|
|
||||||
CoreModel::getInstance()->getCore()->setOutputAudioDevice(*audioDevice);
|
|
||||||
emit playbackDeviceChanged(device);
|
emit playbackDeviceChanged(device);
|
||||||
resetCaptureGraph();
|
resetCaptureGraph();
|
||||||
} else qWarning() << "Cannot set Playback device. The ID cannot be matched with an existant device : " << device;
|
} else qWarning() << "Cannot set Playback device. The ID cannot be matched with an existant device : " << device;
|
||||||
|
|
@ -340,14 +331,10 @@ QString SettingsModel::getRingerDevice() const {
|
||||||
|
|
||||||
void SettingsModel::setRingerDevice(const QString &device) {
|
void SettingsModel::setRingerDevice(const QString &device) {
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
std::string devId = Utils::appStringToCoreString(device);
|
auto audioDevice = ToolModel::findAudioDevice(device, linphone::AudioDevice::Capabilities::CapabilityPlay);
|
||||||
|
|
||||||
auto list = CoreModel::getInstance()->getCore()->getExtendedAudioDevices();
|
if (audioDevice) {
|
||||||
auto audioDevice =
|
CoreModel::getInstance()->getCore()->setRingerDevice(audioDevice->getId());
|
||||||
find_if(list.cbegin(), list.cend(),
|
|
||||||
[&](const std::shared_ptr<linphone::AudioDevice> &audioItem) { return audioItem->getId() == devId; });
|
|
||||||
if (audioDevice != list.cend()) {
|
|
||||||
CoreModel::getInstance()->getCore()->setRingerDevice(devId);
|
|
||||||
emit ringerDeviceChanged(device);
|
emit ringerDeviceChanged(device);
|
||||||
} else qWarning() << "Cannot set Ringer device. The ID cannot be matched with an existant device : " << device;
|
} else qWarning() << "Cannot set Ringer device. The ID cannot be matched with an existant device : " << device;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,12 +56,14 @@ std::shared_ptr<linphone::FriendPhoneNumber> ToolModel::makeLinphoneNumber(const
|
||||||
return linphoneNumber;
|
return linphoneNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<linphone::AudioDevice> ToolModel::findAudioDevice(const QString &id) {
|
std::shared_ptr<linphone::AudioDevice> ToolModel::findAudioDevice(const QString &id,
|
||||||
|
linphone::AudioDevice::Capabilities capability) {
|
||||||
std::string devId = Utils::appStringToCoreString(id);
|
std::string devId = Utils::appStringToCoreString(id);
|
||||||
auto devices = CoreModel::getInstance()->getCore()->getExtendedAudioDevices();
|
auto devices = CoreModel::getInstance()->getCore()->getExtendedAudioDevices();
|
||||||
auto audioDevice =
|
auto audioDevice =
|
||||||
find_if(devices.cbegin(), devices.cend(),
|
find_if(devices.cbegin(), devices.cend(), [&](const std::shared_ptr<linphone::AudioDevice> &audioItem) {
|
||||||
[&](const std::shared_ptr<linphone::AudioDevice> &audioItem) { return audioItem->getId() == devId; });
|
return audioItem->hasCapability(capability) && audioItem->getId() == devId;
|
||||||
|
});
|
||||||
if (audioDevice != devices.cend()) {
|
if (audioDevice != devices.cend()) {
|
||||||
return *audioDevice;
|
return *audioDevice;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ public:
|
||||||
|
|
||||||
static std::shared_ptr<linphone::Address> interpretUrl(const QString &address);
|
static std::shared_ptr<linphone::Address> interpretUrl(const QString &address);
|
||||||
static std::shared_ptr<linphone::FriendPhoneNumber> makeLinphoneNumber(const QString &label, const QString &number);
|
static std::shared_ptr<linphone::FriendPhoneNumber> makeLinphoneNumber(const QString &label, const QString &number);
|
||||||
static std::shared_ptr<linphone::AudioDevice> findAudioDevice(const QString &id);
|
static std::shared_ptr<linphone::AudioDevice> findAudioDevice(const QString &id,
|
||||||
|
linphone::AudioDevice::Capabilities capability);
|
||||||
static std::shared_ptr<linphone::Account> findAccount(const std::shared_ptr<const linphone::Address> &address);
|
static std::shared_ptr<linphone::Account> findAccount(const std::shared_ptr<const linphone::Address> &address);
|
||||||
static bool isMe(const QString &address);
|
static bool isMe(const QString &address);
|
||||||
static bool isLocal(const QString &address);
|
static bool isLocal(const QString &address);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue