Fixing some clang-tidy findings.
Bug: None
Change-Id: I949c1ff35284ce79c99e8f76148f63b8bba965a9
Reviewed-on: https://webrtc-review.googlesource.com/24041
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20818}
diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc
index 52cb419..36a6b57 100644
--- a/pc/channel_unittest.cc
+++ b/pc/channel_unittest.cc
@@ -9,6 +9,7 @@
*/
#include <memory>
+#include <utility>
#include "api/array_view.h"
#include "media/base/fakemediaengine.h"
@@ -1848,7 +1849,7 @@
webrtc::RtpParameters BitrateLimitedParameters(rtc::Optional<int> limit) {
webrtc::RtpParameters parameters;
webrtc::RtpEncodingParameters encoding;
- encoding.max_bitrate_bps = limit;
+ encoding.max_bitrate_bps = std::move(limit);
parameters.encodings.push_back(encoding);
return parameters;
}
diff --git a/pc/peerconnection_integrationtest.cc b/pc/peerconnection_integrationtest.cc
index 90aad09..8ce692e 100644
--- a/pc/peerconnection_integrationtest.cc
+++ b/pc/peerconnection_integrationtest.cc
@@ -28,6 +28,7 @@
#include "api/mediastreaminterface.h"
#include "api/peerconnectioninterface.h"
#include "api/peerconnectionproxy.h"
+#include "api/rtpreceiverinterface.h"
#include "api/test/fakeconstraints.h"
#include "media/engine/fakewebrtcvideoengine.h"
#include "p2p/base/p2pconstants.h"
@@ -80,6 +81,7 @@
using webrtc::PeerConnectionInterface;
using webrtc::PeerConnectionFactory;
using webrtc::PeerConnectionProxy;
+using webrtc::RtpReceiverInterface;
using webrtc::SessionDescriptionInterface;
using webrtc::StreamCollectionInterface;
@@ -276,14 +278,14 @@
// generate, but a non-JSEP endpoint might.
void SetReceivedSdpMunger(
std::function<void(cricket::SessionDescription*)> munger) {
- received_sdp_munger_ = munger;
+ received_sdp_munger_ = std::move(munger);
}
// Similar to the above, but this is run on SDP immediately after it's
// generated.
void SetGeneratedSdpMunger(
std::function<void(cricket::SessionDescription*)> munger) {
- generated_sdp_munger_ = munger;
+ generated_sdp_munger_ = std::move(munger);
}
// Every ICE connection state in order that has been seen by the observer.
@@ -343,8 +345,8 @@
}
void AddMediaStreamFromTracks(
- rtc::scoped_refptr<webrtc::AudioTrackInterface> audio,
- rtc::scoped_refptr<webrtc::VideoTrackInterface> video) {
+ const rtc::scoped_refptr<webrtc::AudioTrackInterface>& audio,
+ const rtc::scoped_refptr<webrtc::VideoTrackInterface>& video) {
rtc::scoped_refptr<MediaStreamInterface> stream =
peer_connection_factory_->CreateLocalMediaStream(
rtc::CreateRandomUuid());
@@ -553,7 +555,8 @@
void ResetRtpReceiverObservers() {
rtp_receiver_observers_.clear();
- for (auto receiver : pc()->GetReceivers()) {
+ for (const rtc::scoped_refptr<RtpReceiverInterface>& receiver :
+ pc()->GetReceivers()) {
std::unique_ptr<MockRtpReceiverObserver> observer(
new MockRtpReceiverObserver(receiver->media_type()));
receiver->SetObserver(observer.get());
@@ -723,7 +726,7 @@
}
std::unique_ptr<SessionDescriptionInterface> WaitForDescriptionFromObserver(
- rtc::scoped_refptr<MockCreateSessionDescriptionObserver> observer) {
+ MockCreateSessionDescriptionObserver* observer) {
EXPECT_EQ_WAIT(true, observer->called(), kDefaultTimeout);
if (!observer->result()) {
return nullptr;
diff --git a/pc/peerconnectionendtoend_unittest.cc b/pc/peerconnectionendtoend_unittest.cc
index dce69da..8b16610 100644
--- a/pc/peerconnectionendtoend_unittest.cc
+++ b/pc/peerconnectionendtoend_unittest.cc
@@ -73,10 +73,11 @@
#endif
}
- void CreatePcs(
- const MediaConstraintsInterface* pc_constraints,
- rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
- rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) {
+ void CreatePcs(const MediaConstraintsInterface* pc_constraints,
+ const rtc::scoped_refptr<webrtc::AudioEncoderFactory>&
+ audio_encoder_factory,
+ const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
+ audio_decoder_factory) {
EXPECT_TRUE(caller_->CreatePc(
pc_constraints, config_, audio_encoder_factory, audio_decoder_factory));
EXPECT_TRUE(callee_->CreatePc(
@@ -95,8 +96,10 @@
GetAndAddUserMedia(true, audio_constraints, true, video_constraints);
}
- void GetAndAddUserMedia(bool audio, FakeConstraints audio_constraints,
- bool video, FakeConstraints video_constraints) {
+ void GetAndAddUserMedia(bool audio,
+ const FakeConstraints& audio_constraints,
+ bool video,
+ const FakeConstraints& video_constraints) {
caller_->GetAndAddUserMedia(audio, audio_constraints,
video, video_constraints);
callee_->GetAndAddUserMedia(audio, audio_constraints,
diff --git a/pc/peerconnectioninterface_unittest.cc b/pc/peerconnectioninterface_unittest.cc
index 409fa91..389aaeb 100644
--- a/pc/peerconnectioninterface_unittest.cc
+++ b/pc/peerconnectioninterface_unittest.cc
@@ -653,8 +653,9 @@
CreatePeerConnection(config, nullptr);
}
- void CreatePeerConnection(PeerConnectionInterface::RTCConfiguration config,
- webrtc::MediaConstraintsInterface* constraints) {
+ void CreatePeerConnection(
+ const PeerConnectionInterface::RTCConfiguration& config,
+ webrtc::MediaConstraintsInterface* constraints) {
std::unique_ptr<cricket::FakePortAllocator> port_allocator(
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr));
port_allocator_ = port_allocator.get();
diff --git a/pc/rtcstats_integrationtest.cc b/pc/rtcstats_integrationtest.cc
index 3da1083..d0a5863 100644
--- a/pc/rtcstats_integrationtest.cc
+++ b/pc/rtcstats_integrationtest.cc
@@ -267,7 +267,7 @@
valid_reference = true;
const RTCStatsMember<std::vector<std::string>>& ids =
member.cast_to<RTCStatsMember<std::vector<std::string>>>();
- for (const std::string id : *ids) {
+ for (const std::string& id : *ids) {
const RTCStats* referenced_stats = report_->Get(id);
if (!referenced_stats || referenced_stats->type() != expected_type) {
valid_reference = false;
diff --git a/pc/rtcstatscollector_unittest.cc b/pc/rtcstatscollector_unittest.cc
index 4b24214..d088221 100644
--- a/pc/rtcstatscollector_unittest.cc
+++ b/pc/rtcstatscollector_unittest.cc
@@ -235,7 +235,8 @@
}
rtc::scoped_refptr<MockRtpSender> CreateMockSender(
- rtc::scoped_refptr<MediaStreamTrackInterface> track, uint32_t ssrc) {
+ const rtc::scoped_refptr<MediaStreamTrackInterface>& track,
+ uint32_t ssrc) {
rtc::scoped_refptr<MockRtpSender> sender(
new rtc::RefCountedObject<MockRtpSender>());
EXPECT_CALL(*sender, track()).WillRepeatedly(Return(track));
@@ -254,7 +255,8 @@
}
rtc::scoped_refptr<MockRtpReceiver> CreateMockReceiver(
- rtc::scoped_refptr<MediaStreamTrackInterface> track, uint32_t ssrc) {
+ const rtc::scoped_refptr<MediaStreamTrackInterface>& track,
+ uint32_t ssrc) {
rtc::scoped_refptr<MockRtpReceiver> receiver(
new rtc::RefCountedObject<MockRtpReceiver>());
EXPECT_CALL(*receiver, track()).WillRepeatedly(Return(track));
diff --git a/pc/rtpsenderreceiver_unittest.cc b/pc/rtpsenderreceiver_unittest.cc
index f40b494..7ea4d4c 100644
--- a/pc/rtpsenderreceiver_unittest.cc
+++ b/pc/rtpsenderreceiver_unittest.cc
@@ -129,7 +129,8 @@
void CreateAudioRtpSender() { CreateAudioRtpSender(nullptr); }
- void CreateAudioRtpSender(rtc::scoped_refptr<LocalAudioSource> source) {
+ void CreateAudioRtpSender(
+ const rtc::scoped_refptr<LocalAudioSource>& source) {
audio_track_ = AudioTrack::Create(kAudioTrackId, source);
EXPECT_TRUE(local_stream_->AddTrack(audio_track_));
audio_rtp_sender_ =
diff --git a/pc/rtptransport_unittest.cc b/pc/rtptransport_unittest.cc
index d6eb336..3876aa3 100644
--- a/pc/rtptransport_unittest.cc
+++ b/pc/rtptransport_unittest.cc
@@ -9,6 +9,7 @@
*/
#include <string>
+#include <utility>
#include "p2p/base/fakepackettransport.h"
#include "pc/rtptransport.h"
@@ -69,7 +70,7 @@
rtc::Optional<rtc::NetworkRoute> network_route() { return network_route_; }
void OnNetworkRouteChanged(rtc::Optional<rtc::NetworkRoute> network_route) {
- network_route_ = network_route;
+ network_route_ = std::move(network_route);
}
private:
diff --git a/pc/statscollector_unittest.cc b/pc/statscollector_unittest.cc
index 2211f3f..d5bc0ff 100644
--- a/pc/statscollector_unittest.cc
+++ b/pc/statscollector_unittest.cc
@@ -242,12 +242,12 @@
return nullptr;
}
-std::string ExtractSsrcStatsValue(StatsReports reports,
+std::string ExtractSsrcStatsValue(const StatsReports& reports,
StatsReport::StatsValueName name) {
return ExtractStatsValue(StatsReport::kStatsReportTypeSsrc, reports, name);
}
-std::string ExtractBweStatsValue(StatsReports reports,
+std::string ExtractBweStatsValue(const StatsReports& reports,
StatsReport::StatsValueName name) {
return ExtractStatsValue(
StatsReport::kStatsReportTypeBwe, reports, name);
diff --git a/pc/trackmediainfomap_unittest.cc b/pc/trackmediainfomap_unittest.cc
index 4f71d3b..9f25646 100644
--- a/pc/trackmediainfomap_unittest.cc
+++ b/pc/trackmediainfomap_unittest.cc
@@ -53,7 +53,8 @@
}
rtc::scoped_refptr<MockRtpSender> sender(
new rtc::RefCountedObject<MockRtpSender>());
- EXPECT_CALL(*sender, track()).WillRepeatedly(testing::Return(track));
+ EXPECT_CALL(*sender, track())
+ .WillRepeatedly(testing::Return(std::move(track)));
EXPECT_CALL(*sender, ssrc()).WillRepeatedly(testing::Return(first_ssrc));
EXPECT_CALL(*sender, media_type())
.WillRepeatedly(testing::Return(media_type));
@@ -68,7 +69,8 @@
rtc::scoped_refptr<MediaStreamTrackInterface> track) {
rtc::scoped_refptr<MockRtpReceiver> receiver(
new rtc::RefCountedObject<MockRtpReceiver>());
- EXPECT_CALL(*receiver, track()).WillRepeatedly(testing::Return(track));
+ EXPECT_CALL(*receiver, track())
+ .WillRepeatedly(testing::Return(std::move(track)));
EXPECT_CALL(*receiver, media_type())
.WillRepeatedly(testing::Return(media_type));
EXPECT_CALL(*receiver, GetParameters())