Use absl::c_any_of instead of a manual for-loop to finding an active encoding

Bug: webrtc:11319
Change-Id: I00eff8dd1d595570b9b2798a27514ec16fde4bf0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168646
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Oskar Segersvärd <oseg@google.com>
Cr-Commit-Position: refs/heads/master@{#30538}
This commit is contained in:
Oskar Segersvärd
2020-02-17 17:49:04 +01:00
committed by Commit Bot
parent 0e57858fa9
commit 06901cfb04

View File

@ -2148,11 +2148,9 @@ void WebRtcVideoChannel::WebRtcVideoSendStream::UpdateSendState() {
// SVC is used.
// The only present simulcast layer should be active if any of the
// configured SVC layers is active.
bool is_active = false;
for (size_t i = 0; i < rtp_parameters_.encodings.size(); ++i) {
is_active |= rtp_parameters_.encodings[i].active;
}
active_layers[0] = is_active;
active_layers[0] =
absl::c_any_of(rtp_parameters_.encodings,
[](const auto& encoding) { return encoding.active; });
}
// This updates what simulcast layers are sending, and possibly starts
// or stops the VideoSendStream.