diff --git a/src/account.cpp b/src/account.cpp
index 526ef58b610b1295767c9e10b6a7f1bfcffff305..244d470591ac8a4c69dcca161792bbae98f7aca2 100644
--- a/src/account.cpp
+++ b/src/account.cpp
@@ -331,8 +331,8 @@ Account::setActiveCodecs(const std::vector<unsigned>& list)
 
     std::sort(std::begin(accountCodecInfoList_),
               std::end  (accountCodecInfoList_),
-              [](std::shared_ptr<AccountCodecInfo> a,
-                 std::shared_ptr<AccountCodecInfo> b) {
+              [](const std::shared_ptr<AccountCodecInfo>& a,
+                 const std::shared_ptr<AccountCodecInfo>& b) {
                   return a->order < b->order;
               });
 
diff --git a/src/call.cpp b/src/call.cpp
index e7959cfd8b977042c5a5a141a014ac0630b4bf5a..d98aac8dfdb0888df61a0c9480154ae4313ac8aa 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -464,7 +464,7 @@ Call::addSubCall(const std::shared_ptr<Call>& call)
 }
 
 void
-Call::merge(std::shared_ptr<Call> scall)
+Call::merge(const std::shared_ptr<Call>& scall)
 {
     RING_WARN("[call:%s] merge to -> [call:%s]", scall->getCallId().c_str(), getCallId().c_str());
     auto& call = *scall;
diff --git a/src/call.h b/src/call.h
index 0a47ccc7cec504d4b068aafd97a3fd89f640f636..b139f4a819102a74d69d3f4a95fc964eb40ed660 100644
--- a/src/call.h
+++ b/src/call.h
@@ -344,7 +344,7 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> {
         }
         void addSubCall(const std::shared_ptr<Call>& call);
 
-        virtual void merge(std::shared_ptr<Call> scall);
+        virtual void merge(const std::shared_ptr<Call>& scall);
 
     protected:
         /**
diff --git a/src/dring/dring.h b/src/dring/dring.h
index 5db5255c37806c18b13be5724b9a807e31a0cdd2..1662cc9d38a2b59d5f3784ca8bd3bc3aeec4f2c6 100644
--- a/src/dring/dring.h
+++ b/src/dring/dring.h
@@ -118,7 +118,7 @@ class CallbackWrapper : public CallbackWrapperBase {
         // Create and initialize a wrapper from a generic CallbackWrapperBase
         // shared pointer.
         // Note: the given callback is copied into internal storage.
-        CallbackWrapper(std::shared_ptr<CallbackWrapperBase> p) noexcept {
+        CallbackWrapper(const std::shared_ptr<CallbackWrapperBase>& p) noexcept {
             if (p)
                 cb_ = ((CallbackWrapper<TProto>*)p.get())->cb_;
         }
diff --git a/src/manager.cpp b/src/manager.cpp
index 7890e99bec952d536e27364c29a9d718f0ef3143..c67858f57d0866ca9f732b3e507b34541bd23404 100644
--- a/src/manager.cpp
+++ b/src/manager.cpp
@@ -453,7 +453,7 @@ Manager::switchCall(const std::string& id)
 }
 
 void
-Manager::switchCall(std::shared_ptr<Call> call)
+Manager::switchCall(const std::shared_ptr<Call>& call)
 {
     switchCall(call->getCallId());
 }
@@ -1445,7 +1445,7 @@ Manager::scheduleTask(const std::function<void()>&& task, std::chrono::steady_cl
 
 
 void
-Manager::scheduleTask(std::shared_ptr<Runnable> task, std::chrono::steady_clock::time_point when)
+Manager::scheduleTask(const std::shared_ptr<Runnable>& task, std::chrono::steady_clock::time_point when)
 {
     std::lock_guard<std::mutex> lock(scheduledTasksMutex_);
     scheduledTasks_.emplace(when, task);
diff --git a/src/manager.h b/src/manager.h
index b8461425edc4333ae3c7fbd6fe798990a2ab9f55..aaaba6e92abf34109775c2939e75bad2987ed1aa 100644
--- a/src/manager.h
+++ b/src/manager.h
@@ -809,7 +809,7 @@ class Manager {
         void unsetCurrentCall();
 
         void switchCall(const std::string& id);
-        void switchCall(std::shared_ptr<Call> call);
+        void switchCall(const std::shared_ptr<Call>& call);
 
         /** Application wide tone controler */
         ToneControl toneCtrl_;
@@ -998,7 +998,7 @@ class Manager {
             Runnable(const std::function<void()>&& t) : cb(std::move(t)) {}
         };
         std::shared_ptr<Runnable> scheduleTask(const std::function<void()>&& task, std::chrono::steady_clock::time_point when);
-        void scheduleTask(std::shared_ptr<Runnable> task, std::chrono::steady_clock::time_point when);
+        void scheduleTask(const std::shared_ptr<Runnable>& task, std::chrono::steady_clock::time_point when);
 
 #ifdef RING_VIDEO
         /**
diff --git a/src/media/audio/ringbufferpool.cpp b/src/media/audio/ringbufferpool.cpp
index e5da156313d0e581424a1e3a7a3724f040501450..25ce9c188145ab43d2dec4a4cdc91ca995d9289a 100644
--- a/src/media/audio/ringbufferpool.cpp
+++ b/src/media/audio/ringbufferpool.cpp
@@ -142,7 +142,7 @@ RingBufferPool::removeReadBindings(const std::string& call_id)
  * Make given call ID a reader of given ring buffer
  */
 void
-RingBufferPool::addReaderToRingBuffer(std::shared_ptr<RingBuffer> rbuf,
+RingBufferPool::addReaderToRingBuffer(const std::shared_ptr<RingBuffer>& rbuf,
                                   const std::string& call_id)
 {
     if (call_id != DEFAULT_ID and rbuf->id == call_id)
@@ -154,7 +154,7 @@ RingBufferPool::addReaderToRingBuffer(std::shared_ptr<RingBuffer> rbuf,
 }
 
 void
-RingBufferPool::removeReaderFromRingBuffer(std::shared_ptr<RingBuffer> rbuf,
+RingBufferPool::removeReaderFromRingBuffer(const std::shared_ptr<RingBuffer>& rbuf,
                                        const std::string& call_id)
 {
     if (auto bindings = getReadBindings(call_id)) {
diff --git a/src/media/audio/ringbufferpool.h b/src/media/audio/ringbufferpool.h
index 4625391a815d8eaa36c81ec9da1034b5cb87e893..1870970be3f8c46715827807de1c04557cb5a1b5 100644
--- a/src/media/audio/ringbufferpool.h
+++ b/src/media/audio/ringbufferpool.h
@@ -135,10 +135,10 @@ class RingBufferPool {
 
         void removeReadBindings(const std::string& call_id);
 
-        void addReaderToRingBuffer(std::shared_ptr<RingBuffer> rbuf,
+        void addReaderToRingBuffer(const std::shared_ptr<RingBuffer>& rbuf,
                                    const std::string& call_id);
 
-        void removeReaderFromRingBuffer(std::shared_ptr<RingBuffer> rbuf,
+        void removeReaderFromRingBuffer(const std::shared_ptr<RingBuffer>& rbuf,
                                         const std::string& call_id);
 
         // A cache of created RingBuffers listed by IDs.
diff --git a/src/media/video/sinkclient.cpp b/src/media/video/sinkclient.cpp
index a3699b43c1b6b20fa0700bd418a6dd6ec6b53c3b..d8737723cdaeecbbb8ac1b1d5d17db4f9c2c6890 100644
--- a/src/media/video/sinkclient.cpp
+++ b/src/media/video/sinkclient.cpp
@@ -314,7 +314,7 @@ SinkClient::SinkClient(const std::string& id, bool mixer)
 
 void
 SinkClient::update(Observable<std::shared_ptr<VideoFrame>>* /*obs*/,
-                   std::shared_ptr<VideoFrame> frame_p)
+                   const std::shared_ptr<VideoFrame>& frame_p)
 {
     auto& f = *frame_p;
 
diff --git a/src/media/video/sinkclient.h b/src/media/video/sinkclient.h
index f239af53d8460353b8b277a24f23bd6194a01a3a..0039220bc5ba36211297bc60ed7c2fbd8cf44b68 100644
--- a/src/media/video/sinkclient.h
+++ b/src/media/video/sinkclient.h
@@ -56,7 +56,7 @@ class SinkClient : public VideoFramePassiveReader
 
         // as VideoFramePassiveReader
         void update(Observable<std::shared_ptr<ring::VideoFrame>>*,
-                    std::shared_ptr<ring::VideoFrame>) override;
+                    const std::shared_ptr<ring::VideoFrame>&) override;
 
         bool start() noexcept;
         bool stop() noexcept;
diff --git a/src/media/video/video_base.h b/src/media/video/video_base.h
index 23473ef6efe41015c5557ec34da700c2efbf8c4d..22abb0cfc53bce1effb3907b227763d92f6db556 100644
--- a/src/media/video/video_base.h
+++ b/src/media/video/video_base.h
@@ -116,7 +116,7 @@ class Observer
 {
 public:
     virtual ~Observer() {};
-    virtual void update(Observable<T>*, T) = 0;
+    virtual void update(Observable<T>*, const T&) = 0;
     virtual void attached(Observable<T>*) {};
     virtual void detached(Observable<T>*) {};
 };
diff --git a/src/media/video/video_mixer.cpp b/src/media/video/video_mixer.cpp
index 335d08c21dcdd5df411d53d0eb1c2466c35502ae..3559dc2a0ff058cdab634399cb546ee0837089e2 100644
--- a/src/media/video/video_mixer.cpp
+++ b/src/media/video/video_mixer.cpp
@@ -101,7 +101,7 @@ VideoMixer::detached(Observable<std::shared_ptr<VideoFrame>>* ob)
 
 void
 VideoMixer::update(Observable<std::shared_ptr<VideoFrame>>* ob,
-                   std::shared_ptr<VideoFrame> frame_p)
+                   const std::shared_ptr<VideoFrame>& frame_p)
 {
     auto lock(rwMutex_.read());
 
diff --git a/src/media/video/video_mixer.h b/src/media/video/video_mixer.h
index db791644b9da3dcf4f9e4fe15fabd02bbab17290..ed037a04865ad18f7577313bf742d43783d26bc4 100644
--- a/src/media/video/video_mixer.h
+++ b/src/media/video/video_mixer.h
@@ -49,7 +49,7 @@ public:
     int getPixelFormat() const override;
 
     // as VideoFramePassiveReader
-    void update(Observable<std::shared_ptr<VideoFrame>>* ob, std::shared_ptr<VideoFrame> v) override;
+    void update(Observable<std::shared_ptr<VideoFrame>>* ob, const std::shared_ptr<VideoFrame>& v) override;
     void attached(Observable<std::shared_ptr<VideoFrame>>* ob) override;
     void detached(Observable<std::shared_ptr<VideoFrame>>* ob) override;
 
diff --git a/src/media/video/video_sender.cpp b/src/media/video/video_sender.cpp
index 42914c2b880fa7f5e523b6132a243368c0aa419a..d9531c01fbdd1aa5ae307cee591c716935cded29 100644
--- a/src/media/video/video_sender.cpp
+++ b/src/media/video/video_sender.cpp
@@ -75,7 +75,7 @@ VideoSender::encodeAndSendVideo(VideoFrame& input_frame)
 
 void
 VideoSender::update(Observable<std::shared_ptr<VideoFrame>>* /*obs*/,
-                    std::shared_ptr<VideoFrame> frame_p)
+                    const std::shared_ptr<VideoFrame>& frame_p)
 {
     encodeAndSendVideo(*frame_p);
 }
diff --git a/src/media/video/video_sender.h b/src/media/video/video_sender.h
index f0019b4a7bc25c8cc4f77b9a9ca7201af1ae808f..151a8c68b6309be360e3e500525065b30b531b72 100644
--- a/src/media/video/video_sender.h
+++ b/src/media/video/video_sender.h
@@ -54,7 +54,7 @@ public:
 
     // as VideoFramePassiveReader
     void update(Observable<std::shared_ptr<VideoFrame>>* obs,
-                std::shared_ptr<VideoFrame> frame_p) override;
+                const std::shared_ptr<VideoFrame>& frame_p) override;
 
     void setMuted(bool isMuted);
     uint16_t getLastSeqValue();
diff --git a/src/ringdht/namedirectory.cpp b/src/ringdht/namedirectory.cpp
index 09a633aafa680ee8c7c7db25ffed6dbe9a578ef0..f40b2539da2adff108cc9f06f95bf3fcfa0bc23d 100644
--- a/src/ringdht/namedirectory.cpp
+++ b/src/ringdht/namedirectory.cpp
@@ -113,8 +113,8 @@ void NameDirectory::lookupAddress(const std::string& addr, LookupCallback cb)
 
         RING_DBG("Address lookup for %s: %s", addr.c_str(), uri.to_string().c_str());
 
-        auto ret = restbed::Http::async(req, [this,cb,addr](const std::shared_ptr<restbed::Request>,
-                                                 const std::shared_ptr<restbed::Response> reply) {
+        auto ret = restbed::Http::async(req, [this,cb,addr](const std::shared_ptr<restbed::Request>&,
+                                                 const std::shared_ptr<restbed::Response>& reply) {
             if (reply->get_status_code() == 200) {
                 size_t length = getContentLength(*reply);
                 if (length > MAX_RESPONSE_SIZE) {
@@ -180,8 +180,8 @@ void NameDirectory::lookupName(const std::string& n, LookupCallback cb)
 
         RING_DBG("Name lookup for %s: %s", name.c_str(), uri.to_string().c_str());
 
-        auto ret = restbed::Http::async(request, [this,cb,name](const std::shared_ptr<restbed::Request>,
-                                                     const std::shared_ptr<restbed::Response> reply) {
+        auto ret = restbed::Http::async(request, [this,cb,name](const std::shared_ptr<restbed::Request>&,
+                                                     const std::shared_ptr<restbed::Response>& reply) {
             auto code = reply->get_status_code();
             if (code != 200)
                 RING_DBG("Name lookup for %s: got reply code %d", name.c_str(), code);
@@ -272,8 +272,8 @@ void NameDirectory::registerName(const std::string& addr, const std::string& n,
 
         RING_WARN("registerName: sending request %s %s", addr.c_str(), name.c_str());
         auto ret = restbed::Http::async(request,
-                             [this,cb,addr,name](const std::shared_ptr<restbed::Request>,
-                                                 const std::shared_ptr<restbed::Response> reply)
+                             [this,cb,addr,name](const std::shared_ptr<restbed::Request>&,
+                                                 const std::shared_ptr<restbed::Response>& reply)
         {
             auto code = reply->get_status_code();
             RING_DBG("Got reply for registration of %s -> %s: code %d", name.c_str(), addr.c_str(), code);
diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp
index ffc9e0fb5f8de8781e1b5287614b8a31fd8f84a7..5c64f10a826f3b8eddcc3cfda4a14c98e807b2db 100644
--- a/src/ringdht/ringaccount.cpp
+++ b/src/ringdht/ringaccount.cpp
@@ -1172,7 +1172,7 @@ RingAccount::loadAccountFromDHT(const std::string& archive_password, const std::
             std::tie(key, loc) = computeKeys(archive_password, archive_pin, previous);
             RING_DBG("Trying to load account from DHT with %s at %s", archive_pin.c_str(), loc.toString().c_str());
             if (auto this_ = w.lock()) {
-                this_->dht_.get(loc, [w,key,found,archive_password,archiveFound](std::shared_ptr<dht::Value> val) {
+                this_->dht_.get(loc, [w,key,found,archive_password,archiveFound](const std::shared_ptr<dht::Value>& val) {
                     std::vector<uint8_t> decrypted;
                     try {
                         decrypted = dht::crypto::aesDecrypt(val->data, key);
@@ -1961,7 +1961,7 @@ RingAccount::doRegister_()
             for (const auto& crl : identity_.second->issuer->getRevocationLists())
                 dht_.put(h, crl, dht::DoneCallback{}, {}, true);
             dht_.listen<DeviceAnnouncement>(h, [shared](DeviceAnnouncement&& dev) {
-                shared->findCertificate(dev.dev, [shared](const std::shared_ptr<dht::crypto::Certificate> crt) {
+                shared->findCertificate(dev.dev, [shared](const std::shared_ptr<dht::crypto::Certificate>& crt) {
                     shared->foundAccountDevice(crt);
                 });
                 return true;
@@ -2014,7 +2014,7 @@ RingAccount::doRegister_()
                 if (v.service != DHT_TYPE_NS)
                     return true;
 
-                shared->findCertificate(v.from, [shared, v](const std::shared_ptr<dht::crypto::Certificate> cert) mutable {
+                shared->findCertificate(v.from, [shared, v](const std::shared_ptr<dht::crypto::Certificate>& cert) mutable {
                     auto& this_ = *shared.get();
 
                     // check peer certificate
@@ -2140,7 +2140,7 @@ RingAccount::onPeerMessage(const dht::InfoHash& peer_device, std::function<void(
 }
 
 void
-RingAccount::incomingCall(dht::IceCandidates&& msg, std::shared_ptr<dht::crypto::Certificate> from_cert)
+RingAccount::incomingCall(dht::IceCandidates&& msg, const std::shared_ptr<dht::crypto::Certificate>& from_cert)
 {
     RING_WARN("ICE incoming from DHT peer %s", msg.from.toString().c_str());
     auto call = Manager::instance().callFactory.newCall<SIPCall, RingAccount>(*this, Manager::instance().getNewCallID(), Call::CallType::INCOMING);
@@ -2240,10 +2240,10 @@ RingAccount::foundPeerDevice(const std::shared_ptr<dht::crypto::Certificate>& cr
 }
 
 void
-RingAccount::replyToIncomingIceMsg(std::shared_ptr<SIPCall> call,
-                                  std::shared_ptr<IceTransport> ice,
-                                  const dht::IceCandidates& peer_ice_msg,
-                                  std::shared_ptr<dht::crypto::Certificate> peer_cert)
+RingAccount::replyToIncomingIceMsg(const std::shared_ptr<SIPCall>& call,
+                                   const std::shared_ptr<IceTransport>& ice,
+                                   const dht::IceCandidates& peer_ice_msg,
+                                   const std::shared_ptr<dht::crypto::Certificate>& peer_cert)
 {
     registerDhtAddress(*ice);
 
@@ -2819,7 +2819,7 @@ RingAccount::onReceiveDeviceSync(DeviceSync&& sync)
     RING_WARN("Received device sync data %zu", sync.devices_known.size());
     for (const auto& d : sync.devices_known) {
         auto shared = std::static_pointer_cast<RingAccount>(shared_from_this());
-        findCertificate(d.first, [shared,d](const std::shared_ptr<dht::crypto::Certificate> crt) {
+        findCertificate(d.first, [shared,d](const std::shared_ptr<dht::crypto::Certificate>& crt) {
             if (not crt)
                 return;
             shared->foundAccountDevice(crt, d.second);
diff --git a/src/ringdht/ringaccount.h b/src/ringdht/ringaccount.h
index 0316799a784eb21fa6b0849f9c489eebfc8e6a91..768faea65ee8b42db91619186950e2854b0b41d6 100644
--- a/src/ringdht/ringaccount.h
+++ b/src/ringdht/ringaccount.h
@@ -356,7 +356,7 @@ class RingAccount : public SIPAccountBase {
         void onTrackedBuddyOnline(std::map<dht::InfoHash, BuddyInfo>::iterator& buddy_info_it, const dht::InfoHash& device_id);
 
         void doRegister_();
-        void incomingCall(dht::IceCandidates&& msg, std::shared_ptr<dht::crypto::Certificate> from);
+        void incomingCall(dht::IceCandidates&& msg, const std::shared_ptr<dht::crypto::Certificate>& from);
 
         const dht::ValueType USER_PROFILE_TYPE = {9, "User profile", std::chrono::hours(24 * 7)};
 
@@ -497,10 +497,10 @@ class RingAccount : public SIPAccountBase {
         void loadKnownDevices();
         void saveKnownDevices() const;
 
-        void replyToIncomingIceMsg(std::shared_ptr<SIPCall>,
-                                   std::shared_ptr<IceTransport>,
+        void replyToIncomingIceMsg(const std::shared_ptr<SIPCall>&,
+                                   const std::shared_ptr<IceTransport>&,
                                    const dht::IceCandidates&,
-                                   std::shared_ptr<dht::crypto::Certificate>);
+                                   const std::shared_ptr<dht::crypto::Certificate>&);
 
         static tls::DhParams loadDhParams(const std::string path);
 
diff --git a/src/security/certstore.cpp b/src/security/certstore.cpp
index dc22ff45d883bf92ab7446bb18f94c690d2011d7..8dd1fb88b18d021f6aab385b661a65724e5b2604 100644
--- a/src/security/certstore.cpp
+++ b/src/security/certstore.cpp
@@ -142,7 +142,7 @@ CertificateStore::findCertificateByUID(const std::string& uid) const
 }
 
 std::shared_ptr<crypto::Certificate>
-CertificateStore::findIssuer(std::shared_ptr<crypto::Certificate> crt) const
+CertificateStore::findIssuer(const std::shared_ptr<crypto::Certificate>& crt) const
 {
     std::shared_ptr<crypto::Certificate> ret {};
     auto n = crt->getIssuerUID();
@@ -260,13 +260,13 @@ CertificateStore::pinCertificate(crypto::Certificate&& cert, bool local)
 }
 
 std::vector<std::string>
-CertificateStore::pinCertificate(std::shared_ptr<crypto::Certificate> cert, bool local)
+CertificateStore::pinCertificate(const std::shared_ptr<crypto::Certificate>& cert, bool local)
 {
     bool sig {false};
     std::vector<std::string> ids {};
     {
-        std::lock_guard<std::mutex> l(lock_);
         auto c = cert;
+        std::lock_guard<std::mutex> l(lock_);
         while (c) {
             bool inserted;
             auto id = c->getId().toString();
diff --git a/src/security/certstore.h b/src/security/certstore.h
index 1ded45ea3c4e00b7bcf654836a7f3efa7181fd79..f8591916e3e24f45a89a35c2edf848fcc3970c61 100644
--- a/src/security/certstore.h
+++ b/src/security/certstore.h
@@ -61,11 +61,11 @@ public:
 
     std::shared_ptr<crypto::Certificate> findCertificateByName(const std::string& name, crypto::Certificate::NameType type = crypto::Certificate::NameType::UNKNOWN) const;
     std::shared_ptr<crypto::Certificate> findCertificateByUID(const std::string& uid) const;
-    std::shared_ptr<crypto::Certificate> findIssuer(std::shared_ptr<crypto::Certificate> crt) const;
+    std::shared_ptr<crypto::Certificate> findIssuer(const std::shared_ptr<crypto::Certificate>& crt) const;
 
     std::vector<std::string> pinCertificate(const std::vector<uint8_t>& crt, bool local = true) noexcept;
     std::vector<std::string> pinCertificate(crypto::Certificate&& crt, bool local = true);
-    std::vector<std::string> pinCertificate(std::shared_ptr<crypto::Certificate> crt, bool local = true);
+    std::vector<std::string> pinCertificate(const std::shared_ptr<crypto::Certificate>& crt, bool local = true);
     bool unpinCertificate(const std::string&);
 
     void pinCertificatePath(const std::string& path, std::function<void(const std::vector<std::string>&)> cb = {});
diff --git a/src/security/tls_session.cpp b/src/security/tls_session.cpp
index 1bff93402281561f79ef0bd71e72b39bf8b9c0fd..b4f1dcf3cef91811e51c9ebc01f04f9cef7d735a 100644
--- a/src/security/tls_session.cpp
+++ b/src/security/tls_session.cpp
@@ -152,7 +152,7 @@ private:
     T creds_;
 };
 
-TlsSession::TlsSession(std::shared_ptr<IceTransport> ice, int ice_comp_id,
+TlsSession::TlsSession(const std::shared_ptr<IceTransport>& ice, int ice_comp_id,
                        const TlsParams& params, const TlsSessionCallbacks& cbs, bool anonymous)
     : socket_(new IceSocket(ice, ice_comp_id))
     , isServer_(not ice->isInitiator())
diff --git a/src/security/tls_session.h b/src/security/tls_session.h
index 3f1794eeb10896e66c5288086c4ef6c6c68c66a6..28e905d92c0c0b6505db378ecae5bb7f48dfe43f 100644
--- a/src/security/tls_session.h
+++ b/src/security/tls_session.h
@@ -136,7 +136,7 @@ public:
         VerifyCertificate verifyCertificate;
     };
 
-    TlsSession(std::shared_ptr<IceTransport> ice, int ice_comp_id, const TlsParams& params,
+    TlsSession(const std::shared_ptr<IceTransport>& ice, int ice_comp_id, const TlsParams& params,
                const TlsSessionCallbacks& cbs, bool anonymous=true);
     ~TlsSession();
 
diff --git a/src/sip/sipcall.cpp b/src/sip/sipcall.cpp
index 19ae3e81f04f929babc91c7e9d658f341bf9f704..e1b7c94f26deba8e87fa16b41a92e44b3efff4ca 100644
--- a/src/sip/sipcall.cpp
+++ b/src/sip/sipcall.cpp
@@ -177,7 +177,7 @@ void SIPCall::setContactHeader(pj_str_t *contact)
 }
 
 void
-SIPCall::setTransport(std::shared_ptr<SipTransport> t)
+SIPCall::setTransport(const std::shared_ptr<SipTransport>& t)
 {
     if (isSecure() and t and not t->isSecure()) {
         RING_ERR("Can't set unsecure transport to secure call.");
@@ -1118,7 +1118,7 @@ SIPCall::initIceTransport(bool master, unsigned channel_num)
 }
 
 void
-SIPCall::merge(std::shared_ptr<SIPCall> scall)
+SIPCall::merge(const std::shared_ptr<SIPCall>& scall)
 {
     RING_WARN("SIPCall::merge %s -> %s", scall->getCallId().c_str(), getCallId().c_str());
     inv = std::move(scall->inv);
diff --git a/src/sip/sipcall.h b/src/sip/sipcall.h
index 733fc783c8c88ad86e0effd0c32a3e30dc616278..c7542f6ffc336c9bcc1bbd08ef49a7dafb14fc2d 100644
--- a/src/sip/sipcall.h
+++ b/src/sip/sipcall.h
@@ -128,7 +128,7 @@ class SIPCall : public Call
 
         void setContactHeader(pj_str_t *contact);
 
-        void setTransport(std::shared_ptr<SipTransport> t);
+        void setTransport(const std::shared_ptr<SipTransport>& t);
 
         inline SipTransport* getTransport() {
             return transport_.get();
@@ -215,10 +215,10 @@ class SIPCall : public Call
 
         void terminateSipSession(int status);
 
-        virtual void merge(std::shared_ptr<Call> scall) {
+        virtual void merge(const std::shared_ptr<Call>& scall) {
             merge(std::dynamic_pointer_cast<SIPCall>(scall));
         }
-        virtual void merge(std::shared_ptr<SIPCall> scall);
+        virtual void merge(const std::shared_ptr<SIPCall>& scall);
 
         void setPeerRegistredName(const std::string& name) {
             peerRegistredName_ = name;
diff --git a/src/sip/siptransport.cpp b/src/sip/siptransport.cpp
index 47463c708c2b95ff077519d756f260ab57f718a5..c0860ae1b17017af3c1df3fffa386cf1bbb9d01b 100644
--- a/src/sip/siptransport.cpp
+++ b/src/sip/siptransport.cpp
@@ -418,7 +418,7 @@ SipTransportBroker::getTlsTransport(const std::shared_ptr<TlsListener>& l, const
 }
 
 std::shared_ptr<SipTransport>
-SipTransportBroker::getIceTransport(const std::shared_ptr<IceTransport> ice,
+SipTransportBroker::getIceTransport(const std::shared_ptr<IceTransport>& ice,
                                     unsigned comp_id)
 {
     auto sip_ice_tr = std::unique_ptr<SipIceTransport>(
@@ -437,7 +437,7 @@ SipTransportBroker::getIceTransport(const std::shared_ptr<IceTransport> ice,
 }
 
 std::shared_ptr<SipTransport>
-SipTransportBroker::getTlsIceTransport(const std::shared_ptr<ring::IceTransport> ice,
+SipTransportBroker::getTlsIceTransport(const std::shared_ptr<ring::IceTransport>& ice,
                                        unsigned comp_id,
                                        const tls::TlsParams& params)
 {
diff --git a/src/sip/siptransport.h b/src/sip/siptransport.h
index 91960372f3f76df24ca491073f540df02c50fef7..0605719a2c82a5c469c51e581e0088fe4e3f60e7 100644
--- a/src/sip/siptransport.h
+++ b/src/sip/siptransport.h
@@ -176,10 +176,10 @@ public:
     getTlsTransport(const std::shared_ptr<TlsListener>&, const IpAddr& remote, const std::string& remote_name = {});
 
     std::shared_ptr<SipTransport>
-    getIceTransport(const std::shared_ptr<IceTransport>, unsigned comp_id);
+    getIceTransport(const std::shared_ptr<IceTransport>&, unsigned comp_id);
 
     std::shared_ptr<SipTransport>
-    getTlsIceTransport(const std::shared_ptr<IceTransport>, unsigned comp_id,
+    getTlsIceTransport(const std::shared_ptr<IceTransport>&, unsigned comp_id,
                        const tls::TlsParams&);
 
     std::shared_ptr<SipTransport> addTransport(pjsip_transport*);