[clang-tidy] Apply performance-move-const-arg fixes (mutable lambdas).
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 were some wrong fixes to correct, this CL lands all the
manual fixes where std::move was actually fine but the lambda was not
mutable.
[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: I4602e3d4a63d2637dd389e775ffbf80fe95f40fc
Reviewed-on: https://webrtc-review.googlesource.com/c/120927
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26532}
diff --git a/api/test/loopback_media_transport.cc b/api/test/loopback_media_transport.cc
index 5b75e40..c466170 100644
--- a/api/test/loopback_media_transport.cc
+++ b/api/test/loopback_media_transport.cc
@@ -140,7 +140,7 @@
MediaTransportEncodedVideoFrame frame_copy = frame;
frame_copy.Retain();
invoker_.AsyncInvoke<void>(
- RTC_FROM_HERE, thread_, [this, channel_id, frame_copy] {
+ RTC_FROM_HERE, thread_, [this, channel_id, frame_copy]() mutable {
other_->OnData(channel_id, std::move(frame_copy));
});
return RTCError::OK();
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index d2f6ee2..00e48a6 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -1235,7 +1235,7 @@
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
rtc::CritScope cs(&encoder_queue_lock_);
if (encoder_queue_is_active_) {
- encoder_queue_->PostTask([this, frame_encryptor]() {
+ encoder_queue_->PostTask([this, frame_encryptor]() mutable {
this->frame_encryptor_ = std::move(frame_encryptor);
});
} else {
diff --git a/test/scenario/quality_stats.cc b/test/scenario/quality_stats.cc
index 3b2bb50..4a42582 100644
--- a/test/scenario/quality_stats.cc
+++ b/test/scenario/quality_stats.cc
@@ -39,7 +39,7 @@
void VideoQualityAnalyzer::OnCapturedFrame(const VideoFrame& frame) {
VideoFrame copy = frame;
- task_queue_.PostTask([this, copy] {
+ task_queue_.PostTask([this, copy]() mutable {
if (!first_capture_ntp_time_ms_)
first_capture_ntp_time_ms_ = copy.ntp_time_ms();
captured_frames_.push_back(std::move(copy));
diff --git a/video/video_send_stream_impl.cc b/video/video_send_stream_impl.cc
index 266d27f..5d60a41 100644
--- a/video/video_send_stream_impl.cc
+++ b/video/video_send_stream_impl.cc
@@ -513,13 +513,13 @@
int min_transmit_bitrate_bps) {
if (!worker_queue_->IsCurrent()) {
rtc::WeakPtr<VideoSendStreamImpl> send_stream = weak_ptr_;
- worker_queue_->PostTask(
- [send_stream, streams, content_type, min_transmit_bitrate_bps]() {
- if (send_stream) {
- send_stream->OnEncoderConfigurationChanged(
- std::move(streams), content_type, min_transmit_bitrate_bps);
- }
- });
+ worker_queue_->PostTask([send_stream, streams, content_type,
+ min_transmit_bitrate_bps]() mutable {
+ if (send_stream) {
+ send_stream->OnEncoderConfigurationChanged(
+ std::move(streams), content_type, min_transmit_bitrate_bps);
+ }
+ });
return;
}
RTC_DCHECK_GE(config_->rtp.ssrcs.size(), streams.size());