Change from WebRtcRTPHeader to RTPHeader in NetEq tests and tools
With this CL, all tests and tools under the neteq/ folder are
converted to use RTPHeader instead of WebRtcRTPHeader. WebRtcRTPHeader
has an RTPHeader as a member. None of the other member in
WebRtcRTPHeader where used.
TBR=kjellander@webrtc.org
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_compile_rel_ng,linux_chromium_compile_dbg_ng
BUG=webrtc:7467
Review-Url: https://codereview.webrtc.org/2809153002
Cr-Commit-Position: refs/heads/master@{#17845}
diff --git a/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc
index 0ccba6d..cc1374f 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc
@@ -13,6 +13,7 @@
#include <memory>
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
+#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h"
@@ -130,13 +131,12 @@
}
}
- void InsertPacket(WebRtcRTPHeader rtp_header,
+ void InsertPacket(RTPHeader rtp_header,
rtc::ArrayView<const uint8_t> payload,
uint32_t receive_timestamp) override {
- EXPECT_CALL(
- *external_decoder_,
- IncomingPacket(_, payload.size(), rtp_header.header.sequenceNumber,
- rtp_header.header.timestamp, receive_timestamp));
+ EXPECT_CALL(*external_decoder_,
+ IncomingPacket(_, payload.size(), rtp_header.sequenceNumber,
+ rtp_header.timestamp, receive_timestamp));
NetEqExternalDecoderTest::InsertPacket(rtp_header, payload,
receive_timestamp);
}
@@ -159,7 +159,7 @@
uint32_t last_send_time_;
uint32_t last_arrival_time_;
std::unique_ptr<test::InputAudioFile> input_file_;
- WebRtcRTPHeader rtp_header_;
+ RTPHeader rtp_header_;
};
// This test encodes a few packets of PCM16b 32 kHz data and inserts it into two
@@ -206,12 +206,12 @@
}
}
- void InsertPacket(WebRtcRTPHeader rtp_header,
+ void InsertPacket(RTPHeader rtp_header,
rtc::ArrayView<const uint8_t> payload,
uint32_t receive_timestamp) override {
// Insert packet in internal decoder.
- ASSERT_EQ(NetEq::kOK, neteq_internal_->InsertPacket(
- rtp_header.header, payload, receive_timestamp));
+ ASSERT_EQ(NetEq::kOK, neteq_internal_->InsertPacket(rtp_header, payload,
+ receive_timestamp));
// Insert packet in external decoder instance.
NetEqExternalDecoderUnitTest::InsertPacket(rtp_header, payload,
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc
index 9897f69..4e110a6 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc
@@ -12,6 +12,7 @@
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
#include "webrtc/base/safe_conversions.h"
+#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/neteq/accelerate.h"
#include "webrtc/modules/audio_coding/neteq/expand.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
@@ -182,18 +183,18 @@
CreateInstance();
// Event: 2, E bit, Volume: 17, Length: 4336.
uint8_t payload[kPayloadLength] = { 0x02, 0x80 + 0x11, 0x10, 0xF0 };
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
EXPECT_EQ(NetEq::kOK, neteq_->RegisterPayloadType(
decoder_type, "telephone-event", kPayloadType));
// Insert first packet.
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
// Pull audio once.
const size_t kMaxOutputSize =
@@ -299,11 +300,11 @@
const uint32_t kSsrc = 0x87654321;
const uint32_t kFirstReceiveTime = 17;
uint8_t payload[kPayloadLength] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = kFirstSequenceNumber;
- rtp_header.header.timestamp = kFirstTimestamp;
- rtp_header.header.ssrc = kSsrc;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = kFirstSequenceNumber;
+ rtp_header.timestamp = kFirstTimestamp;
+ rtp_header.ssrc = kSsrc;
Packet fake_packet;
fake_packet.payload_type = kPayloadType;
fake_packet.sequence_number = kFirstSequenceNumber;
@@ -384,12 +385,12 @@
}
// Insert first packet.
- neteq_->InsertPacket(rtp_header.header, payload, kFirstReceiveTime);
+ neteq_->InsertPacket(rtp_header, payload, kFirstReceiveTime);
// Insert second packet.
- rtp_header.header.timestamp += 160;
- rtp_header.header.sequenceNumber += 1;
- neteq_->InsertPacket(rtp_header.header, payload, kFirstReceiveTime + 155);
+ rtp_header.timestamp += 160;
+ rtp_header.sequenceNumber += 1;
+ neteq_->InsertPacket(rtp_header, payload, kFirstReceiveTime + 155);
}
TEST_F(NetEqImplTest, InsertPacketsUntilBufferIsFull) {
@@ -401,11 +402,11 @@
const uint8_t kPayloadType = 17; // Just an arbitrary number.
const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
uint8_t payload[kPayloadLengthBytes] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
EXPECT_EQ(NetEq::kOK, neteq_->RegisterPayloadType(
NetEqDecoder::kDecoderPCM16B, "", kPayloadType));
@@ -413,20 +414,20 @@
// Insert packets. The buffer should not flush.
for (size_t i = 1; i <= config_.max_packets_in_buffer; ++i) {
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
- rtp_header.header.timestamp += kPayloadLengthSamples;
- rtp_header.header.sequenceNumber += 1;
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ rtp_header.timestamp += kPayloadLengthSamples;
+ rtp_header.sequenceNumber += 1;
EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer());
}
// Insert one more packet and make sure the buffer got flushed. That is, it
// should only hold one single packet.
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
EXPECT_EQ(1u, packet_buffer_->NumPacketsInBuffer());
const Packet* test_packet = packet_buffer_->PeekNextPacket();
- EXPECT_EQ(rtp_header.header.timestamp, test_packet->timestamp);
- EXPECT_EQ(rtp_header.header.sequenceNumber, test_packet->sequence_number);
+ EXPECT_EQ(rtp_header.timestamp, test_packet->timestamp);
+ EXPECT_EQ(rtp_header.sequenceNumber, test_packet->sequence_number);
}
TEST_F(NetEqImplTest, TestDtmfPacketAVT) {
@@ -458,11 +459,11 @@
static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms.
const size_t kPayloadLengthBytes = kPayloadLengthSamples;
uint8_t payload[kPayloadLengthBytes] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
// This is a dummy decoder that produces as many output samples as the input
// has bytes. The output is an increasing series, starting at 1 for the first
@@ -502,7 +503,7 @@
// Insert one packet.
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
// Pull audio once.
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000);
@@ -523,7 +524,7 @@
// timestamp should match the playout timestamp.
// Wrap the expected value in an rtc::Optional to compare them as such.
EXPECT_EQ(
- rtc::Optional<uint32_t>(rtp_header.header.timestamp +
+ rtc::Optional<uint32_t>(rtp_header.timestamp +
output.data_[output.samples_per_channel_ - 1]),
neteq_->GetPlayoutTimestamp());
@@ -531,7 +532,7 @@
// be one full frame length ahead of the RTP timestamp.
const SyncBuffer* sync_buffer = neteq_->sync_buffer_for_test();
ASSERT_TRUE(sync_buffer != NULL);
- EXPECT_EQ(rtp_header.header.timestamp + kPayloadLengthSamples,
+ EXPECT_EQ(rtp_header.timestamp + kPayloadLengthSamples,
sync_buffer->end_timestamp());
// Check that the number of samples still to play from the sync buffer add
@@ -552,11 +553,11 @@
static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms.
const size_t kPayloadLengthBytes = kPayloadLengthSamples;
uint8_t payload[kPayloadLengthBytes] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
// Create a mock decoder object.
MockAudioDecoder mock_decoder;
@@ -583,7 +584,7 @@
// Insert one packet.
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
// Pull audio once.
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000);
@@ -596,16 +597,16 @@
// Insert two more packets. The first one is out of order, and is already too
// old, the second one is the expected next packet.
- rtp_header.header.sequenceNumber -= 1;
- rtp_header.header.timestamp -= kPayloadLengthSamples;
+ rtp_header.sequenceNumber -= 1;
+ rtp_header.timestamp -= kPayloadLengthSamples;
payload[0] = 1;
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
- rtp_header.header.sequenceNumber += 2;
- rtp_header.header.timestamp += 2 * kPayloadLengthSamples;
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ rtp_header.sequenceNumber += 2;
+ rtp_header.timestamp += 2 * kPayloadLengthSamples;
payload[0] = 2;
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
// Expect only the second packet to be decoded (the one with "2" as the first
// payload byte).
@@ -642,16 +643,16 @@
static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms.
const size_t kPayloadLengthBytes = kPayloadLengthSamples * 2;
uint8_t payload[kPayloadLengthBytes] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
// Insert one packet. Note that we have not registered any payload type, so
// this packet will be rejected.
EXPECT_EQ(NetEq::kFail,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
// Pull audio once.
@@ -670,10 +671,10 @@
// Insert 10 packets.
for (size_t i = 0; i < 10; ++i) {
- rtp_header.header.sequenceNumber++;
- rtp_header.header.timestamp += kPayloadLengthSamples;
+ rtp_header.sequenceNumber++;
+ rtp_header.timestamp += kPayloadLengthSamples;
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
EXPECT_EQ(i + 1, packet_buffer_->NumPacketsInBuffer());
}
@@ -703,11 +704,11 @@
uint8_t payload[kPayloadLengthBytes] = {0};
int16_t dummy_output[kPayloadLengthSamples] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
// Create a mock decoder object.
MockAudioDecoder mock_decoder;
@@ -760,14 +761,14 @@
// Insert one packet (decoder will return speech).
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
// Insert second packet (decoder will return CNG).
payload[0] = 1;
- rtp_header.header.sequenceNumber++;
- rtp_header.header.timestamp += kPayloadLengthSamples;
+ rtp_header.sequenceNumber++;
+ rtp_header.timestamp += kPayloadLengthSamples;
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateKhz);
AudioFrame output;
@@ -815,10 +816,10 @@
// Insert third packet, which leaves a gap from last packet.
payload[0] = 2;
- rtp_header.header.sequenceNumber += 2;
- rtp_header.header.timestamp += 2 * kPayloadLengthSamples;
+ rtp_header.sequenceNumber += 2;
+ rtp_header.timestamp += 2 * kPayloadLengthSamples;
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
for (size_t i = 6; i < 8; ++i) {
ASSERT_EQ(kMaxOutputSize, output.samples_per_channel_);
@@ -850,11 +851,11 @@
const size_t kPayloadLengthBytes = 1;
uint8_t payload[kPayloadLengthBytes] = {0};
int16_t dummy_output[kPayloadLengthSamples * kChannels] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
::testing::NiceMock<MockAudioDecoder> decoder;
@@ -896,16 +897,16 @@
// Insert one packet.
payload[0] = kFirstPayloadValue; // This will make Decode() fail.
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
// Insert another packet.
payload[0] = kSecondPayloadValue; // This will make Decode() successful.
- rtp_header.header.sequenceNumber++;
+ rtp_header.sequenceNumber++;
// The second timestamp needs to be at least 30 ms after the first to make
// the second packet get decoded.
- rtp_header.header.timestamp += 3 * kPayloadLengthSamples;
+ rtp_header.timestamp += 3 * kPayloadLengthSamples;
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
AudioFrame output;
bool muted;
@@ -944,11 +945,11 @@
const uint8_t kPayloadType = 17; // Just an arbitrary number.
const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
uint8_t payload[kPayloadLengthBytes] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
EXPECT_EQ(NetEq::kOK, neteq_->RegisterPayloadType(
NetEqDecoder::kDecoderPCM16B, "", kPayloadType));
@@ -957,10 +958,9 @@
for (size_t i = 0; i <= config_.max_packets_in_buffer; ++i) {
EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer());
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
- rtp_header.header.timestamp +=
- rtc::checked_cast<uint32_t>(kPayloadLengthSamples);
- ++rtp_header.header.sequenceNumber;
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ rtp_header.timestamp += rtc::checked_cast<uint32_t>(kPayloadLengthSamples);
+ ++rtp_header.sequenceNumber;
}
EXPECT_EQ(1u, packet_buffer_->NumPacketsInBuffer());
@@ -980,11 +980,11 @@
static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms.
const size_t kPayloadLengthBytes = 2 * kPayloadLengthSamples;
uint8_t payload[kPayloadLengthBytes] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
// Create a mock decoder object.
MockAudioDecoder mock_decoder;
@@ -1013,7 +1013,7 @@
// Insert one packet.
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
EXPECT_EQ(5u, neteq_->sync_buffer_for_test()->FutureLength());
@@ -1047,11 +1047,11 @@
uint8_t payload[kPayloadLengthBytes] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
// Create a mock decoder object.
MockAudioDecoder mock_decoder;
@@ -1106,10 +1106,10 @@
// Insert packets.
for (int i = 0; i < 6; ++i) {
- rtp_header.header.sequenceNumber += 1;
- rtp_header.header.timestamp += kFrameLengthSamples;
+ rtp_header.sequenceNumber += 1;
+ rtp_header.timestamp += kFrameLengthSamples;
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
}
// Pull audio.
@@ -1163,11 +1163,11 @@
uint8_t payload[kPayloadLengthBytes] = {0};
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = 0x1234;
- rtp_header.header.timestamp = 0x12345678;
- rtp_header.header.ssrc = 0x87654321;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = 0x1234;
+ rtp_header.timestamp = 0x12345678;
+ rtp_header.ssrc = 0x87654321;
// Create a mock decoder object.
MockAudioDecoder mock_decoder;
@@ -1218,10 +1218,10 @@
// Insert 2 packets. This will make netEq into codec internal CNG mode.
for (int i = 0; i < 2; ++i) {
- rtp_header.header.sequenceNumber += 1;
- rtp_header.header.timestamp += kFrameLengthSamples;
+ rtp_header.sequenceNumber += 1;
+ rtp_header.timestamp += kFrameLengthSamples;
EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
+ neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
}
// Pull audio.
@@ -1334,14 +1334,14 @@
}
void InsertPacket(uint32_t timestamp) {
- WebRtcRTPHeader rtp_header;
- rtp_header.header.payloadType = kPayloadType;
- rtp_header.header.sequenceNumber = sequence_number_;
- rtp_header.header.timestamp = timestamp;
- rtp_header.header.ssrc = 15;
+ RTPHeader rtp_header;
+ rtp_header.payloadType = kPayloadType;
+ rtp_header.sequenceNumber = sequence_number_;
+ rtp_header.timestamp = timestamp;
+ rtp_header.ssrc = 15;
const size_t kPayloadLengthBytes = 1; // This can be arbitrary.
uint8_t payload[kPayloadLengthBytes] = {0};
- EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header.header, payload, 10));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload, 10));
sequence_number_++;
}
diff --git a/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
index 82269bc..c244a97 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
@@ -10,6 +10,7 @@
#include <memory>
+#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h"
#include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h"
#include "webrtc/modules/include/module_common_types.h"
@@ -304,7 +305,7 @@
const int samples_per_ms_;
const size_t frame_size_samples_;
std::unique_ptr<test::RtpGenerator> rtp_generator_;
- WebRtcRTPHeader rtp_header_;
+ RTPHeader rtp_header_;
uint32_t last_lost_time_;
uint32_t packet_loss_interval_;
AudioFrame output_frame_;
diff --git a/webrtc/modules/audio_coding/neteq/neteq_stereo_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_stereo_unittest.cc
index 73c25a4..37a0783 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_stereo_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_stereo_unittest.cc
@@ -16,6 +16,7 @@
#include <list>
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
+#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
@@ -197,14 +198,14 @@
while (time_now >= next_arrival_time) {
// Insert packet in mono instance.
ASSERT_EQ(NetEq::kOK,
- neteq_mono_->InsertPacket(rtp_header_mono_.header,
+ neteq_mono_->InsertPacket(rtp_header_mono_,
rtc::ArrayView<const uint8_t>(
encoded_, payload_size_bytes_),
next_arrival_time));
// Insert packet in multi-channel instance.
ASSERT_EQ(NetEq::kOK,
neteq_->InsertPacket(
- rtp_header_.header,
+ rtp_header_,
rtc::ArrayView<const uint8_t>(encoded_multi_channel_,
multi_payload_size_bytes_),
next_arrival_time));
@@ -253,8 +254,8 @@
uint8_t* encoded_multi_channel_;
AudioFrame output_;
AudioFrame output_multi_channel_;
- WebRtcRTPHeader rtp_header_mono_;
- WebRtcRTPHeader rtp_header_;
+ RTPHeader rtp_header_mono_;
+ RTPHeader rtp_header_;
size_t payload_size_bytes_;
size_t multi_payload_size_bytes_;
int last_send_time_;
diff --git a/webrtc/modules/audio_coding/neteq/neteq_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_unittest.cc
index 1a54c54..68a4921 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_unittest.cc
@@ -23,9 +23,10 @@
#include "gflags/gflags.h"
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
#include "webrtc/base/ignore_wundef.h"
+#include "webrtc/base/protobuf_utils.h"
#include "webrtc/base/sha1digest.h"
#include "webrtc/base/stringencode.h"
-#include "webrtc/base/protobuf_utils.h"
+#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
#include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h"
#include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h"
@@ -250,10 +251,10 @@
static void PopulateRtpInfo(int frame_index,
int timestamp,
- WebRtcRTPHeader* rtp_info);
+ RTPHeader* rtp_info);
static void PopulateCng(int frame_index,
int timestamp,
- WebRtcRTPHeader* rtp_info,
+ RTPHeader* rtp_info,
uint8_t* payload,
size_t* payload_len);
@@ -318,15 +319,13 @@
// Check if time to receive.
while (packet_ && sim_clock_ >= packet_->time_ms()) {
if (packet_->payload_length_bytes() > 0) {
- WebRtcRTPHeader rtp_header;
- packet_->ConvertHeader(&rtp_header);
#ifndef WEBRTC_CODEC_ISAC
// Ignore payload type 104 (iSAC-swb) if ISAC is not supported.
- if (rtp_header.header.payloadType != 104)
+ if (packet_->header().payloadType != 104)
#endif
ASSERT_EQ(0,
neteq_->InsertPacket(
- rtp_header.header,
+ packet_->header(),
rtc::ArrayView<const uint8_t>(
packet_->payload(), packet_->payload_length_bytes()),
static_cast<uint32_t>(packet_->time_ms() *
@@ -409,24 +408,24 @@
void NetEqDecodingTest::PopulateRtpInfo(int frame_index,
int timestamp,
- WebRtcRTPHeader* rtp_info) {
- rtp_info->header.sequenceNumber = frame_index;
- rtp_info->header.timestamp = timestamp;
- rtp_info->header.ssrc = 0x1234; // Just an arbitrary SSRC.
- rtp_info->header.payloadType = 94; // PCM16b WB codec.
- rtp_info->header.markerBit = 0;
+ RTPHeader* rtp_info) {
+ rtp_info->sequenceNumber = frame_index;
+ rtp_info->timestamp = timestamp;
+ rtp_info->ssrc = 0x1234; // Just an arbitrary SSRC.
+ rtp_info->payloadType = 94; // PCM16b WB codec.
+ rtp_info->markerBit = 0;
}
void NetEqDecodingTest::PopulateCng(int frame_index,
int timestamp,
- WebRtcRTPHeader* rtp_info,
+ RTPHeader* rtp_info,
uint8_t* payload,
size_t* payload_len) {
- rtp_info->header.sequenceNumber = frame_index;
- rtp_info->header.timestamp = timestamp;
- rtp_info->header.ssrc = 0x1234; // Just an arbitrary SSRC.
- rtp_info->header.payloadType = 98; // WB CNG.
- rtp_info->header.markerBit = 0;
+ rtp_info->sequenceNumber = frame_index;
+ rtp_info->timestamp = timestamp;
+ rtp_info->ssrc = 0x1234; // Just an arbitrary SSRC.
+ rtp_info->payloadType = 98; // WB CNG.
+ rtp_info->markerBit = 0;
payload[0] = 64; // Noise level -64 dBov, quite arbitrarily chosen.
*payload_len = 1; // Only noise level, no spectral parameters.
}
@@ -521,13 +520,13 @@
const size_t kPayloadBytes = kSamples * 2;
for (size_t i = 0; i < num_frames; ++i) {
const uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
- rtp_info.header.sequenceNumber = i;
- rtp_info.header.timestamp = i * kSamples;
- rtp_info.header.ssrc = 0x1234; // Just an arbitrary SSRC.
- rtp_info.header.payloadType = 94; // PCM16b WB codec.
- rtp_info.header.markerBit = 0;
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ RTPHeader rtp_info;
+ rtp_info.sequenceNumber = i;
+ rtp_info.timestamp = i * kSamples;
+ rtp_info.ssrc = 0x1234; // Just an arbitrary SSRC.
+ rtp_info.payloadType = 94; // PCM16b WB codec.
+ rtp_info.markerBit = 0;
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
}
// Pull out all data.
for (size_t i = 0; i < num_frames; ++i) {
@@ -566,9 +565,9 @@
int num_packets = (frame_index % 10 == 0 ? 2 : 1);
for (int n = 0; n < num_packets; ++n) {
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateRtpInfo(frame_index, frame_index * kSamples, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
++frame_index;
}
@@ -594,9 +593,9 @@
int num_packets = (i % 10 == 9 ? 0 : 1);
for (int n = 0; n < num_packets; ++n) {
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateRtpInfo(frame_index, frame_index * kSamples, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
++frame_index;
}
@@ -632,9 +631,9 @@
while (next_input_time_ms <= t_ms) {
// Insert one 30 ms speech frame.
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
++seq_no;
timestamp += kSamples;
next_input_time_ms += static_cast<double>(kFrameSizeMs) * drift_factor;
@@ -659,10 +658,10 @@
// Insert one CNG frame each 100 ms.
uint8_t payload[kPayloadBytes];
size_t payload_len;
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
ASSERT_EQ(0, neteq_->InsertPacket(
- rtp_info.header,
+ rtp_info,
rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
++seq_no;
timestamp += kCngPeriodSamples;
@@ -702,10 +701,10 @@
// Insert one CNG frame each 100 ms.
uint8_t payload[kPayloadBytes];
size_t payload_len;
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
ASSERT_EQ(0, neteq_->InsertPacket(
- rtp_info.header,
+ rtp_info,
rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
++seq_no;
timestamp += kCngPeriodSamples;
@@ -720,9 +719,9 @@
while (next_input_time_ms <= t_ms) {
// Insert one 30 ms speech frame.
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
++seq_no;
timestamp += kSamples;
next_input_time_ms += kFrameSizeMs * drift_factor;
@@ -831,10 +830,10 @@
TEST_F(NetEqDecodingTest, UnknownPayloadType) {
const size_t kPayloadBytes = 100;
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateRtpInfo(0, 0, &rtp_info);
- rtp_info.header.payloadType = 1; // Not registered as a decoder.
- EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ rtp_info.payloadType = 1; // Not registered as a decoder.
+ EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_info, payload, 0));
EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
}
@@ -847,10 +846,10 @@
TEST_F(NetEqDecodingTest, MAYBE_DecoderError) {
const size_t kPayloadBytes = 100;
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateRtpInfo(0, 0, &rtp_info);
- rtp_info.header.payloadType = 103; // iSAC, but the payload is invalid.
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ rtp_info.payloadType = 103; // iSAC, but the payload is invalid.
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
// Set all of |out_data_| to 1, and verify that it was set to 0 by the call
// to GetAudio.
for (size_t i = 0; i < AudioFrame::kMaxDataSizeSamples; ++i) {
@@ -944,9 +943,9 @@
// Payload of 10 ms of PCM16 32 kHz.
uint8_t payload[kBlockSize32kHz * sizeof(int16_t)];
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateRtpInfo(0, 0, &rtp_info);
- rtp_info.header.payloadType = payload_type;
+ rtp_info.payloadType = payload_type;
uint32_t receive_timestamp = 0;
bool muted;
@@ -958,7 +957,7 @@
ASSERT_EQ(enc_len_bytes, expected_samples_per_channel * 2);
ASSERT_EQ(0, neteq_->InsertPacket(
- rtp_info.header,
+ rtp_info,
rtc::ArrayView<const uint8_t>(payload, enc_len_bytes),
receive_timestamp));
output.Reset();
@@ -968,8 +967,8 @@
ASSERT_EQ(AudioFrame::kNormalSpeech, output.speech_type_);
// Next packet.
- rtp_info.header.timestamp += expected_samples_per_channel;
- rtp_info.header.sequenceNumber++;
+ rtp_info.timestamp += expected_samples_per_channel;
+ rtp_info.sequenceNumber++;
receive_timestamp += expected_samples_per_channel;
}
@@ -1090,12 +1089,12 @@
while (next_input_time_ms <= t_ms) {
// Insert one 30 ms speech frame.
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
if (drop_seq_numbers.find(seq_no) == drop_seq_numbers.end()) {
// This sequence number was not in the set to drop. Insert it.
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload,
- receive_timestamp));
+ ASSERT_EQ(0,
+ neteq_->InsertPacket(rtp_info, payload, receive_timestamp));
++packets_inserted;
}
NetEqNetworkStatistics network_stats;
@@ -1179,11 +1178,11 @@
// Insert three speech packets. Three are needed to get the frame length
// correct.
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
bool muted;
for (int i = 0; i < 3; ++i) {
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
++seq_no;
timestamp += kSamples;
@@ -1200,9 +1199,9 @@
size_t payload_len;
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
// This is the first time this CNG packet is inserted.
- ASSERT_EQ(0, neteq_->InsertPacket(
- rtp_info.header,
- rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
+ ASSERT_EQ(
+ 0, neteq_->InsertPacket(
+ rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
// Pull audio once and make sure CNG is played.
ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
@@ -1214,9 +1213,9 @@
// Insert the same CNG packet again. Note that at this point it is old, since
// we have already decoded the first copy of it.
- ASSERT_EQ(0, neteq_->InsertPacket(
- rtp_info.header,
- rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
+ ASSERT_EQ(
+ 0, neteq_->InsertPacket(
+ rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
// Pull audio until we have played |kCngPeriodMs| of CNG. Start at 10 ms since
// we have already pulled out CNG once.
@@ -1233,7 +1232,7 @@
++seq_no;
timestamp += kCngPeriodSamples;
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
// Pull audio once and verify that the output is speech again.
ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
@@ -1263,13 +1262,13 @@
size_t payload_len;
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
- ASSERT_EQ(NetEq::kOK,
- neteq_->InsertPacket(
- rtp_info.header,
- rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
+ ASSERT_EQ(
+ NetEq::kOK,
+ neteq_->InsertPacket(
+ rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
++seq_no;
timestamp += kCngPeriodSamples;
@@ -1285,7 +1284,7 @@
do {
ASSERT_LT(timeout_counter++, 20) << "Test timed out";
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
++seq_no;
timestamp += kSamples;
@@ -1309,20 +1308,20 @@
void InsertPacket(uint32_t rtp_timestamp) {
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateRtpInfo(0, rtp_timestamp, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
}
void InsertCngPacket(uint32_t rtp_timestamp) {
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
size_t payload_len;
PopulateCng(0, rtp_timestamp, &rtp_info, payload, &payload_len);
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(
- rtp_info.header,
- rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
+ EXPECT_EQ(
+ NetEq::kOK,
+ neteq_->InsertPacket(
+ rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
}
bool GetAudioReturnMuted() {
@@ -1545,10 +1544,10 @@
const size_t kSamples = 10 * 16;
const size_t kPayloadBytes = kSamples * 2;
uint8_t payload[kPayloadBytes] = {0};
- WebRtcRTPHeader rtp_info;
+ RTPHeader rtp_info;
PopulateRtpInfo(0, 0, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
- EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info.header, payload, 0));
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload, 0));
AudioFrame out_frame1, out_frame2;
bool muted;
@@ -1570,8 +1569,8 @@
// Insert new data. Timestamp is corrected for the time elapsed since the last
// packet.
PopulateRtpInfo(0, kSamples * 1000, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
- EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info.header, payload, 0));
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload, 0));
int counter = 0;
while (out_frame1.speech_type_ != AudioFrame::kNormalSpeech) {
diff --git a/webrtc/modules/audio_coding/neteq/tools/encode_neteq_input.cc b/webrtc/modules/audio_coding/neteq/tools/encode_neteq_input.cc
index f837ad6..5fabb6f 100644
--- a/webrtc/modules/audio_coding/neteq/tools/encode_neteq_input.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/encode_neteq_input.cc
@@ -52,7 +52,7 @@
rtc::Optional<RTPHeader> EncodeNetEqInput::NextHeader() const {
RTC_DCHECK(packet_data_);
- return rtc::Optional<RTPHeader>(packet_data_->header.header);
+ return rtc::Optional<RTPHeader>(packet_data_->header);
}
void EncodeNetEqInput::CreatePacket() {
@@ -77,9 +77,9 @@
encoder_->SampleRateHz());
++num_blocks;
}
- packet_data_->header.header.timestamp = info.encoded_timestamp;
- packet_data_->header.header.payloadType = info.payload_type;
- packet_data_->header.header.sequenceNumber = sequence_number_++;
+ packet_data_->header.timestamp = info.encoded_timestamp;
+ packet_data_->header.payloadType = info.payload_type;
+ packet_data_->header.sequenceNumber = sequence_number_++;
packet_data_->time_ms = next_packet_time_ms_;
next_packet_time_ms_ += num_blocks * kOutputPeriodMs;
}
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.cc
index 95fdb04..8b7ca09 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.cc
@@ -37,11 +37,11 @@
}
void NetEqExternalDecoderTest::InsertPacket(
- WebRtcRTPHeader rtp_header,
+ RTPHeader rtp_header,
rtc::ArrayView<const uint8_t> payload,
uint32_t receive_timestamp) {
- ASSERT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header.header, payload,
- receive_timestamp));
+ ASSERT_EQ(NetEq::kOK,
+ neteq_->InsertPacket(rtp_header, payload, receive_timestamp));
}
void NetEqExternalDecoderTest::GetOutputAudio(AudioFrame* output) {
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h b/webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h
index 208d8da..fc66c0f 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h
@@ -15,6 +15,7 @@
#include <string>
#include "webrtc/api/audio_codecs/audio_decoder.h"
+#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/include/module_common_types.h"
@@ -40,7 +41,7 @@
// |payload_size_bytes| bytes. The |receive_timestamp| is an indication
// of the time when the packet was received, and should be measured with
// the same tick rate as the RTP timestamp of the current payload.
- virtual void InsertPacket(WebRtcRTPHeader rtp_header,
+ virtual void InsertPacket(RTPHeader rtp_header,
rtc::ArrayView<const uint8_t> payload,
uint32_t receive_timestamp);
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_input.h b/webrtc/modules/audio_coding/neteq/tools/neteq_input.h
index be08a79..3bb64a6 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_input.h
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_input.h
@@ -16,9 +16,9 @@
#include "webrtc/base/buffer.h"
#include "webrtc/base/optional.h"
+#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/neteq/tools/packet.h"
#include "webrtc/modules/audio_coding/neteq/tools/packet_source.h"
-#include "webrtc/modules/include/module_common_types.h"
namespace webrtc {
namespace test {
@@ -27,7 +27,7 @@
class NetEqInput {
public:
struct PacketData {
- WebRtcRTPHeader header;
+ RTPHeader header;
rtc::Buffer payload;
double time_ms;
};
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_packet_source_input.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_packet_source_input.cc
index 5fa60dc..7d5aa3b 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_packet_source_input.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_packet_source_input.cc
@@ -42,7 +42,7 @@
return std::unique_ptr<PacketData>();
}
std::unique_ptr<PacketData> packet_data(new PacketData);
- packet_->ConvertHeader(&packet_data->header);
+ packet_data->header = packet_->header();
if (packet_->payload_length_bytes() == 0 &&
packet_->virtual_payload_length_bytes() > 0) {
// This is a header-only "dummy" packet. Set the payload to all zeros, with
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc
index df14081..77787d8 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc
@@ -12,6 +12,7 @@
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
#include "webrtc/base/checks.h"
+#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h"
@@ -24,7 +25,6 @@
using webrtc::NetEq;
using webrtc::test::AudioLoop;
using webrtc::test::RtpGenerator;
-using webrtc::WebRtcRTPHeader;
namespace webrtc {
namespace test {
@@ -59,7 +59,7 @@
int32_t time_now_ms = 0;
// Get first input packet.
- WebRtcRTPHeader rtp_header;
+ RTPHeader rtp_header;
RtpGenerator rtp_gen(kSampRateHz / 1000);
// Start with positive drift first half of simulation.
rtp_gen.set_drift_factor(drift_factor);
@@ -83,12 +83,12 @@
// Drop every N packets, where N = FLAGS_lossrate.
bool lost = false;
if (lossrate > 0) {
- lost = ((rtp_header.header.sequenceNumber - 1) % lossrate) == 0;
+ lost = ((rtp_header.sequenceNumber - 1) % lossrate) == 0;
}
if (!lost) {
// Insert packet.
int error =
- neteq->InsertPacket(rtp_header.header, input_payload,
+ neteq->InsertPacket(rtp_header, input_payload,
packet_input_time_ms * kSampRateHz / 1000);
if (error != NetEq::kOK)
return -1;
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.cc
index 732c7b8..7b3a35b 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.cc
@@ -380,7 +380,7 @@
if (payload_size_bytes_ > 0) {
if (!PacketLost()) {
int ret = neteq_->InsertPacket(
- rtp_header_.header,
+ rtp_header_,
rtc::ArrayView<const uint8_t>(payload_.data(), payload_size_bytes_),
packet_input_time_ms * in_sampling_khz_);
if (ret != NetEq::kOK)
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h b/webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h
index 0ed7dfb..731a7c9 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h
@@ -15,6 +15,7 @@
#include <memory>
#include <gflags/gflags.h>
+#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/audio_coding/neteq/tools/audio_sink.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
@@ -130,7 +131,7 @@
std::unique_ptr<int16_t[]> in_data_;
rtc::Buffer payload_;
AudioFrame out_frame_;
- WebRtcRTPHeader rtp_header_;
+ RTPHeader rtp_header_;
size_t total_payload_size_bytes_;
};
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc
index dd10649..9b550cb 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.cc
@@ -70,12 +70,12 @@
RTC_DCHECK(packet_);
- RTC_CHECK_EQ(forbidden_types_.count(packet_->header.header.payloadType), 0)
- << "Payload type " << static_cast<int>(packet_->header.header.payloadType)
+ RTC_CHECK_EQ(forbidden_types_.count(packet_->header.payloadType), 0)
+ << "Payload type " << static_cast<int>(packet_->header.payloadType)
<< " is forbidden.";
// Check if this packet is comfort noise.
- if (comfort_noise_types_.count(packet_->header.header.payloadType) != 0) {
+ if (comfort_noise_types_.count(packet_->header.payloadType) != 0) {
// If CNG, simply insert a zero-energy one-byte payload.
uint8_t cng_payload[1] = {127}; // Max attenuation of CNG.
packet_->payload.SetData(cng_payload);
@@ -86,17 +86,17 @@
RTC_DCHECK(next_hdr);
uint8_t payload[12];
uint32_t input_frame_size_timestamps = last_frame_size_timestamps_;
- if (next_hdr->sequenceNumber == packet_->header.header.sequenceNumber + 1) {
+ if (next_hdr->sequenceNumber == packet_->header.sequenceNumber + 1) {
// Packets are in order.
input_frame_size_timestamps =
- next_hdr->timestamp - packet_->header.header.timestamp;
+ next_hdr->timestamp - packet_->header.timestamp;
last_frame_size_timestamps_ = input_frame_size_timestamps;
}
- FakeDecodeFromFile::PrepareEncoded(packet_->header.header.timestamp,
+ FakeDecodeFromFile::PrepareEncoded(packet_->header.timestamp,
input_frame_size_timestamps,
packet_->payload.size(), payload);
packet_->payload.SetData(payload);
- packet_->header.header.payloadType = replacement_payload_type_;
+ packet_->header.payloadType = replacement_payload_type_;
return;
}
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
index 47edc33..2266cd4 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
@@ -281,8 +281,7 @@
// the desired SSRC.
std::unique_ptr<PacketData> PopPacket() override {
std::unique_ptr<PacketData> packet_to_return = source_->PopPacket();
- RTC_DCHECK(!packet_to_return ||
- packet_to_return->header.header.ssrc == ssrc_);
+ RTC_DCHECK(!packet_to_return || packet_to_return->header.ssrc == ssrc_);
// Pre-fetch the next packet with correct SSRC. Hence, |source_| will always
// be have a valid packet (or empty if no more packets are available) when
// this method returns.
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_test.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_test.cc
index 13b11e8..fb00025 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_test.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_test.cc
@@ -22,15 +22,15 @@
const NetEqInput::PacketData& packet) {
if (error_code == NetEq::kUnknownRtpPayloadType) {
std::cerr << "RTP Payload type "
- << static_cast<int>(packet.header.header.payloadType)
- << " is unknown." << std::endl;
+ << static_cast<int>(packet.header.payloadType) << " is unknown."
+ << std::endl;
} else {
std::cerr << "InsertPacket returned error code " << error_code << std::endl;
std::cerr << "Header data:" << std::endl;
- std::cerr << " PT = " << static_cast<int>(packet.header.header.payloadType)
+ std::cerr << " PT = " << static_cast<int>(packet.header.payloadType)
<< std::endl;
- std::cerr << " SN = " << packet.header.header.sequenceNumber << std::endl;
- std::cerr << " TS = " << packet.header.header.timestamp << std::endl;
+ std::cerr << " SN = " << packet.header.sequenceNumber << std::endl;
+ std::cerr << " TS = " << packet.header.timestamp << std::endl;
}
FATAL();
}
@@ -70,7 +70,7 @@
std::unique_ptr<NetEqInput::PacketData> packet_data = input_->PopPacket();
RTC_CHECK(packet_data);
int error = neteq_->InsertPacket(
- packet_data->header.header,
+ packet_data->header,
rtc::ArrayView<const uint8_t>(packet_data->payload),
static_cast<uint32_t>(packet_data->time_ms * sample_rate_hz_ / 1000));
if (error != NetEq::kOK && error_callback_) {
diff --git a/webrtc/modules/audio_coding/neteq/tools/packet.cc b/webrtc/modules/audio_coding/neteq/tools/packet.cc
index 0ed1be1..0430933 100644
--- a/webrtc/modules/audio_coding/neteq/tools/packet.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/packet.cc
@@ -126,14 +126,6 @@
}
}
-void Packet::ConvertHeader(WebRtcRTPHeader* copy_to) const {
- memcpy(©_to->header, &header_, sizeof(header_));
- copy_to->frameType = kAudioFrameSpeech;
- copy_to->type.Audio.numEnergy = 0;
- copy_to->type.Audio.channel = 1;
- copy_to->type.Audio.isCNG = false;
-}
-
bool Packet::ParseHeader(const RtpHeaderParser& parser) {
bool valid_header = parser.Parse(
payload_memory_.get(), static_cast<int>(packet_length_bytes_), &header_);
diff --git a/webrtc/modules/audio_coding/neteq/tools/packet.h b/webrtc/modules/audio_coding/neteq/tools/packet.h
index d150805..5d78ffa 100644
--- a/webrtc/modules/audio_coding/neteq/tools/packet.h
+++ b/webrtc/modules/audio_coding/neteq/tools/packet.h
@@ -21,7 +21,6 @@
namespace webrtc {
class RtpHeaderParser;
-struct WebRtcRTPHeader;
namespace test {
@@ -90,10 +89,6 @@
const RTPHeader& header() const { return header_; }
- // Copies the packet header information, converting from the native RTPHeader
- // type to WebRtcRTPHeader.
- void ConvertHeader(WebRtcRTPHeader* copy_to) const;
-
void set_time_ms(double time) { time_ms_ = time; }
double time_ms() const { return time_ms_; }
bool valid_header() const { return valid_header_; }
diff --git a/webrtc/modules/audio_coding/neteq/tools/rtp_generator.cc b/webrtc/modules/audio_coding/neteq/tools/rtp_generator.cc
index db9988d..a6e883d 100644
--- a/webrtc/modules/audio_coding/neteq/tools/rtp_generator.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/rtp_generator.cc
@@ -17,19 +17,18 @@
uint32_t RtpGenerator::GetRtpHeader(uint8_t payload_type,
size_t payload_length_samples,
- WebRtcRTPHeader* rtp_header) {
+ RTPHeader* rtp_header) {
assert(rtp_header);
if (!rtp_header) {
return 0;
}
- rtp_header->header.sequenceNumber = seq_number_++;
- rtp_header->header.timestamp = timestamp_;
+ rtp_header->sequenceNumber = seq_number_++;
+ rtp_header->timestamp = timestamp_;
timestamp_ += static_cast<uint32_t>(payload_length_samples);
- rtp_header->header.payloadType = payload_type;
- rtp_header->header.markerBit = false;
- rtp_header->header.ssrc = ssrc_;
- rtp_header->header.numCSRCs = 0;
- rtp_header->frameType = kAudioFrameSpeech;
+ rtp_header->payloadType = payload_type;
+ rtp_header->markerBit = false;
+ rtp_header->ssrc = ssrc_;
+ rtp_header->numCSRCs = 0;
uint32_t this_send_time = next_send_time_ms_;
assert(samples_per_ms_ > 0);
@@ -46,7 +45,7 @@
uint32_t TimestampJumpRtpGenerator::GetRtpHeader(uint8_t payload_type,
size_t payload_length_samples,
- WebRtcRTPHeader* rtp_header) {
+ RTPHeader* rtp_header) {
uint32_t ret = RtpGenerator::GetRtpHeader(
payload_type, payload_length_samples, rtp_header);
if (timestamp_ - static_cast<uint32_t>(payload_length_samples) <=
diff --git a/webrtc/modules/audio_coding/neteq/tools/rtp_generator.h b/webrtc/modules/audio_coding/neteq/tools/rtp_generator.h
index 53371be..c733fff 100644
--- a/webrtc/modules/audio_coding/neteq/tools/rtp_generator.h
+++ b/webrtc/modules/audio_coding/neteq/tools/rtp_generator.h
@@ -12,7 +12,7 @@
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_GENERATOR_H_
#include "webrtc/base/constructormagic.h"
-#include "webrtc/modules/include/module_common_types.h"
+#include "webrtc/common_types.h"
#include "webrtc/typedefs.h"
namespace webrtc {
@@ -41,7 +41,7 @@
// |payload_length_samples| determines the send time for the next packet.
virtual uint32_t GetRtpHeader(uint8_t payload_type,
size_t payload_length_samples,
- WebRtcRTPHeader* rtp_header);
+ RTPHeader* rtp_header);
void set_drift_factor(double factor);
@@ -70,7 +70,7 @@
uint32_t GetRtpHeader(uint8_t payload_type,
size_t payload_length_samples,
- WebRtcRTPHeader* rtp_header) override;
+ RTPHeader* rtp_header) override;
private:
uint32_t jump_from_timestamp_;