Use Abseil container algorithms in modules/rtp_rtcp/

Bug: None
Change-Id: Ica2e9795ec6195e044403f5ee25e476f6c47cf93
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/129600
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27361}
This commit is contained in:
Steve Anton
2019-03-28 10:56:11 -07:00
committed by Commit Bot
parent c90e81e2d9
commit 91c2606ca1
8 changed files with 32 additions and 35 deletions

View File

@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <algorithm>
#include <list>
#include <memory>
#include "absl/algorithm/container.h"
#include "modules/rtp_rtcp/source/byte_io.h"
#include "modules/rtp_rtcp/source/fec_test_helper.h"
#include "modules/rtp_rtcp/source/flexfec_header_reader_writer.h"
@ -148,14 +148,10 @@ void RtpFecTest<ForwardErrorCorrectionType>::ReceivedPackets(
template <typename ForwardErrorCorrectionType>
bool RtpFecTest<ForwardErrorCorrectionType>::IsRecoveryComplete() {
// We must have equally many recovered packets as original packets.
if (recovered_packets_.size() != media_packets_.size()) {
return false;
}
// All recovered packets must be identical to the corresponding
// original packets.
auto cmp =
// We must have equally many recovered packets as original packets and all
// recovered packets must be identical to the corresponding original packets.
return absl::c_equal(
media_packets_, recovered_packets_,
[](const std::unique_ptr<ForwardErrorCorrection::Packet>& media_packet,
const std::unique_ptr<ForwardErrorCorrection::RecoveredPacket>&
recovered_packet) {
@ -167,9 +163,7 @@ bool RtpFecTest<ForwardErrorCorrectionType>::IsRecoveryComplete() {
return false;
}
return true;
};
return std::equal(media_packets_.cbegin(), media_packets_.cend(),
recovered_packets_.cbegin(), cmp);
});
}
// Define gTest typed test to loop over both ULPFEC and FlexFEC.