mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
misc: fix compilation warnings
Change-Id: Ie035755eaa58621985b80612f25c2918891b00bc
This commit is contained in:
@ -49,22 +49,19 @@ std::shared_ptr<Account>
|
||||
AccountFactory::createAccount(const char* const accountType, const std::string& id)
|
||||
{
|
||||
if (hasAccount(id)) {
|
||||
JAMI_ERR("Existing account %s", id.c_str());
|
||||
JAMI_ERROR("Existing account {}", id);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<Account> account;
|
||||
{
|
||||
const auto& it = generators_.find(accountType);
|
||||
if (it != generators_.cend())
|
||||
account = it->second(id);
|
||||
}
|
||||
const auto& it = generators_.find(accountType);
|
||||
if (it == generators_.cend())
|
||||
return {};
|
||||
|
||||
std::shared_ptr<Account> account = it->second(id);
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
accountMaps_[accountType].insert(std::make_pair(id, account));
|
||||
accountMaps_[accountType].emplace(id, account);
|
||||
}
|
||||
|
||||
return account;
|
||||
}
|
||||
|
||||
@ -81,10 +78,10 @@ AccountFactory::removeAccount(Account& account)
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
const auto& id = account.getAccountID();
|
||||
JAMI_DBG("Removing account %s", id.c_str());
|
||||
JAMI_DEBUG("Removing account {:s}", id);
|
||||
auto& map = accountMaps_.at(account_type);
|
||||
map.erase(id);
|
||||
JAMI_DBG("Remaining %zu %s account(s)", map.size(), account_type);
|
||||
JAMI_DEBUG("Remaining {:d} {:s} account(s)", map.size(), account_type);
|
||||
}
|
||||
|
||||
void
|
||||
@ -95,7 +92,7 @@ AccountFactory::removeAccount(std::string_view id)
|
||||
if (auto account = getAccount(id)) {
|
||||
removeAccount(*account);
|
||||
} else
|
||||
JAMI_ERR("No account with ID %.*s", (int)id.size(), id.data());
|
||||
JAMI_ERROR("No account with ID {:s}", id);
|
||||
}
|
||||
|
||||
template<>
|
||||
|
@ -126,17 +126,15 @@ public:
|
||||
|
||||
private:
|
||||
mutable std::recursive_mutex mutex_ {};
|
||||
std::map<std::string, std::function<std::shared_ptr<Account>(const std::string&)>> generators_ {};
|
||||
std::map<std::string, std::function<std::shared_ptr<Account>(const std::string&)>, std::less<>> generators_ {};
|
||||
std::map<std::string, AccountMap<Account>, std::less<>> accountMaps_ {};
|
||||
|
||||
template<class T>
|
||||
const AccountMap<Account>* getMap_() const
|
||||
{
|
||||
const auto& itermap = accountMaps_.find(T::ACCOUNT_TYPE);
|
||||
|
||||
if (itermap != accountMaps_.cend())
|
||||
return &itermap->second;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ namespace jami {
|
||||
void
|
||||
AccountArchive::deserialize(const std::vector<uint8_t>& dat)
|
||||
{
|
||||
JAMI_DBG("Loading account archive (%lu bytes)", dat.size());
|
||||
JAMI_DEBUG("Loading account archive ({:d} bytes)", dat.size());
|
||||
|
||||
// Decode string
|
||||
auto* char_data = reinterpret_cast<const char*>(&dat[0]);
|
||||
|
@ -191,7 +191,7 @@ DhtPeerConnector::requestConnection(
|
||||
}
|
||||
if (!shared)
|
||||
return;
|
||||
JAMI_INFO("New file channel for outgoing transfer with id(%lu)", tid);
|
||||
JAMI_DEBUG("New file channel for outgoing transfer with id {:d}", tid);
|
||||
|
||||
auto outgoingFile = std::make_shared<ChanneledOutgoingTransfer>(
|
||||
channel,
|
||||
@ -207,7 +207,7 @@ DhtPeerConnector::requestConnection(
|
||||
}
|
||||
|
||||
channel->onShutdown([w = pimpl_->weak(), tid, onChanneledCancelled, peer = outgoingFile->peer()]() {
|
||||
JAMI_INFO("Channel down for outgoing transfer with id(%lu)", tid);
|
||||
JAMI_DEBUG("Channel down for outgoing transfer with id {:d}", tid);
|
||||
onChanneledCancelled(peer);
|
||||
dht::ThreadPool::io().run([w = std::move(w), tid, peer] {
|
||||
if (auto shared = w.lock())
|
||||
@ -219,7 +219,7 @@ DhtPeerConnector::requestConnection(
|
||||
|
||||
if (isVCard) {
|
||||
acc->connectionManager().connectDevice(DeviceId(info.peer),
|
||||
"vcard://" + std::to_string(tid),
|
||||
fmt::format("vcard://{}", tid),
|
||||
channelReadyCb);
|
||||
return;
|
||||
}
|
||||
@ -257,12 +257,12 @@ DhtPeerConnector::requestConnection(
|
||||
for (const auto& peer_h : contacts) {
|
||||
acc->forEachDevice(
|
||||
peer_h,
|
||||
[this, channelName, tid, channelReadyCb = std::move(channelReadyCb)](
|
||||
[this, channelName, channelReadyCb = std::move(channelReadyCb)](
|
||||
const std::shared_ptr<dht::crypto::PublicKey>& dev) {
|
||||
auto acc = pimpl_->account.lock();
|
||||
if (!acc)
|
||||
return;
|
||||
auto deviceId = dev->getLongId();
|
||||
const auto& deviceId = dev->getLongId();
|
||||
if (deviceId == acc->dht()->getPublicKey()->getLongId()) {
|
||||
// No connection to same device
|
||||
return;
|
||||
@ -270,7 +270,6 @@ DhtPeerConnector::requestConnection(
|
||||
|
||||
acc->connectionManager().connectDevice(deviceId, channelName, channelReadyCb);
|
||||
},
|
||||
|
||||
[peer_h, onChanneledCancelled, accId = acc->getAccountID()](bool found) {
|
||||
if (!found) {
|
||||
JAMI_WARN() << accId << "[CNX] aborted, no devices for " << peer_h;
|
||||
@ -306,7 +305,7 @@ DhtPeerConnector::onIncomingConnection(const DRing::DataTransferInfo& info,
|
||||
pimpl_->channeledIncoming_[id].emplace_back(std::move(incomingFile));
|
||||
}
|
||||
channel->onShutdown([w = pimpl_->weak(), id, peer_id]() {
|
||||
JAMI_INFO("Channel down for incoming transfer with id(%lu)", id);
|
||||
JAMI_DEBUG("Channel down for incoming transfer with id {:d}", id);
|
||||
dht::ThreadPool::io().run([w=std::move(w), id, peer_id] {
|
||||
if (auto shared = w.lock())
|
||||
shared->removeIncoming(id, peer_id);
|
||||
|
@ -1,14 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2022 Savoir-faire Linux Inc.
|
||||
*
|
||||
* Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com>
|
||||
* Author: Eloi Bail <Eloi.Bail@savoirfairelinux.com>
|
||||
* Author: Philippe Gorley <philippe.gorley@savoirfairelinux.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ -16,10 +12,8 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "libav_deps.h" // MUST BE INCLUDED FIRST
|
||||
#include "media_codec.h"
|
||||
#include "media_encoder.h"
|
||||
@ -817,12 +811,12 @@ MediaEncoder::initCodec(AVMediaType mediaType, AVCodecID avcodecId, uint64_t br)
|
||||
// Only clamp video bitrate
|
||||
if (mediaType == AVMEDIA_TYPE_VIDEO && br > 0) {
|
||||
if (br < SystemCodecInfo::DEFAULT_MIN_BITRATE) {
|
||||
JAMI_WARN("Requested bitrate %lu too low, setting to %u",
|
||||
JAMI_WARNING("Requested bitrate {:d} too low, setting to {:d}",
|
||||
br,
|
||||
SystemCodecInfo::DEFAULT_MIN_BITRATE);
|
||||
br = SystemCodecInfo::DEFAULT_MIN_BITRATE;
|
||||
} else if (br > SystemCodecInfo::DEFAULT_MAX_BITRATE) {
|
||||
JAMI_WARN("Requested bitrate %lu too high, setting to %u",
|
||||
JAMI_WARNING("Requested bitrate {:d} too high, setting to {:d}",
|
||||
br,
|
||||
SystemCodecInfo::DEFAULT_MAX_BITRATE);
|
||||
br = SystemCodecInfo::DEFAULT_MAX_BITRATE;
|
||||
@ -930,7 +924,7 @@ MediaEncoder::initH264(AVCodecContext* encoderCtx, uint64_t br)
|
||||
av_opt_set_int(encoderCtx, "crf", crf, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "maxrate", maxBitrate, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "bufsize", bufSize, AV_OPT_SEARCH_CHILDREN);
|
||||
JAMI_DBG("H264 encoder setup: crf=%u, maxrate=%lu kbit/s, bufsize=%lu kbit",
|
||||
JAMI_DEBUG("H264 encoder setup: crf={:d}, maxrate={:d} kbit/s, bufsize={:d} kbit",
|
||||
crf,
|
||||
maxBitrate / 1000,
|
||||
bufSize / 1000);
|
||||
@ -941,7 +935,7 @@ MediaEncoder::initH264(AVCodecContext* encoderCtx, uint64_t br)
|
||||
av_opt_set_int(encoderCtx, "bufsize", bufSize, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "crf", -1, AV_OPT_SEARCH_CHILDREN);
|
||||
|
||||
JAMI_DBG("H264 encoder setup cbr: bitrate=%lu kbit/s", br);
|
||||
JAMI_DEBUG("H264 encoder setup cbr: bitrate={:d} kbit/s", br);
|
||||
}
|
||||
}
|
||||
|
||||
@ -961,7 +955,7 @@ MediaEncoder::initH265(AVCodecContext* encoderCtx, uint64_t br)
|
||||
av_opt_set_int(encoderCtx, "crf", crf, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "maxrate", maxBitrate, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "bufsize", bufSize, AV_OPT_SEARCH_CHILDREN);
|
||||
JAMI_DBG("H265 encoder setup: crf=%u, maxrate=%lu kbit/s, bufsize=%lu kbit",
|
||||
JAMI_DEBUG("H265 encoder setup: crf={:d}, maxrate={:d} kbit/s, bufsize={:d} kbit",
|
||||
crf,
|
||||
maxBitrate / 1000,
|
||||
bufSize / 1000);
|
||||
@ -971,7 +965,7 @@ MediaEncoder::initH265(AVCodecContext* encoderCtx, uint64_t br)
|
||||
av_opt_set_int(encoderCtx, "minrate", br * 1000, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "bufsize", br * 500, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "crf", -1, AV_OPT_SEARCH_CHILDREN);
|
||||
JAMI_DBG("H265 encoder setup cbr: bitrate=%lu kbit/s", br);
|
||||
JAMI_DEBUG("H265 encoder setup cbr: bitrate={:d} kbit/s", br);
|
||||
}
|
||||
}
|
||||
|
||||
@ -988,7 +982,7 @@ MediaEncoder::initVP8(AVCodecContext* encoderCtx, uint64_t br)
|
||||
av_opt_set_int(encoderCtx, "qmin", 0, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "slices", 4, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "crf", 18, AV_OPT_SEARCH_CHILDREN);
|
||||
JAMI_DBG("VP8 encoder setup: crf=18");
|
||||
JAMI_DEBUG("VP8 encoder setup: crf=18");
|
||||
} else {
|
||||
// 1- if quality is set use it
|
||||
// bitrate need to be set. The target bitrate becomes the maximum allowed bitrate
|
||||
@ -1021,7 +1015,7 @@ MediaEncoder::initVP8(AVCodecContext* encoderCtx, uint64_t br)
|
||||
av_opt_set_int(encoderCtx, "b", maxBitrate, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "maxrate", maxBitrate, AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(encoderCtx, "bufsize", bufSize, AV_OPT_SEARCH_CHILDREN);
|
||||
JAMI_DBG("VP8 encoder setup: crf=%u, maxrate=%lu, bufsize=%lu",
|
||||
JAMI_DEBUG("VP8 encoder setup: crf={:d}, maxrate={:d}, bufsize={:d}",
|
||||
crf,
|
||||
maxBitrate / 1000,
|
||||
bufSize / 1000);
|
||||
@ -1037,7 +1031,7 @@ MediaEncoder::initMPEG4(AVCodecContext* encoderCtx, uint64_t br)
|
||||
// Use CBR (set bitrate)
|
||||
encoderCtx->rc_buffer_size = bufSize;
|
||||
encoderCtx->bit_rate = encoderCtx->rc_min_rate = encoderCtx->rc_max_rate = maxBitrate;
|
||||
JAMI_DBG("MPEG4 encoder setup: maxrate=%lu, bufsize=%lu", maxBitrate, bufSize);
|
||||
JAMI_DEBUG("MPEG4 encoder setup: maxrate={:d}, bufsize={:d}", maxBitrate, bufSize);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1049,7 +1043,7 @@ MediaEncoder::initH263(AVCodecContext* encoderCtx, uint64_t br)
|
||||
// Use CBR (set bitrate)
|
||||
encoderCtx->rc_buffer_size = bufSize;
|
||||
encoderCtx->bit_rate = encoderCtx->rc_min_rate = encoderCtx->rc_max_rate = maxBitrate;
|
||||
JAMI_DBG("H263 encoder setup: maxrate=%lu, bufsize=%lu", maxBitrate, bufSize);
|
||||
JAMI_DEBUG("H263 encoder setup: maxrate={:d}, bufsize={:d}", maxBitrate, bufSize);
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user