Format almost everything.
This CL was generated by running git ls-files | grep -P "(\.h|\.cc)$" | grep -v 'sdk/' | grep -v 'rtc_base/ssl_' | \ grep -v 'fake_rtc_certificate_generator.h' | grep -v 'modules/audio_device/win/' | \ grep -v 'system_wrappers/source/clock.cc' | grep -v 'rtc_base/trace_event.h' | \ grep -v 'modules/audio_coding/codecs/ilbc/' | grep -v 'screen_capturer_mac.h' | \ grep -v 'spl_inl_mips.h' | grep -v 'data_size_unittest.cc' | grep -v 'timestamp_unittest.cc' \ | xargs clang-format -i ; git cl format Most of these changes are clang-format grouping and reordering includes differently. Bug: webrtc:9340 Change-Id: Ic83ddbc169bfacd21883e381b5181c3dd4fe8a63 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144051 Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28505}
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
// Unit tests for PacketBuffer class.
|
||||
|
||||
#include "modules/audio_coding/neteq/packet_buffer.h"
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "modules/audio_coding/neteq/mock/mock_decoder_database.h"
|
||||
@ -20,11 +21,11 @@
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
using ::testing::Return;
|
||||
using ::testing::StrictMock;
|
||||
using ::testing::_;
|
||||
using ::testing::InSequence;
|
||||
using ::testing::MockFunction;
|
||||
using ::testing::Return;
|
||||
using ::testing::StrictMock;
|
||||
|
||||
namespace {
|
||||
class MockEncodedAudioFrame : public webrtc::AudioDecoder::EncodedAudioFrame {
|
||||
@ -54,12 +55,16 @@ class PacketGenerator {
|
||||
int frame_size_;
|
||||
};
|
||||
|
||||
PacketGenerator::PacketGenerator(uint16_t seq_no, uint32_t ts, uint8_t pt,
|
||||
PacketGenerator::PacketGenerator(uint16_t seq_no,
|
||||
uint32_t ts,
|
||||
uint8_t pt,
|
||||
int frame_size) {
|
||||
Reset(seq_no, ts, pt, frame_size);
|
||||
}
|
||||
|
||||
void PacketGenerator::Reset(uint16_t seq_no, uint32_t ts, uint8_t pt,
|
||||
void PacketGenerator::Reset(uint16_t seq_no,
|
||||
uint32_t ts,
|
||||
uint8_t pt,
|
||||
int frame_size) {
|
||||
seq_no_ = seq_no;
|
||||
ts_ = ts;
|
||||
@ -211,7 +216,7 @@ TEST(PacketBuffer, InsertPacketList) {
|
||||
¤t_cng_pt, &mock_stats));
|
||||
EXPECT_TRUE(list.empty()); // The PacketBuffer should have depleted the list.
|
||||
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(0, current_pt); // Current payload type changed to 0.
|
||||
EXPECT_EQ(0, current_pt); // Current payload type changed to 0.
|
||||
EXPECT_EQ(absl::nullopt, current_cng_pt); // CNG payload type not changed.
|
||||
|
||||
buffer.Flush(); // Clean up.
|
||||
@ -260,7 +265,7 @@ TEST(PacketBuffer, InsertPacketListChangePayloadType) {
|
||||
¤t_cng_pt, &mock_stats));
|
||||
EXPECT_TRUE(list.empty()); // The PacketBuffer should have depleted the list.
|
||||
EXPECT_EQ(1u, buffer.NumPacketsInBuffer()); // Only the last packet.
|
||||
EXPECT_EQ(1, current_pt); // Current payload type changed to 1.
|
||||
EXPECT_EQ(1, current_pt); // Current payload type changed to 1.
|
||||
EXPECT_EQ(absl::nullopt, current_cng_pt); // CNG payload type not changed.
|
||||
|
||||
buffer.Flush(); // Clean up.
|
||||
@ -276,24 +281,15 @@ TEST(PacketBuffer, ExtractOrderRedundancy) {
|
||||
const int kPayloadLength = 10;
|
||||
|
||||
PacketsToInsert packet_facts[kPackets] = {
|
||||
{0xFFFD, 0xFFFFFFD7, 0, true, 0},
|
||||
{0xFFFE, 0xFFFFFFE1, 0, true, 1},
|
||||
{0xFFFE, 0xFFFFFFD7, 1, false, -1},
|
||||
{0xFFFF, 0xFFFFFFEB, 0, true, 2},
|
||||
{0xFFFF, 0xFFFFFFE1, 1, false, -1},
|
||||
{0x0000, 0xFFFFFFF5, 0, true, 3},
|
||||
{0x0000, 0xFFFFFFEB, 1, false, -1},
|
||||
{0x0001, 0xFFFFFFFF, 0, true, 4},
|
||||
{0x0001, 0xFFFFFFF5, 1, false, -1},
|
||||
{0x0002, 0x0000000A, 0, true, 5},
|
||||
{0x0002, 0xFFFFFFFF, 1, false, -1},
|
||||
{0x0003, 0x0000000A, 1, false, -1},
|
||||
{0x0004, 0x0000001E, 0, true, 7},
|
||||
{0x0004, 0x00000014, 1, false, 6},
|
||||
{0x0005, 0x0000001E, 0, true, -1},
|
||||
{0x0005, 0x00000014, 1, false, -1},
|
||||
{0x0006, 0x00000028, 0, true, 8},
|
||||
{0x0006, 0x0000001E, 1, false, -1},
|
||||
{0xFFFD, 0xFFFFFFD7, 0, true, 0}, {0xFFFE, 0xFFFFFFE1, 0, true, 1},
|
||||
{0xFFFE, 0xFFFFFFD7, 1, false, -1}, {0xFFFF, 0xFFFFFFEB, 0, true, 2},
|
||||
{0xFFFF, 0xFFFFFFE1, 1, false, -1}, {0x0000, 0xFFFFFFF5, 0, true, 3},
|
||||
{0x0000, 0xFFFFFFEB, 1, false, -1}, {0x0001, 0xFFFFFFFF, 0, true, 4},
|
||||
{0x0001, 0xFFFFFFF5, 1, false, -1}, {0x0002, 0x0000000A, 0, true, 5},
|
||||
{0x0002, 0xFFFFFFFF, 1, false, -1}, {0x0003, 0x0000000A, 1, false, -1},
|
||||
{0x0004, 0x0000001E, 0, true, 7}, {0x0004, 0x00000014, 1, false, 6},
|
||||
{0x0005, 0x0000001E, 0, true, -1}, {0x0005, 0x00000014, 1, false, -1},
|
||||
{0x0006, 0x00000028, 0, true, 8}, {0x0006, 0x0000001E, 1, false, -1},
|
||||
};
|
||||
|
||||
const size_t kExpectPacketsInBuffer = 9;
|
||||
@ -310,10 +306,8 @@ TEST(PacketBuffer, ExtractOrderRedundancy) {
|
||||
InSequence s;
|
||||
MockFunction<void(int check_point_id)> check;
|
||||
for (int i = 0; i < kPackets; ++i) {
|
||||
gen.Reset(packet_facts[i].sequence_number,
|
||||
packet_facts[i].timestamp,
|
||||
packet_facts[i].payload_type,
|
||||
kFrameSize);
|
||||
gen.Reset(packet_facts[i].sequence_number, packet_facts[i].timestamp,
|
||||
packet_facts[i].payload_type, kFrameSize);
|
||||
Packet packet = gen.NextPacket(kPayloadLength, nullptr);
|
||||
packet.priority.codec_level = packet_facts[i].primary ? 0 : 1;
|
||||
if (packet_facts[i].extract_order < 0) {
|
||||
@ -495,7 +489,7 @@ TEST(PacketBuffer, CngFirstThenSpeechWithNewSampleRate) {
|
||||
ASSERT_TRUE(buffer.PeekNextPacket());
|
||||
EXPECT_EQ(kCngPt, buffer.PeekNextPacket()->payload_type);
|
||||
EXPECT_EQ(current_pt, absl::nullopt); // Current payload type not set.
|
||||
EXPECT_EQ(kCngPt, current_cng_pt); // CNG payload type set.
|
||||
EXPECT_EQ(kCngPt, current_cng_pt); // CNG payload type set.
|
||||
|
||||
// Insert second packet, which is wide-band speech.
|
||||
{
|
||||
@ -513,7 +507,7 @@ TEST(PacketBuffer, CngFirstThenSpeechWithNewSampleRate) {
|
||||
ASSERT_TRUE(buffer.PeekNextPacket());
|
||||
EXPECT_EQ(kSpeechPt, buffer.PeekNextPacket()->payload_type);
|
||||
|
||||
EXPECT_EQ(kSpeechPt, current_pt); // Current payload type set.
|
||||
EXPECT_EQ(kSpeechPt, current_pt); // Current payload type set.
|
||||
EXPECT_EQ(absl::nullopt, current_cng_pt); // CNG payload type reset.
|
||||
|
||||
buffer.Flush(); // Clean up.
|
||||
@ -752,11 +746,11 @@ void TestIsObsoleteTimestamp(uint32_t limit_timestamp) {
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp, limit_timestamp, kZeroHorizon));
|
||||
// 1 sample behind is old.
|
||||
EXPECT_TRUE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp - 1, limit_timestamp, kZeroHorizon));
|
||||
EXPECT_TRUE(PacketBuffer::IsObsoleteTimestamp(limit_timestamp - 1,
|
||||
limit_timestamp, kZeroHorizon));
|
||||
// 2^31 - 1 samples behind is old.
|
||||
EXPECT_TRUE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp - k2Pow31Minus1, limit_timestamp, kZeroHorizon));
|
||||
EXPECT_TRUE(PacketBuffer::IsObsoleteTimestamp(limit_timestamp - k2Pow31Minus1,
|
||||
limit_timestamp, kZeroHorizon));
|
||||
// 1 sample ahead is not old.
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp + 1, limit_timestamp, kZeroHorizon));
|
||||
@ -772,26 +766,26 @@ void TestIsObsoleteTimestamp(uint32_t limit_timestamp) {
|
||||
// Fixed horizon at 10 samples.
|
||||
static const uint32_t kHorizon = 10;
|
||||
// Timestamp on the limit is not old.
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp, limit_timestamp, kHorizon));
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(limit_timestamp,
|
||||
limit_timestamp, kHorizon));
|
||||
// 1 sample behind is old.
|
||||
EXPECT_TRUE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp - 1, limit_timestamp, kHorizon));
|
||||
EXPECT_TRUE(PacketBuffer::IsObsoleteTimestamp(limit_timestamp - 1,
|
||||
limit_timestamp, kHorizon));
|
||||
// 9 samples behind is old.
|
||||
EXPECT_TRUE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp - 9, limit_timestamp, kHorizon));
|
||||
EXPECT_TRUE(PacketBuffer::IsObsoleteTimestamp(limit_timestamp - 9,
|
||||
limit_timestamp, kHorizon));
|
||||
// 10 samples behind is not old.
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp - 10, limit_timestamp, kHorizon));
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(limit_timestamp - 10,
|
||||
limit_timestamp, kHorizon));
|
||||
// 2^31 - 1 samples behind is not old.
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp - k2Pow31Minus1, limit_timestamp, kHorizon));
|
||||
// 1 sample ahead is not old.
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp + 1, limit_timestamp, kHorizon));
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(limit_timestamp + 1,
|
||||
limit_timestamp, kHorizon));
|
||||
// 2^31 samples ahead is not old.
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(
|
||||
limit_timestamp + (1 << 31), limit_timestamp, kHorizon));
|
||||
EXPECT_FALSE(PacketBuffer::IsObsoleteTimestamp(limit_timestamp + (1 << 31),
|
||||
limit_timestamp, kHorizon));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user