Fixing unspecified evaluation order of std:move(), to avoid future issues.

This will be done by splitting the use of variables values prior to performing std:move

Bug: webrtc:15771
Change-Id: Ia88e733c3a4edf729e440295ae271d3cd9926ec5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334461
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41532}
This commit is contained in:
Tal Benesh 2024-01-15 03:43:03 -08:00 committed by WebRTC LUCI CQ
parent 5aaa9ed41e
commit e126e45403
3 changed files with 8 additions and 7 deletions

View file

@ -373,8 +373,9 @@ void RRSendQueue::Add(Timestamp now,
: Timestamp::PlusInfinity(), : Timestamp::PlusInfinity(),
.lifecycle_id = send_options.lifecycle_id, .lifecycle_id = send_options.lifecycle_id,
}; };
GetOrCreateStreamInfo(message.stream_id()) StreamID stream_id = message.stream_id();
.Add(std::move(message), std::move(attributes)); GetOrCreateStreamInfo(stream_id).Add(std::move(message),
std::move(attributes));
RTC_DCHECK(IsConsistent()); RTC_DCHECK(IsConsistent());
} }

View file

@ -214,7 +214,8 @@ StunDictionaryView::ApplyDelta(const StunByteStringAttribute& delta) {
if (attr->value_type() == STUN_VALUE_BYTE_STRING && attr->length() == 0) { if (attr->value_type() == STUN_VALUE_BYTE_STRING && attr->length() == 0) {
attrs_.erase(attr->type()); attrs_.erase(attr->type());
} else { } else {
attrs_[attr->type()] = std::move(attr); int attribute_type = attr->type();
attrs_[attribute_type] = std::move(attr);
} }
} }
} }

View file

@ -336,10 +336,9 @@ TEST_P(SvcTest, ScalabilityModeSupported) {
RtpEncodingParameters parameters; RtpEncodingParameters parameters;
parameters.scalability_mode = SvcTestParameters().scalability_mode; parameters.scalability_mode = SvcTestParameters().scalability_mode;
video.encoding_params.push_back(parameters); video.encoding_params.push_back(parameters);
alice->AddVideoConfig( auto generator = CreateScreenShareFrameGenerator(
std::move(video), video, ScreenShareConfig(TimeDelta::Seconds(5)));
CreateScreenShareFrameGenerator( alice->AddVideoConfig(std::move(video), std::move(generator));
video, ScreenShareConfig(TimeDelta::Seconds(5))));
alice->SetVideoCodecs({video_codec_config}); alice->SetVideoCodecs({video_codec_config});
}, },
[](PeerConfigurer* bob) {}, std::move(analyzer)); [](PeerConfigurer* bob) {}, std::move(analyzer));