Use Abseil container algorithms in a couple places in media/

Bug: None
Change-Id: I14e02f063fa2fd29305907f07ea4e5af58952305
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130261
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27352}
This commit is contained in:
Steve Anton 2019-03-28 11:04:59 -07:00 committed by Commit Bot
parent f19f5bc564
commit b118d42849
2 changed files with 8 additions and 7 deletions

View File

@ -9,6 +9,8 @@
*/
#include "media/engine/unhandled_packets_buffer.h"
#include "absl/algorithm/container.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
@ -53,7 +55,7 @@ void UnhandledPacketsBuffer::BackfillPackets(
// One or maybe 2 ssrcs is expected => loop array instead of more elaborate
// scheme.
const uint32_t ssrc = buffer_[pos].ssrc;
if (std::find(ssrcs.begin(), ssrcs.end(), ssrc) != ssrcs.end()) {
if (absl::c_linear_search(ssrcs, ssrc)) {
++count;
consumer(ssrc, buffer_[pos].packet_time_us, buffer_[pos].packet);
} else {

View File

@ -16,6 +16,7 @@
#include <string>
#include <utility>
#include "absl/algorithm/container.h"
#include "absl/strings/match.h"
#include "api/video/video_codec_constants.h"
#include "api/video_codecs/sdp_video_format.h"
@ -2860,12 +2861,10 @@ std::vector<webrtc::VideoStream> EncoderStreamFactory::CreateEncoderStreams(
const int max_framerate = GetMaxFramerate(encoder_config, layers.size());
// Update the active simulcast layers and configured bitrates.
bool is_highest_layer_max_bitrate_configured = false;
const bool has_scale_resolution_down_by =
std::any_of(encoder_config.simulcast_layers.begin(),
encoder_config.simulcast_layers.end(),
[](const webrtc::VideoStream& layer) {
return layer.scale_resolution_down_by != -1.;
});
const bool has_scale_resolution_down_by = absl::c_any_of(
encoder_config.simulcast_layers, [](const webrtc::VideoStream& layer) {
return layer.scale_resolution_down_by != -1.;
});
const int normalized_width =
NormalizeSimulcastSize(width, encoder_config.number_of_streams);
const int normalized_height =