[clang-tidy] Apply performance-move-const-arg fixes.

This CL is a manual spin-off of [1], which tried to apply clang-tidy's
performance-move-const-arg [1] to the WebRTC codebase.

Since there are some wrong fixes to correct, this CL collects all the
fixes that could be landed as is.

[1] - https://webrtc-review.googlesource.com/c/src/+/120350
[2] - https://clang.llvm.org/extra/clang-tidy/checks/performance-move-const-arg.html

Bug: webrtc:10252
Change-Id: Ic4882213556344e65c66e27415e91ff6f89134d7
Reviewed-on: https://webrtc-review.googlesource.com/c/120814
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26515}
This commit is contained in:
Mirko Bonadei
2019-01-31 21:38:12 +01:00
committed by Commit Bot
parent 9e24fc2196
commit 05cf6be726
14 changed files with 26 additions and 26 deletions

View File

@ -51,7 +51,7 @@ void AudioDecoderOpus::AppendSupportedDecoders(
opus_info.supports_network_adaption = true;
SdpAudioFormat opus_format(
{"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}});
specs->push_back({std::move(opus_format), std::move(opus_info)});
specs->push_back({std::move(opus_format), opus_info});
}
std::unique_ptr<AudioDecoder> AudioDecoderOpus::MakeAudioDecoder(

View File

@ -124,7 +124,7 @@ RTCError MediaTransportPair::LoopbackMediaTransport::SendAudioFrame(
++stats_.sent_audio_frames;
}
invoker_.AsyncInvoke<void>(RTC_FROM_HERE, thread_, [this, channel_id, frame] {
other_->OnData(channel_id, std::move(frame));
other_->OnData(channel_id, frame);
});
return RTCError::OK();
}

View File

@ -125,7 +125,7 @@ void SimulatedNetwork::UpdateCapacityQueue(ConfigState state,
}
// Time to get this packet.
PacketInfo packet = std::move(capacity_link_.front());
PacketInfo packet = capacity_link_.front();
capacity_link_.pop();
time_us += time_until_front_exits_us;
@ -165,7 +165,7 @@ void SimulatedNetwork::UpdateCapacityQueue(ConfigState state,
needs_sort = true;
}
}
delay_link_.emplace_back(std::move(packet));
delay_link_.emplace_back(packet);
}
last_capacity_link_visit_us_ = time_now_us;
// Cannot save unused capacity for later.

View File

@ -82,8 +82,8 @@ std::unique_ptr<AudioEncoderOpusStates> CreateCodec(size_t num_channels) {
new MockSmoothingFilter());
states->mock_bitrate_smoother = bitrate_smoother.get();
states->encoder.reset(new AudioEncoderOpusImpl(
states->config, kDefaultOpusPayloadType, std::move(creator),
states->encoder.reset(
new AudioEncoderOpusImpl(states->config, kDefaultOpusPayloadType, creator,
std::move(bitrate_smoother)));
return states;
}

View File

@ -359,7 +359,7 @@ void PacedSender::Process() {
if (success) {
bytes_sent += packet->bytes;
// Send succeeded, remove it from the queue.
OnPacketSent(std::move(packet));
OnPacketSent(packet);
if (is_probing && bytes_sent > recommended_probe_size)
break;
} else {

View File

@ -275,7 +275,7 @@ RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp8(
if (codec_header.pictureId == kNoPictureId ||
codec_header.temporalIdx == kNoTemporalIdx ||
codec_header.tl0PicIdx == kNoTl0PicIdx) {
return ManageFramePidOrSeqNum(std::move(frame), codec_header.pictureId);
return ManageFramePidOrSeqNum(frame, codec_header.pictureId);
}
frame->id.picture_id = codec_header.pictureId % kPicIdLength;
@ -424,7 +424,7 @@ RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp9(
if (codec_header.picture_id == kNoPictureId ||
codec_header.temporal_idx == kNoTemporalIdx) {
return ManageFramePidOrSeqNum(std::move(frame), codec_header.picture_id);
return ManageFramePidOrSeqNum(frame, codec_header.picture_id);
}
frame->id.spatial_layer = codec_header.spatial_idx;

View File

@ -208,7 +208,7 @@ bool DtlsTransport::SetDtlsRole(rtc::SSLRole role) {
return true;
}
dtls_role_ = std::move(role);
dtls_role_ = role;
return true;
}

View File

@ -1381,7 +1381,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
webrtc::RtpParameters BitrateLimitedParameters(absl::optional<int> limit) {
webrtc::RtpParameters parameters;
webrtc::RtpEncodingParameters encoding;
encoding.max_bitrate_bps = std::move(limit);
encoding.max_bitrate_bps = limit;
parameters.encodings.push_back(encoding);
return parameters;
}

View File

@ -651,8 +651,8 @@ webrtc::RTCError JsepTransport::NegotiateDtlsRole(
// If local is passive, local will act as server.
}
*negotiated_dtls_role = (is_remote_server ? std::move(rtc::SSL_CLIENT)
: std::move(rtc::SSL_SERVER));
*negotiated_dtls_role =
(is_remote_server ? rtc::SSL_CLIENT : rtc::SSL_SERVER);
return webrtc::RTCError::OK();
}

View File

@ -3739,7 +3739,7 @@ void PeerConnection::CreateAudioReceiver(
auto receiver = RtpReceiverProxyWithInternal<RtpReceiverInternal>::Create(
signaling_thread(), audio_receiver);
GetAudioTransceiver()->internal()->AddReceiver(receiver);
Observer()->OnAddTrack(receiver, std::move(streams));
Observer()->OnAddTrack(receiver, streams);
NoteUsageEvent(UsageEvent::AUDIO_ADDED);
}
@ -3757,7 +3757,7 @@ void PeerConnection::CreateVideoReceiver(
auto receiver = RtpReceiverProxyWithInternal<RtpReceiverInternal>::Create(
signaling_thread(), video_receiver);
GetVideoTransceiver()->internal()->AddReceiver(receiver);
Observer()->OnAddTrack(receiver, std::move(streams));
Observer()->OnAddTrack(receiver, streams);
NoteUsageEvent(UsageEvent::VIDEO_ADDED);
}

View File

@ -239,8 +239,8 @@ class RtpSenderReceiverTest : public testing::Test,
void CreateAudioRtpReceiver(
std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams = {}) {
audio_rtp_receiver_ = new AudioRtpReceiver(
rtc::Thread::Current(), kAudioTrackId, std::move(streams));
audio_rtp_receiver_ =
new AudioRtpReceiver(rtc::Thread::Current(), kAudioTrackId, streams);
audio_rtp_receiver_->SetMediaChannel(voice_media_channel_);
audio_rtp_receiver_->SetupMediaChannel(kAudioSsrc);
audio_track_ = audio_rtp_receiver_->audio_track();
@ -249,8 +249,8 @@ class RtpSenderReceiverTest : public testing::Test,
void CreateVideoRtpReceiver(
std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams = {}) {
video_rtp_receiver_ = new VideoRtpReceiver(
rtc::Thread::Current(), kVideoTrackId, std::move(streams));
video_rtp_receiver_ =
new VideoRtpReceiver(rtc::Thread::Current(), kVideoTrackId, streams);
video_rtp_receiver_->SetMediaChannel(video_media_channel_);
video_rtp_receiver_->SetupMediaChannel(kVideoSsrc);
video_track_ = video_rtp_receiver_->video_track();
@ -269,8 +269,8 @@ class RtpSenderReceiverTest : public testing::Test,
video_media_channel_->AddRecvStream(stream_params);
uint32_t primary_ssrc = stream_params.first_ssrc();
video_rtp_receiver_ = new VideoRtpReceiver(
rtc::Thread::Current(), kVideoTrackId, std::move(streams));
video_rtp_receiver_ =
new VideoRtpReceiver(rtc::Thread::Current(), kVideoTrackId, streams);
video_rtp_receiver_->SetMediaChannel(video_media_channel_);
video_rtp_receiver_->SetupMediaChannel(primary_ssrc);
video_track_ = video_rtp_receiver_->video_track();

View File

@ -86,7 +86,7 @@ class SignalObserver : public sigslot::has_slots<> {
absl::optional<rtc::NetworkRoute> network_route() { return network_route_; }
void OnNetworkRouteChanged(absl::optional<rtc::NetworkRoute> network_route) {
network_route_ = std::move(network_route);
network_route_ = network_route;
}
void OnSentPacket(rtc::PacketTransportInternal* packet_transport,

View File

@ -45,7 +45,7 @@ EncodedImage SingleProcessEncodedImageIdInjector::InjectId(
// Will create new one if missed.
ExtractionInfoVector& ev = extraction_cache_[id];
info.sub_id = ev.next_sub_id++;
ev.infos[info.sub_id] = std::move(info);
ev.infos[info.sub_id] = info;
}
EncodedImage out = source;
@ -83,7 +83,7 @@ EncodedImageWithId SingleProcessEncodedImageIdInjector::ExtractId(
auto info_it = ext_vector_it->second.infos.find(sub_id);
RTC_CHECK(info_it != ext_vector_it->second.infos.end())
<< "Unknown sub id " << sub_id << " for frame " << next_id;
info = std::move(info_it->second);
info = info_it->second;
ext_vector_it->second.infos.erase(info_it);
}

View File

@ -247,7 +247,7 @@ class RtpReplayer final {
const std::string& rtp_dump_path) {
webrtc::RtcEventLogNullImpl event_log;
Call::Config call_config(&event_log);
std::unique_ptr<Call> call(Call::Create(std::move(call_config)));
std::unique_ptr<Call> call(Call::Create(call_config));
std::unique_ptr<StreamState> stream_state;
// Attempt to load the configuration
if (replay_config_path.empty()) {