Remove the unused `receive_timestamp` arg to NetEq::InsertPacket
The implementation just ignores the provided timestamp, and gets the
time from the current clock instead.
Bug: webrtc:11028
Change-Id: I7a1fee36bef862c68d8f15fd19ee53b2bbb25892
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156164
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29434}
diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc
index da27c0f..1c8d88d 100644
--- a/modules/audio_coding/acm2/acm_receiver.cc
+++ b/modules/audio_coding/acm2/acm_receiver.cc
@@ -114,9 +114,7 @@
}
} // |crit_sect_| is released.
- uint32_t receive_timestamp = NowInTimestamp(format->clockrate_hz);
- if (neteq_->InsertPacket(rtp_header, incoming_payload, receive_timestamp) <
- 0) {
+ if (neteq_->InsertPacket(rtp_header, incoming_payload) < 0) {
RTC_LOG(LERROR) << "AcmReceiver::InsertPacket "
<< static_cast<int>(rtp_header.payloadType)
<< " Failed to insert packet";
diff --git a/modules/audio_coding/neteq/include/neteq.h b/modules/audio_coding/neteq/include/neteq.h
index 0224b37..c6af751 100644
--- a/modules/audio_coding/neteq/include/neteq.h
+++ b/modules/audio_coding/neteq/include/neteq.h
@@ -153,13 +153,17 @@
virtual ~NetEq() {}
- // Inserts a new packet into NetEq. 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.
+ // Inserts a new packet into NetEq.
// Returns 0 on success, -1 on failure.
virtual int InsertPacket(const RTPHeader& rtp_header,
- rtc::ArrayView<const uint8_t> payload,
- uint32_t receive_timestamp) = 0;
+ rtc::ArrayView<const uint8_t> payload) = 0;
+
+ // Deprecated. Use the version without the `receive_timestamp` argument.
+ int InsertPacket(const RTPHeader& rtp_header,
+ rtc::ArrayView<const uint8_t> payload,
+ uint32_t /*receive_timestamp*/) {
+ return InsertPacket(rtp_header, payload);
+ }
// Lets NetEq know that a packet arrived with an empty payload. This typically
// happens when empty packets are used for probing the network channel, and
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc
index f1245cc..751fc45 100644
--- a/modules/audio_coding/neteq/neteq_impl.cc
+++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -151,12 +151,11 @@
NetEqImpl::~NetEqImpl() = default;
int NetEqImpl::InsertPacket(const RTPHeader& rtp_header,
- rtc::ArrayView<const uint8_t> payload,
- uint32_t receive_timestamp) {
+ rtc::ArrayView<const uint8_t> payload) {
rtc::MsanCheckInitialized(payload);
TRACE_EVENT0("webrtc", "NetEqImpl::InsertPacket");
rtc::CritScope lock(&crit_sect_);
- if (InsertPacketInternal(rtp_header, payload, receive_timestamp) != 0) {
+ if (InsertPacketInternal(rtp_header, payload) != 0) {
return kFail;
}
return kOK;
@@ -473,8 +472,7 @@
// Methods below this line are private.
int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
- rtc::ArrayView<const uint8_t> payload,
- uint32_t receive_timestamp) {
+ rtc::ArrayView<const uint8_t> payload) {
if (payload.empty()) {
RTC_LOG_F(LS_ERROR) << "payload is empty";
return kInvalidPointer;
diff --git a/modules/audio_coding/neteq/neteq_impl.h b/modules/audio_coding/neteq/neteq_impl.h
index c4887a7..8ecb9b6 100644
--- a/modules/audio_coding/neteq/neteq_impl.h
+++ b/modules/audio_coding/neteq/neteq_impl.h
@@ -129,13 +129,9 @@
~NetEqImpl() override;
- // Inserts a new packet into NetEq. 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.
- // Returns 0 on success, -1 on failure.
+ // Inserts a new packet into NetEq. Returns 0 on success, -1 on failure.
int InsertPacket(const RTPHeader& rtp_header,
- rtc::ArrayView<const uint8_t> payload,
- uint32_t receive_timestamp) override;
+ rtc::ArrayView<const uint8_t> payload) override;
void InsertEmptyPacket(const RTPHeader& rtp_header) override;
@@ -218,8 +214,7 @@
// above. Returns 0 on success, otherwise an error code.
// TODO(hlundin): Merge this with InsertPacket above?
int InsertPacketInternal(const RTPHeader& rtp_header,
- rtc::ArrayView<const uint8_t> payload,
- uint32_t receive_timestamp)
+ rtc::ArrayView<const uint8_t> payload)
RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
// Delivers 10 ms of audio data. The data is written to |audio_frame|.
diff --git a/modules/audio_coding/neteq/neteq_impl_unittest.cc b/modules/audio_coding/neteq/neteq_impl_unittest.cc
index 2f152c9..8862905 100644
--- a/modules/audio_coding/neteq/neteq_impl_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_impl_unittest.cc
@@ -192,7 +192,6 @@
void TestDtmfPacket(int sample_rate_hz) {
const size_t kPayloadLength = 4;
const uint8_t kPayloadType = 110;
- const uint32_t kReceiveTime = 17;
const int kSampleRateHz = 16000;
config_.sample_rate_hz = kSampleRateHz;
UseNoMocks();
@@ -209,8 +208,7 @@
kPayloadType, SdpAudioFormat("telephone-event", sample_rate_hz, 1)));
// Insert first packet.
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
// Pull audio once.
const size_t kMaxOutputSize =
@@ -312,7 +310,6 @@
const uint16_t kFirstSequenceNumber = 0x1234;
const uint32_t kFirstTimestamp = 0x12345678;
const uint32_t kSsrc = 0x87654321;
- const uint32_t kFirstReceiveTime = 17;
uint8_t payload[kPayloadLength] = {0};
RTPHeader rtp_header;
rtp_header.payloadType = kPayloadType;
@@ -383,12 +380,12 @@
}
// Insert first packet.
- neteq_->InsertPacket(rtp_header, payload, kFirstReceiveTime);
+ neteq_->InsertPacket(rtp_header, payload);
// Insert second packet.
rtp_header.timestamp += 160;
rtp_header.sequenceNumber += 1;
- neteq_->InsertPacket(rtp_header, payload, kFirstReceiveTime + 155);
+ neteq_->InsertPacket(rtp_header, payload);
}
TEST_F(NetEqImplTest, InsertPacketsUntilBufferIsFull) {
@@ -398,7 +395,6 @@
const int kPayloadLengthSamples = 80;
const size_t kPayloadLengthBytes = 2 * kPayloadLengthSamples; // PCM 16-bit.
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};
RTPHeader rtp_header;
rtp_header.payloadType = kPayloadType;
@@ -411,8 +407,7 @@
// 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, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
rtp_header.timestamp += kPayloadLengthSamples;
rtp_header.sequenceNumber += 1;
EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer());
@@ -420,8 +415,7 @@
// 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, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
EXPECT_EQ(1u, packet_buffer_->NumPacketsInBuffer());
const Packet* test_packet = packet_buffer_->PeekNextPacket();
EXPECT_EQ(rtp_header.timestamp, test_packet->timestamp);
@@ -448,7 +442,6 @@
// through to the sync buffer and to the playout timestamp.
TEST_F(NetEqImplTest, VerifyTimestampPropagation) {
const uint8_t kPayloadType = 17; // Just an arbitrary number.
- const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
const int kSampleRateHz = 8000;
const size_t kPayloadLengthSamples =
static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms.
@@ -508,8 +501,7 @@
// Insert one packet.
clock_.AdvanceTimeMilliseconds(123456);
int64_t expected_receive_time_ms = clock_.TimeInMilliseconds();
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
// Pull audio once.
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000);
@@ -568,7 +560,6 @@
new rtc::RefCountedObject<test::AudioDecoderProxyFactory>(&mock_decoder));
const uint8_t kPayloadType = 17; // Just an arbitrary number.
- const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
const int kSampleRateHz = 8000;
const size_t kPayloadLengthSamples =
static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms.
@@ -603,8 +594,7 @@
// Insert one packet.
clock_.AdvanceTimeMilliseconds(123456);
int64_t expected_receive_time_ms = clock_.TimeInMilliseconds();
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
// Pull audio once.
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000);
@@ -633,16 +623,14 @@
rtp_header.extension.audioLevel = 1;
payload[0] = 1;
clock_.AdvanceTimeMilliseconds(1000);
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
rtp_header.sequenceNumber += 2;
rtp_header.timestamp += 2 * kPayloadLengthSamples;
rtp_header.extension.audioLevel = 2;
payload[0] = 2;
clock_.AdvanceTimeMilliseconds(2000);
expected_receive_time_ms = clock_.TimeInMilliseconds();
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
// Expect only the second packet to be decoded (the one with "2" as the first
// payload byte).
@@ -684,7 +672,6 @@
CreateInstance();
const uint8_t kPayloadType = 17; // Just an arbitrary number.
- const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
const int kSampleRateHz = 8000;
const size_t kPayloadLengthSamples =
static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms.
@@ -698,8 +685,7 @@
// 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, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_header, payload));
// Pull audio once.
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000);
@@ -720,8 +706,7 @@
for (size_t i = 0; i < 10; ++i) {
rtp_header.sequenceNumber++;
rtp_header.timestamp += kPayloadLengthSamples;
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
EXPECT_EQ(i + 1, packet_buffer_->NumPacketsInBuffer());
}
@@ -745,7 +730,6 @@
CreateInstance();
const uint8_t kPayloadType = 17; // Just an arbitrary number.
- const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
const int kSampleRateHz = 8000;
const size_t kPayloadLengthSamples =
static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms.
@@ -778,8 +762,7 @@
for (size_t i = 0; i < 10; ++i) {
rtp_header.sequenceNumber++;
rtp_header.timestamp += kPayloadLengthSamples;
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
EXPECT_EQ(i + 1, packet_buffer_->NumPacketsInBuffer());
}
@@ -808,7 +791,6 @@
new rtc::RefCountedObject<test::AudioDecoderProxyFactory>(&mock_decoder));
const uint8_t kPayloadType = 17; // Just an arbitrary number.
- const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
const int kSampleRateKhz = 48;
const size_t kPayloadLengthSamples =
static_cast<size_t>(20 * kSampleRateKhz); // 20 ms.
@@ -867,15 +849,13 @@
SdpAudioFormat("opus", 48000, 2)));
// Insert one packet (decoder will return speech).
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
// Insert second packet (decoder will return CNG).
payload[0] = 1;
rtp_header.sequenceNumber++;
rtp_header.timestamp += kPayloadLengthSamples;
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateKhz);
AudioFrame output;
@@ -925,8 +905,7 @@
payload[0] = 2;
rtp_header.sequenceNumber += 2;
rtp_header.timestamp += 2 * kPayloadLengthSamples;
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
for (size_t i = 6; i < 8; ++i) {
ASSERT_EQ(kMaxOutputSize, output.samples_per_channel_);
@@ -953,7 +932,6 @@
static const size_t kChannels = 2;
const uint8_t kPayloadType = 17; // Just an arbitrary number.
- const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
const int kSampleRateHz = 8000;
const size_t kPayloadLengthSamples =
@@ -1001,8 +979,7 @@
// Insert one packet.
payload[0] = kFirstPayloadValue; // This will make Decode() fail.
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
// Insert another packet.
payload[0] = kSecondPayloadValue; // This will make Decode() successful.
@@ -1010,8 +987,7 @@
// The second timestamp needs to be at least 30 ms after the first to make
// the second packet get decoded.
rtp_header.timestamp += 3 * kPayloadLengthSamples;
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
AudioFrame output;
bool muted;
@@ -1048,7 +1024,6 @@
const size_t kPayloadLengthSamples = 80;
const size_t kPayloadLengthBytes = 2 * kPayloadLengthSamples; // PCM 16-bit.
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};
RTPHeader rtp_header;
rtp_header.payloadType = kPayloadType;
@@ -1062,8 +1037,7 @@
// Insert packets until the buffer flushes.
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, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
rtp_header.timestamp += rtc::checked_cast<uint32_t>(kPayloadLengthSamples);
++rtp_header.sequenceNumber;
}
@@ -1083,7 +1057,6 @@
new rtc::RefCountedObject<test::AudioDecoderProxyFactory>(&mock_decoder));
const uint8_t kPayloadType = 17; // Just an arbitrary number.
- const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
const int kSampleRateHz = 8000;
const size_t kPayloadLengthSamples =
static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms.
@@ -1116,8 +1089,7 @@
SdpAudioFormat("L16", 8000, 1)));
// Insert one packet.
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
EXPECT_EQ(5u, neteq_->sync_buffer_for_test()->FutureLength());
@@ -1144,7 +1116,6 @@
new rtc::RefCountedObject<test::AudioDecoderProxyFactory>(&mock_decoder));
const uint8_t kPayloadType = 17; // Just an arbitrary number.
- const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
const int kSampleRateHz = 8000;
const int kDecoderErrorCode = -97; // Any negative number.
@@ -1210,8 +1181,7 @@
for (int i = 0; i < 6; ++i) {
rtp_header.sequenceNumber += 1;
rtp_header.timestamp += kFrameLengthSamples;
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
}
// Pull audio.
@@ -1258,7 +1228,6 @@
new rtc::RefCountedObject<test::AudioDecoderProxyFactory>(&mock_decoder));
const uint8_t kPayloadType = 17; // Just an arbitrary number.
- const uint32_t kReceiveTime = 17; // Value doesn't matter for this test.
const int kSampleRateHz = 8000;
const int kDecoderErrorCode = -97; // Any negative number.
@@ -1321,8 +1290,7 @@
for (int i = 0; i < 2; ++i) {
rtp_header.sequenceNumber += 1;
rtp_header.timestamp += kFrameLengthSamples;
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
}
// Pull audio.
@@ -1438,7 +1406,6 @@
const int kPayloadLengthSamples = 80;
const size_t kPayloadLengthBytes = 2 * kPayloadLengthSamples; // PCM 16-bit.
const uint8_t kPayloadType = 17; // Just an arbitrary number.
- const uint32_t kReceiveTime = 17;
uint8_t payload[kPayloadLengthBytes] = {0};
RTPHeader rtp_header;
rtp_header.payloadType = kPayloadType;
@@ -1448,8 +1415,7 @@
EXPECT_TRUE(neteq_->RegisterPayloadType(kPayloadType,
SdpAudioFormat("l16", 8000, 1)));
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
AudioFrame output;
bool muted;
EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted));
@@ -1459,8 +1425,7 @@
rtp_header.timestamp -= kPayloadLengthSamples;
EXPECT_CALL(*mock_delay_manager_,
Update(rtp_header.sequenceNumber, rtp_header.timestamp, _));
- EXPECT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
}
class Decoder120ms : public AudioDecoder {
@@ -1537,7 +1502,7 @@
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, payload, 10));
+ EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload));
sequence_number_++;
}
diff --git a/modules/audio_coding/neteq/neteq_network_stats_unittest.cc b/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
index 709b143..aa61d65 100644
--- a/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
@@ -234,8 +234,7 @@
kPayloadType, frame_size_samples_, &rtp_header_);
if (!Lost(next_send_time)) {
static const uint8_t payload[kPayloadSizeByte] = {0};
- ASSERT_EQ(NetEq::kOK,
- neteq_->InsertPacket(rtp_header_, payload, next_send_time));
+ ASSERT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header_, payload));
}
}
bool muted = true;
diff --git a/modules/audio_coding/neteq/neteq_stereo_unittest.cc b/modules/audio_coding/neteq/neteq_stereo_unittest.cc
index 2d62f8b..e59637b 100644
--- a/modules/audio_coding/neteq/neteq_stereo_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_stereo_unittest.cc
@@ -161,17 +161,14 @@
while (time_now >= next_arrival_time) {
// Insert packet in mono instance.
ASSERT_EQ(NetEq::kOK,
- neteq_mono_->InsertPacket(rtp_header_mono_,
- rtc::ArrayView<const uint8_t>(
- encoded_, payload_size_bytes_),
- next_arrival_time));
+ neteq_mono_->InsertPacket(
+ rtp_header_mono_, rtc::ArrayView<const uint8_t>(
+ encoded_, payload_size_bytes_)));
// Insert packet in multi-channel instance.
- ASSERT_EQ(NetEq::kOK,
- neteq_->InsertPacket(
- rtp_header_,
- rtc::ArrayView<const uint8_t>(encoded_multi_channel_,
- multi_payload_size_bytes_),
- next_arrival_time));
+ ASSERT_EQ(NetEq::kOK, neteq_->InsertPacket(
+ rtp_header_, rtc::ArrayView<const uint8_t>(
+ encoded_multi_channel_,
+ multi_payload_size_bytes_)));
// Get next input packets (mono and multi-channel).
do {
next_send_time = GetNewPackets();
diff --git a/modules/audio_coding/neteq/neteq_unittest.cc b/modules/audio_coding/neteq/neteq_unittest.cc
index 8095b61..443c1a0 100644
--- a/modules/audio_coding/neteq/neteq_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_unittest.cc
@@ -337,13 +337,11 @@
// Ignore payload type 104 (iSAC-swb) if ISAC is not supported.
if (packet_->header().payloadType != 104)
#endif
- ASSERT_EQ(0,
- neteq_->InsertPacket(
- packet_->header(),
- rtc::ArrayView<const uint8_t>(
- packet_->payload(), packet_->payload_length_bytes()),
- static_cast<uint32_t>(packet_->time_ms() *
- (output_sample_rate_ / 1000))));
+ ASSERT_EQ(
+ 0, neteq_->InsertPacket(
+ packet_->header(),
+ rtc::ArrayView<const uint8_t>(
+ packet_->payload(), packet_->payload_length_bytes())));
}
// Get next packet.
packet_ = rtp_source_->NextPacket();
@@ -547,7 +545,7 @@
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));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
}
// Pull out all data.
for (size_t i = 0; i < num_frames; ++i) {
@@ -598,7 +596,7 @@
uint8_t payload[kPayloadBytes] = {0};
RTPHeader rtp_info;
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
++seq_no;
timestamp += kSamples;
next_input_time_ms += static_cast<double>(kFrameSizeMs) * drift_factor;
@@ -625,9 +623,8 @@
size_t payload_len;
RTPHeader rtp_info;
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
- ASSERT_EQ(0, neteq_->InsertPacket(
- rtp_info,
- rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView<const uint8_t>(
+ payload, payload_len)));
++seq_no;
timestamp += kCngPeriodSamples;
next_input_time_ms += static_cast<double>(kCngPeriodMs) * drift_factor;
@@ -668,9 +665,8 @@
size_t payload_len;
RTPHeader rtp_info;
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
- ASSERT_EQ(0, neteq_->InsertPacket(
- rtp_info,
- rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView<const uint8_t>(
+ payload, payload_len)));
++seq_no;
timestamp += kCngPeriodSamples;
next_input_time_ms += kCngPeriodMs * drift_factor;
@@ -686,7 +682,7 @@
uint8_t payload[kPayloadBytes] = {0};
RTPHeader rtp_info;
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
++seq_no;
timestamp += kSamples;
next_input_time_ms += kFrameSizeMs * drift_factor;
@@ -786,7 +782,7 @@
RTPHeader rtp_info;
PopulateRtpInfo(0, 0, &rtp_info);
rtp_info.payloadType = 1; // Not registered as a decoder.
- EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_info, payload, 0));
+ EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_info, payload));
}
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
@@ -801,7 +797,7 @@
RTPHeader rtp_info;
PopulateRtpInfo(0, 0, &rtp_info);
rtp_info.payloadType = 103; // iSAC, but the payload is invalid.
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
// Set all of |out_data_| to 1, and verify that it was set to 0 by the call
// to GetAudio.
int16_t* out_frame_data = out_frame_.mutable_data();
@@ -890,10 +886,8 @@
WebRtcPcm16b_Encode(block.data(), block.size(), payload);
ASSERT_EQ(enc_len_bytes, expected_samples_per_channel * 2);
- ASSERT_EQ(0, neteq_->InsertPacket(
- rtp_info,
- rtc::ArrayView<const uint8_t>(payload, enc_len_bytes),
- receive_timestamp));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView<const uint8_t>(
+ payload, enc_len_bytes)));
output.Reset();
ASSERT_EQ(0, neteq_->GetAudio(&output, &muted));
ASSERT_EQ(1u, output.num_channels_);
@@ -985,8 +979,7 @@
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, payload, receive_timestamp));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
++packets_inserted;
}
NetEqNetworkStatistics network_stats;
@@ -1074,7 +1067,7 @@
bool muted;
for (int i = 0; i < 3; ++i) {
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
++seq_no;
timestamp += kSamples;
@@ -1091,9 +1084,8 @@
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, rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView<const uint8_t>(
+ payload, payload_len)));
// Pull audio once and make sure CNG is played.
ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
@@ -1106,9 +1098,8 @@
// 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, rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView<const uint8_t>(
+ payload, payload_len)));
// Pull audio until we have played |kCngPeriodMs| of CNG. Start at 10 ms since
// we have already pulled out CNG once.
@@ -1126,7 +1117,7 @@
++seq_no;
timestamp += kCngPeriodSamples;
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
// Pull audio once and verify that the output is speech again.
ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
@@ -1157,10 +1148,9 @@
RTPHeader rtp_info;
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
- ASSERT_EQ(
- NetEq::kOK,
- neteq_->InsertPacket(
- rtp_info, 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)));
++seq_no;
timestamp += kCngPeriodSamples;
@@ -1176,7 +1166,7 @@
do {
ASSERT_LT(timeout_counter++, 20) << "Test timed out";
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
- ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
++seq_no;
timestamp += kSamples;
@@ -1202,7 +1192,7 @@
uint8_t payload[kPayloadBytes] = {0};
RTPHeader rtp_info;
PopulateRtpInfo(0, rtp_timestamp, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
}
void InsertCngPacket(uint32_t rtp_timestamp) {
@@ -1210,10 +1200,9 @@
RTPHeader rtp_info;
size_t payload_len;
PopulateCng(0, rtp_timestamp, &rtp_info, payload, &payload_len);
- EXPECT_EQ(
- NetEq::kOK,
- neteq_->InsertPacket(
- rtp_info, 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)));
}
bool GetAudioReturnMuted() {
@@ -1443,8 +1432,8 @@
uint8_t payload[kPayloadBytes] = {0};
RTPHeader rtp_info;
PopulateRtpInfo(0, 0, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
- EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload, 0));
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
+ EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload));
AudioFrame out_frame1, out_frame2;
bool muted;
@@ -1466,8 +1455,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, payload, 0));
- EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload, 0));
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
+ EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload));
int counter = 0;
while (out_frame1.speech_type_ != AudioFrame::kNormalSpeech) {
@@ -1508,7 +1497,7 @@
RTPHeader rtp_info;
constexpr uint32_t kRtpTimestamp = 0x1234;
PopulateRtpInfo(0, kRtpTimestamp, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
// Pull out data once.
AudioFrame output;
@@ -1534,10 +1523,10 @@
RTPHeader rtp_info;
constexpr uint32_t kRtpTimestamp1 = 0x1234;
PopulateRtpInfo(0, kRtpTimestamp1, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp1 + kPayloadSamples;
PopulateRtpInfo(1, kRtpTimestamp2, &rtp_info);
- EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
+ EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
// Pull out data once.
AudioFrame output;
@@ -1565,7 +1554,7 @@
for (int j = 0; j < 10; j++) {
rtp_info.sequenceNumber = seq_no++;
rtp_info.timestamp = rtp_info.sequenceNumber * kSamples;
- neteq_->InsertPacket(rtp_info, payload, 0);
+ neteq_->InsertPacket(rtp_info, payload);
neteq_->GetAudio(&out_frame_, &muted);
}
@@ -1604,7 +1593,7 @@
if (packets_sent < kNumPackets) {
rtp_info.sequenceNumber = packets_sent++;
rtp_info.timestamp = rtp_info.sequenceNumber * kSamples;
- neteq_->InsertPacket(rtp_info, payload, 0);
+ neteq_->InsertPacket(rtp_info, payload);
}
// Get packet.
@@ -1655,17 +1644,17 @@
rtp_info.markerBit = 0;
const uint8_t payload[kPayloadBytes] = {0};
- neteq_->InsertPacket(rtp_info, payload, 0);
+ neteq_->InsertPacket(rtp_info, payload);
bool muted;
neteq_->GetAudio(&out_frame_, &muted);
rtp_info.sequenceNumber += 1;
rtp_info.timestamp += kSamples;
- neteq_->InsertPacket(rtp_info, payload, 0);
+ neteq_->InsertPacket(rtp_info, payload);
rtp_info.sequenceNumber += 1;
rtp_info.timestamp += kSamples;
- neteq_->InsertPacket(rtp_info, payload, 0);
+ neteq_->InsertPacket(rtp_info, payload);
// We have two packets in the buffer and kAccelerate operation will
// extract 20 ms of data.
diff --git a/modules/audio_coding/neteq/tools/neteq_performance_test.cc b/modules/audio_coding/neteq/tools/neteq_performance_test.cc
index 604083b..dfd61d8 100644
--- a/modules/audio_coding/neteq/tools/neteq_performance_test.cc
+++ b/modules/audio_coding/neteq/tools/neteq_performance_test.cc
@@ -85,9 +85,7 @@
}
if (!lost) {
// Insert packet.
- int error =
- neteq->InsertPacket(rtp_header, input_payload,
- packet_input_time_ms * kSampRateHz / 1000);
+ int error = neteq->InsertPacket(rtp_header, input_payload);
if (error != NetEq::kOK)
return -1;
}
diff --git a/modules/audio_coding/neteq/tools/neteq_quality_test.cc b/modules/audio_coding/neteq/tools/neteq_quality_test.cc
index cd8754c..3b3d337 100644
--- a/modules/audio_coding/neteq/tools/neteq_quality_test.cc
+++ b/modules/audio_coding/neteq/tools/neteq_quality_test.cc
@@ -396,8 +396,7 @@
if (!PacketLost()) {
int ret = neteq_->InsertPacket(
rtp_header_,
- rtc::ArrayView<const uint8_t>(payload_.data(), payload_size_bytes_),
- packet_input_time_ms * in_sampling_khz_);
+ rtc::ArrayView<const uint8_t>(payload_.data(), payload_size_bytes_));
if (ret != NetEq::kOK)
return -1;
Log() << "was sent.";
diff --git a/modules/audio_coding/neteq/tools/neteq_test.cc b/modules/audio_coding/neteq/tools/neteq_test.cc
index 7e22823..c4fdef0 100644
--- a/modules/audio_coding/neteq/tools/neteq_test.cc
+++ b/modules/audio_coding/neteq/tools/neteq_test.cc
@@ -105,9 +105,7 @@
if (payload_data_length != 0) {
int error = neteq_->InsertPacket(
packet_data->header,
- rtc::ArrayView<const uint8_t>(packet_data->payload),
- static_cast<uint32_t>(packet_data->time_ms * sample_rate_hz_ /
- 1000));
+ rtc::ArrayView<const uint8_t>(packet_data->payload));
if (error != NetEq::kOK && callbacks_.error_callback) {
callbacks_.error_callback->OnInsertPacketError(*packet_data);
}