From 6ebc803339d4718f1126127dca65eacea13eb063 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 26 Jun 2017 09:36:17 +0200 Subject: [PATCH] feat(CallModel): supports FPS stats --- assets/languages/en.ts | 8 ++++++++ assets/languages/fr.ts | 8 ++++++++ src/components/call/CallModel.cpp | 27 +++++++++++++++------------ 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/assets/languages/en.ts b/assets/languages/en.ts index c9eff363d..1317cbdb2 100644 --- a/assets/languages/en.ts +++ b/assets/languages/en.ts @@ -323,6 +323,14 @@ callErrorNotAcceptable Remote party cannot accept the call. + + callStatsReceivedFramerate + Received framerate + + + callStatsSentFramerate + Sent framerate + CallSipAddress diff --git a/assets/languages/fr.ts b/assets/languages/fr.ts index b45e46870..e2f22d817 100644 --- a/assets/languages/fr.ts +++ b/assets/languages/fr.ts @@ -323,6 +323,14 @@ callErrorNotAcceptable Le correspondant ne peut accepter votre appel. + + callStatsReceivedFramerate + FPS reçues + + + callStatsSentFramerate + FPS envoyées + CallSipAddress diff --git a/src/components/call/CallModel.cpp b/src/components/call/CallModel.cpp index a3ae2b0d1..4e7a52b67 100644 --- a/src/components/call/CallModel.cpp +++ b/src/components/call/CallModel.cpp @@ -566,7 +566,6 @@ inline QVariantMap createStat (const QString &key, const QString &value) { } void CallModel::updateStats (const shared_ptr &callStats, QVariantList &statsList) { - QString family; shared_ptr params = mCall->getCurrentParams(); shared_ptr payloadType; @@ -581,6 +580,7 @@ void CallModel::updateStats (const shared_ptr &callSt return; } + QString family; switch (callStats->getIpFamilyOfRemote()) { case linphone::AddressFamilyInet: family = QStringLiteral("IPv4"); @@ -596,37 +596,40 @@ void CallModel::updateStats (const shared_ptr &callSt statsList.clear(); statsList << ::createStat(tr("callStatsCodec"), payloadType - ? QString("%1 / %2kHz").arg(Utils::coreStringToAppString(payloadType->getMimeType())).arg(payloadType->getClockRate() / 1000) + ? QStringLiteral("%1 / %2kHz").arg(Utils::coreStringToAppString(payloadType->getMimeType())).arg(payloadType->getClockRate() / 1000) : ""); - statsList << ::createStat(tr("callStatsUploadBandwidth"), QString("%1 kbits/s").arg(int(callStats->getUploadBandwidth()))); - statsList << ::createStat(tr("callStatsDownloadBandwidth"), QString("%1 kbits/s").arg(int(callStats->getDownloadBandwidth()))); + statsList << ::createStat(tr("callStatsUploadBandwidth"), QStringLiteral("%1 kbits/s").arg(int(callStats->getUploadBandwidth()))); + statsList << ::createStat(tr("callStatsDownloadBandwidth"), QStringLiteral("%1 kbits/s").arg(int(callStats->getDownloadBandwidth()))); statsList << ::createStat(tr("callStatsIceState"), iceStateToString(callStats->getIceState())); statsList << ::createStat(tr("callStatsIpFamily"), family); - statsList << ::createStat(tr("callStatsSenderLossRate"), QString("%1 %").arg(callStats->getSenderLossRate())); - statsList << ::createStat(tr("callStatsReceiverLossRate"), QString("%1 %").arg(callStats->getReceiverLossRate())); + statsList << ::createStat(tr("callStatsSenderLossRate"), QStringLiteral("%1 %").arg(callStats->getSenderLossRate())); + statsList << ::createStat(tr("callStatsReceiverLossRate"), QStringLiteral("%1 %").arg(callStats->getReceiverLossRate())); switch (callStats->getType()) { case linphone::StreamTypeAudio: - statsList << ::createStat(tr("callStatsJitterBuffer"), QString("%1 ms").arg(callStats->getJitterBufferSizeMs())); + statsList << ::createStat(tr("callStatsJitterBuffer"), QStringLiteral("%1 ms").arg(callStats->getJitterBufferSizeMs())); break; case linphone::StreamTypeVideo: { - QString sentVideoDefinitionName = ::Utils::coreStringToAppString(params->getSentVideoDefinition()->getName()); - QString sentVideoDefinition = QString("%1x%2") + const QString sentVideoDefinitionName = ::Utils::coreStringToAppString(params->getSentVideoDefinition()->getName()); + const QString sentVideoDefinition = QStringLiteral("%1x%2") .arg(params->getSentVideoDefinition()->getWidth()) .arg(params->getSentVideoDefinition()->getHeight()); statsList << ::createStat(tr("callStatsSentVideoDefinition"), sentVideoDefinition == sentVideoDefinitionName ? sentVideoDefinition - : QString("%1 (%2)").arg(sentVideoDefinition).arg(sentVideoDefinitionName)); + : QStringLiteral("%1 (%2)").arg(sentVideoDefinition).arg(sentVideoDefinitionName)); - QString receivedVideoDefinitionName = ::Utils::coreStringToAppString(params->getReceivedVideoDefinition()->getName()); - QString receivedVideoDefinition = QString("%1x%2") + const QString receivedVideoDefinitionName = ::Utils::coreStringToAppString(params->getReceivedVideoDefinition()->getName()); + const QString receivedVideoDefinition = QString("%1x%2") .arg(params->getReceivedVideoDefinition()->getWidth()) .arg(params->getReceivedVideoDefinition()->getHeight()); statsList << ::createStat(tr("callStatsReceivedVideoDefinition"), receivedVideoDefinition == receivedVideoDefinitionName ? receivedVideoDefinition : QString("%1 (%2)").arg(receivedVideoDefinition).arg(receivedVideoDefinitionName)); + + statsList << ::createStat(tr("callStatsReceivedFramerate"), QStringLiteral("%1 FPS").arg(params->getReceivedFramerate())); + statsList << ::createStat(tr("callStatsSentFramerate"), QStringLiteral("%1 FPS").arg(params->getSentFramerate())); } break; default: