Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t. This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects. This was be reviewed and approved in pieces: https://codereview.webrtc.org/1224093003 https://codereview.webrtc.org/1224123002 https://codereview.webrtc.org/1224163002 https://codereview.webrtc.org/1225133003 https://codereview.webrtc.org/1225173002 https://codereview.webrtc.org/1227163003 https://codereview.webrtc.org/1227203003 https://codereview.webrtc.org/1227213002 https://codereview.webrtc.org/1227893002 https://codereview.webrtc.org/1228793004 https://codereview.webrtc.org/1228803003 https://codereview.webrtc.org/1228823002 https://codereview.webrtc.org/1228823003 https://codereview.webrtc.org/1228843002 https://codereview.webrtc.org/1230693002 https://codereview.webrtc.org/1231713002 The change is being landed as TBR to all the folks who reviewed the above. BUG=chromium:81439 TEST=none R=andrew@webrtc.org, pbos@webrtc.org TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher Review URL: https://codereview.webrtc.org/1230503003 . Cr-Commit-Position: refs/heads/master@{#9768}
This commit is contained in:
@ -97,7 +97,7 @@ TEST(PacketBuffer, InsertPacket) {
|
||||
EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
|
||||
EXPECT_EQ(4711u, next_ts);
|
||||
EXPECT_FALSE(buffer.Empty());
|
||||
EXPECT_EQ(1, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
|
||||
const RTPHeader* hdr = buffer.NextRtpHeader();
|
||||
EXPECT_EQ(&(packet->header), hdr); // Compare pointer addresses.
|
||||
|
||||
@ -116,12 +116,12 @@ TEST(PacketBuffer, FlushBuffer) {
|
||||
Packet* packet = gen.NextPacket(payload_len);
|
||||
EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(packet));
|
||||
}
|
||||
EXPECT_EQ(10, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
|
||||
EXPECT_FALSE(buffer.Empty());
|
||||
|
||||
buffer.Flush();
|
||||
// Buffer should delete the payloads itself.
|
||||
EXPECT_EQ(0, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(0u, buffer.NumPacketsInBuffer());
|
||||
EXPECT_TRUE(buffer.Empty());
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ TEST(PacketBuffer, OverfillBuffer) {
|
||||
Packet* packet = gen.NextPacket(payload_len);
|
||||
EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(packet));
|
||||
}
|
||||
EXPECT_EQ(10, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
|
||||
uint32_t next_ts;
|
||||
EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
|
||||
EXPECT_EQ(0u, next_ts); // Expect first inserted packet to be first in line.
|
||||
@ -145,7 +145,7 @@ TEST(PacketBuffer, OverfillBuffer) {
|
||||
// Insert 11th packet; should flush the buffer and insert it after flushing.
|
||||
Packet* packet = gen.NextPacket(payload_len);
|
||||
EXPECT_EQ(PacketBuffer::kFlushed, buffer.InsertPacket(packet));
|
||||
EXPECT_EQ(1, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
|
||||
// Expect last inserted packet to be first in line.
|
||||
EXPECT_EQ(packet->header.timestamp, next_ts);
|
||||
@ -179,7 +179,7 @@ TEST(PacketBuffer, InsertPacketList) {
|
||||
¤t_pt,
|
||||
¤t_cng_pt));
|
||||
EXPECT_TRUE(list.empty()); // The PacketBuffer should have depleted the list.
|
||||
EXPECT_EQ(10, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(0, current_pt); // Current payload type changed to 0.
|
||||
EXPECT_EQ(0xFF, current_cng_pt); // CNG payload type not changed.
|
||||
|
||||
@ -220,7 +220,7 @@ TEST(PacketBuffer, InsertPacketListChangePayloadType) {
|
||||
¤t_pt,
|
||||
¤t_cng_pt));
|
||||
EXPECT_TRUE(list.empty()); // The PacketBuffer should have depleted the list.
|
||||
EXPECT_EQ(1, buffer.NumPacketsInBuffer()); // Only the last packet.
|
||||
EXPECT_EQ(1u, buffer.NumPacketsInBuffer()); // Only the last packet.
|
||||
EXPECT_EQ(1, current_pt); // Current payload type changed to 0.
|
||||
EXPECT_EQ(0xFF, current_cng_pt); // CNG payload type not changed.
|
||||
|
||||
@ -256,7 +256,7 @@ TEST(PacketBuffer, ExtractOrderRedundancy) {
|
||||
{0x0006, 0x0000001E, 1, false, -1},
|
||||
};
|
||||
|
||||
const int kExpectPacketsInBuffer = 9;
|
||||
const size_t kExpectPacketsInBuffer = 9;
|
||||
|
||||
std::vector<Packet*> expect_order(kExpectPacketsInBuffer);
|
||||
|
||||
@ -277,10 +277,10 @@ TEST(PacketBuffer, ExtractOrderRedundancy) {
|
||||
|
||||
EXPECT_EQ(kExpectPacketsInBuffer, buffer.NumPacketsInBuffer());
|
||||
|
||||
int drop_count;
|
||||
for (int i = 0; i < kExpectPacketsInBuffer; ++i) {
|
||||
size_t drop_count;
|
||||
for (size_t i = 0; i < kExpectPacketsInBuffer; ++i) {
|
||||
Packet* packet = buffer.GetNextPacket(&drop_count);
|
||||
EXPECT_EQ(0, drop_count);
|
||||
EXPECT_EQ(0u, drop_count);
|
||||
EXPECT_EQ(packet, expect_order[i]); // Compare pointer addresses.
|
||||
delete[] packet->payload;
|
||||
delete packet;
|
||||
@ -302,7 +302,7 @@ TEST(PacketBuffer, DiscardPackets) {
|
||||
Packet* packet = gen.NextPacket(payload_len);
|
||||
buffer.InsertPacket(packet);
|
||||
}
|
||||
EXPECT_EQ(10, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
|
||||
|
||||
// Discard them one by one and make sure that the right packets are at the
|
||||
// front of the buffer.
|
||||
@ -350,7 +350,7 @@ TEST(PacketBuffer, Reordering) {
|
||||
decoder_database,
|
||||
¤t_pt,
|
||||
¤t_cng_pt));
|
||||
EXPECT_EQ(10, buffer.NumPacketsInBuffer());
|
||||
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
|
||||
|
||||
// Extract them and make sure that come out in the right order.
|
||||
uint32_t current_ts = start_ts;
|
||||
@ -425,7 +425,7 @@ TEST(PacketBuffer, Failures) {
|
||||
¤t_pt,
|
||||
¤t_cng_pt));
|
||||
EXPECT_TRUE(list.empty()); // The PacketBuffer should have depleted the list.
|
||||
EXPECT_EQ(1, buffer->NumPacketsInBuffer());
|
||||
EXPECT_EQ(1u, buffer->NumPacketsInBuffer());
|
||||
delete buffer;
|
||||
EXPECT_CALL(decoder_database, Die()); // Called when object is deleted.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user