Revert of Change NetEq::InsertPacket to take an RTPHeader (patchset #2 id:20001 of https://codereview.webrtc.org/2807273004/ )
Reason for revert:
Broke downstream dependencies.
Original issue's description:
> Change NetEq::InsertPacket to take an RTPHeader
>
> It used to take a WebRtcRTPHeader as input, which has an RTPHeader as
> a member. None of the other member in WebRtcRTPHeader where used in
> NetEq.
>
> This CL adapts the production code; tests and tools will be converted
> in a follow-up CL.
>
> BUG=webrtc:7467
>
> Review-Url: https://codereview.webrtc.org/2807273004
> Cr-Commit-Position: refs/heads/master@{#17652}
> Committed: 4d027576a6
TBR=ivoc@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7467
Review-Url: https://codereview.webrtc.org/2812933002
Cr-Commit-Position: refs/heads/master@{#17657}
This commit is contained in:
committed by
Commit bot
parent
80ff00cd2b
commit
10d095d4f7
@ -104,8 +104,8 @@ int AcmReceiver::InsertPacket(const WebRtcRTPHeader& rtp_header,
|
|||||||
}
|
}
|
||||||
} // |crit_sect_| is released.
|
} // |crit_sect_| is released.
|
||||||
|
|
||||||
if (neteq_->InsertPacket(rtp_header.header, incoming_payload,
|
if (neteq_->InsertPacket(rtp_header, incoming_payload, receive_timestamp) <
|
||||||
receive_timestamp) < 0) {
|
0) {
|
||||||
LOG(LERROR) << "AcmReceiver::InsertPacket "
|
LOG(LERROR) << "AcmReceiver::InsertPacket "
|
||||||
<< static_cast<int>(header->payloadType)
|
<< static_cast<int>(header->payloadType)
|
||||||
<< " Failed to insert packet";
|
<< " Failed to insert packet";
|
||||||
|
|||||||
@ -26,6 +26,7 @@ namespace webrtc {
|
|||||||
|
|
||||||
// Forward declarations.
|
// Forward declarations.
|
||||||
class AudioFrame;
|
class AudioFrame;
|
||||||
|
struct WebRtcRTPHeader;
|
||||||
class AudioDecoderFactory;
|
class AudioDecoderFactory;
|
||||||
|
|
||||||
struct NetEqNetworkStatistics {
|
struct NetEqNetworkStatistics {
|
||||||
@ -140,7 +141,7 @@ class NetEq {
|
|||||||
// of the time when the packet was received, and should be measured with
|
// 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.
|
// the same tick rate as the RTP timestamp of the current payload.
|
||||||
// Returns 0 on success, -1 on failure.
|
// Returns 0 on success, -1 on failure.
|
||||||
virtual int InsertPacket(const RTPHeader& rtp_header,
|
virtual int InsertPacket(const WebRtcRTPHeader& rtp_header,
|
||||||
rtc::ArrayView<const uint8_t> payload,
|
rtc::ArrayView<const uint8_t> payload,
|
||||||
uint32_t receive_timestamp) = 0;
|
uint32_t receive_timestamp) = 0;
|
||||||
|
|
||||||
|
|||||||
@ -210,8 +210,8 @@ class NetEqExternalVsInternalDecoderTest : public NetEqExternalDecoderUnitTest,
|
|||||||
rtc::ArrayView<const uint8_t> payload,
|
rtc::ArrayView<const uint8_t> payload,
|
||||||
uint32_t receive_timestamp) override {
|
uint32_t receive_timestamp) override {
|
||||||
// Insert packet in internal decoder.
|
// Insert packet in internal decoder.
|
||||||
ASSERT_EQ(NetEq::kOK, neteq_internal_->InsertPacket(
|
ASSERT_EQ(NetEq::kOK, neteq_internal_->InsertPacket(rtp_header, payload,
|
||||||
rtp_header.header, payload, receive_timestamp));
|
receive_timestamp));
|
||||||
|
|
||||||
// Insert packet in external decoder instance.
|
// Insert packet in external decoder instance.
|
||||||
NetEqExternalDecoderUnitTest::InsertPacket(rtp_header, payload,
|
NetEqExternalDecoderUnitTest::InsertPacket(rtp_header, payload,
|
||||||
|
|||||||
@ -131,7 +131,7 @@ NetEqImpl::NetEqImpl(const NetEq::Config& config,
|
|||||||
|
|
||||||
NetEqImpl::~NetEqImpl() = default;
|
NetEqImpl::~NetEqImpl() = default;
|
||||||
|
|
||||||
int NetEqImpl::InsertPacket(const RTPHeader& rtp_header,
|
int NetEqImpl::InsertPacket(const WebRtcRTPHeader& rtp_header,
|
||||||
rtc::ArrayView<const uint8_t> payload,
|
rtc::ArrayView<const uint8_t> payload,
|
||||||
uint32_t receive_timestamp) {
|
uint32_t receive_timestamp) {
|
||||||
rtc::MsanCheckInitialized(payload);
|
rtc::MsanCheckInitialized(payload);
|
||||||
@ -581,7 +581,7 @@ Operations NetEqImpl::last_operation_for_test() const {
|
|||||||
|
|
||||||
// Methods below this line are private.
|
// Methods below this line are private.
|
||||||
|
|
||||||
int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
|
int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||||
rtc::ArrayView<const uint8_t> payload,
|
rtc::ArrayView<const uint8_t> payload,
|
||||||
uint32_t receive_timestamp) {
|
uint32_t receive_timestamp) {
|
||||||
if (payload.empty()) {
|
if (payload.empty()) {
|
||||||
@ -594,24 +594,24 @@ int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
|
|||||||
packet_list.push_back([&rtp_header, &payload] {
|
packet_list.push_back([&rtp_header, &payload] {
|
||||||
// Convert to Packet.
|
// Convert to Packet.
|
||||||
Packet packet;
|
Packet packet;
|
||||||
packet.payload_type = rtp_header.payloadType;
|
packet.payload_type = rtp_header.header.payloadType;
|
||||||
packet.sequence_number = rtp_header.sequenceNumber;
|
packet.sequence_number = rtp_header.header.sequenceNumber;
|
||||||
packet.timestamp = rtp_header.timestamp;
|
packet.timestamp = rtp_header.header.timestamp;
|
||||||
packet.payload.SetData(payload.data(), payload.size());
|
packet.payload.SetData(payload.data(), payload.size());
|
||||||
// Waiting time will be set upon inserting the packet in the buffer.
|
// Waiting time will be set upon inserting the packet in the buffer.
|
||||||
RTC_DCHECK(!packet.waiting_time);
|
RTC_DCHECK(!packet.waiting_time);
|
||||||
return packet;
|
return packet;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
bool update_sample_rate_and_channels =
|
bool update_sample_rate_and_channels = first_packet_ ||
|
||||||
first_packet_ || (rtp_header.ssrc != ssrc_);
|
(rtp_header.header.ssrc != ssrc_);
|
||||||
|
|
||||||
if (update_sample_rate_and_channels) {
|
if (update_sample_rate_and_channels) {
|
||||||
// Reset timestamp scaling.
|
// Reset timestamp scaling.
|
||||||
timestamp_scaler_->Reset();
|
timestamp_scaler_->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!decoder_database_->IsRed(rtp_header.payloadType)) {
|
if (!decoder_database_->IsRed(rtp_header.header.payloadType)) {
|
||||||
// Scale timestamp to internal domain (only for some codecs).
|
// Scale timestamp to internal domain (only for some codecs).
|
||||||
timestamp_scaler_->ToInternal(&packet_list);
|
timestamp_scaler_->ToInternal(&packet_list);
|
||||||
}
|
}
|
||||||
@ -627,14 +627,14 @@ int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
|
|||||||
// Note: |first_packet_| will be cleared further down in this method, once
|
// Note: |first_packet_| will be cleared further down in this method, once
|
||||||
// the packet has been successfully inserted into the packet buffer.
|
// the packet has been successfully inserted into the packet buffer.
|
||||||
|
|
||||||
rtcp_.Init(rtp_header.sequenceNumber);
|
rtcp_.Init(rtp_header.header.sequenceNumber);
|
||||||
|
|
||||||
// Flush the packet buffer and DTMF buffer.
|
// Flush the packet buffer and DTMF buffer.
|
||||||
packet_buffer_->Flush();
|
packet_buffer_->Flush();
|
||||||
dtmf_buffer_->Flush();
|
dtmf_buffer_->Flush();
|
||||||
|
|
||||||
// Store new SSRC.
|
// Store new SSRC.
|
||||||
ssrc_ = rtp_header.ssrc;
|
ssrc_ = rtp_header.header.ssrc;
|
||||||
|
|
||||||
// Update audio buffer timestamp.
|
// Update audio buffer timestamp.
|
||||||
sync_buffer_->IncreaseEndTimestamp(main_timestamp - timestamp_);
|
sync_buffer_->IncreaseEndTimestamp(main_timestamp - timestamp_);
|
||||||
@ -644,19 +644,19 @@ int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update RTCP statistics, only for regular packets.
|
// Update RTCP statistics, only for regular packets.
|
||||||
rtcp_.Update(rtp_header, receive_timestamp);
|
rtcp_.Update(rtp_header.header, receive_timestamp);
|
||||||
|
|
||||||
if (nack_enabled_) {
|
if (nack_enabled_) {
|
||||||
RTC_DCHECK(nack_);
|
RTC_DCHECK(nack_);
|
||||||
if (update_sample_rate_and_channels) {
|
if (update_sample_rate_and_channels) {
|
||||||
nack_->Reset();
|
nack_->Reset();
|
||||||
}
|
}
|
||||||
nack_->UpdateLastReceivedPacket(rtp_header.sequenceNumber,
|
nack_->UpdateLastReceivedPacket(rtp_header.header.sequenceNumber,
|
||||||
rtp_header.timestamp);
|
rtp_header.header.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for RED payload type, and separate payloads into several packets.
|
// Check for RED payload type, and separate payloads into several packets.
|
||||||
if (decoder_database_->IsRed(rtp_header.payloadType)) {
|
if (decoder_database_->IsRed(rtp_header.header.payloadType)) {
|
||||||
if (!red_payload_splitter_->SplitRed(&packet_list)) {
|
if (!red_payload_splitter_->SplitRed(&packet_list)) {
|
||||||
return kRedundancySplitError;
|
return kRedundancySplitError;
|
||||||
}
|
}
|
||||||
@ -675,7 +675,7 @@ int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
|
|||||||
|
|
||||||
// Update main_timestamp, if new packets appear in the list
|
// Update main_timestamp, if new packets appear in the list
|
||||||
// after RED splitting.
|
// after RED splitting.
|
||||||
if (decoder_database_->IsRed(rtp_header.payloadType)) {
|
if (decoder_database_->IsRed(rtp_header.header.payloadType)) {
|
||||||
timestamp_scaler_->ToInternal(&packet_list);
|
timestamp_scaler_->ToInternal(&packet_list);
|
||||||
main_timestamp = packet_list.front().timestamp;
|
main_timestamp = packet_list.front().timestamp;
|
||||||
main_payload_type = packet_list.front().payload_type;
|
main_payload_type = packet_list.front().payload_type;
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class NetEqImpl : public webrtc::NetEq {
|
|||||||
// of the time when the packet was received, and should be measured with
|
// 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.
|
// the same tick rate as the RTP timestamp of the current payload.
|
||||||
// Returns 0 on success, -1 on failure.
|
// Returns 0 on success, -1 on failure.
|
||||||
int InsertPacket(const RTPHeader& rtp_header,
|
int InsertPacket(const WebRtcRTPHeader& rtp_header,
|
||||||
rtc::ArrayView<const uint8_t> payload,
|
rtc::ArrayView<const uint8_t> payload,
|
||||||
uint32_t receive_timestamp) override;
|
uint32_t receive_timestamp) override;
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ class NetEqImpl : public webrtc::NetEq {
|
|||||||
// Inserts a new packet into NetEq. This is used by the InsertPacket method
|
// Inserts a new packet into NetEq. This is used by the InsertPacket method
|
||||||
// above. Returns 0 on success, otherwise an error code.
|
// above. Returns 0 on success, otherwise an error code.
|
||||||
// TODO(hlundin): Merge this with InsertPacket above?
|
// TODO(hlundin): Merge this with InsertPacket above?
|
||||||
int InsertPacketInternal(const RTPHeader& rtp_header,
|
int InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
|
||||||
rtc::ArrayView<const uint8_t> payload,
|
rtc::ArrayView<const uint8_t> payload,
|
||||||
uint32_t receive_timestamp)
|
uint32_t receive_timestamp)
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
|
||||||
|
|||||||
@ -193,7 +193,7 @@ class NetEqImplTest : public ::testing::Test {
|
|||||||
|
|
||||||
// Insert first packet.
|
// Insert first packet.
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
|
|
||||||
// Pull audio once.
|
// Pull audio once.
|
||||||
const size_t kMaxOutputSize =
|
const size_t kMaxOutputSize =
|
||||||
@ -384,12 +384,12 @@ TEST_F(NetEqImplTest, InsertPacket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert first packet.
|
// Insert first packet.
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kFirstReceiveTime);
|
neteq_->InsertPacket(rtp_header, payload, kFirstReceiveTime);
|
||||||
|
|
||||||
// Insert second packet.
|
// Insert second packet.
|
||||||
rtp_header.header.timestamp += 160;
|
rtp_header.header.timestamp += 160;
|
||||||
rtp_header.header.sequenceNumber += 1;
|
rtp_header.header.sequenceNumber += 1;
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kFirstReceiveTime + 155);
|
neteq_->InsertPacket(rtp_header, payload, kFirstReceiveTime + 155);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(NetEqImplTest, InsertPacketsUntilBufferIsFull) {
|
TEST_F(NetEqImplTest, InsertPacketsUntilBufferIsFull) {
|
||||||
@ -413,7 +413,7 @@ TEST_F(NetEqImplTest, InsertPacketsUntilBufferIsFull) {
|
|||||||
// Insert packets. The buffer should not flush.
|
// Insert packets. The buffer should not flush.
|
||||||
for (size_t i = 1; i <= config_.max_packets_in_buffer; ++i) {
|
for (size_t i = 1; i <= config_.max_packets_in_buffer; ++i) {
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
rtp_header.header.timestamp += kPayloadLengthSamples;
|
rtp_header.header.timestamp += kPayloadLengthSamples;
|
||||||
rtp_header.header.sequenceNumber += 1;
|
rtp_header.header.sequenceNumber += 1;
|
||||||
EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer());
|
EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer());
|
||||||
@ -422,7 +422,7 @@ TEST_F(NetEqImplTest, InsertPacketsUntilBufferIsFull) {
|
|||||||
// Insert one more packet and make sure the buffer got flushed. That is, it
|
// Insert one more packet and make sure the buffer got flushed. That is, it
|
||||||
// should only hold one single packet.
|
// should only hold one single packet.
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
EXPECT_EQ(1u, packet_buffer_->NumPacketsInBuffer());
|
EXPECT_EQ(1u, packet_buffer_->NumPacketsInBuffer());
|
||||||
const Packet* test_packet = packet_buffer_->PeekNextPacket();
|
const Packet* test_packet = packet_buffer_->PeekNextPacket();
|
||||||
EXPECT_EQ(rtp_header.header.timestamp, test_packet->timestamp);
|
EXPECT_EQ(rtp_header.header.timestamp, test_packet->timestamp);
|
||||||
@ -502,7 +502,7 @@ TEST_F(NetEqImplTest, VerifyTimestampPropagation) {
|
|||||||
|
|
||||||
// Insert one packet.
|
// Insert one packet.
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
|
|
||||||
// Pull audio once.
|
// Pull audio once.
|
||||||
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000);
|
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000);
|
||||||
@ -583,7 +583,7 @@ TEST_F(NetEqImplTest, ReorderedPacket) {
|
|||||||
|
|
||||||
// Insert one packet.
|
// Insert one packet.
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
|
|
||||||
// Pull audio once.
|
// Pull audio once.
|
||||||
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000);
|
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000);
|
||||||
@ -600,12 +600,12 @@ TEST_F(NetEqImplTest, ReorderedPacket) {
|
|||||||
rtp_header.header.timestamp -= kPayloadLengthSamples;
|
rtp_header.header.timestamp -= kPayloadLengthSamples;
|
||||||
payload[0] = 1;
|
payload[0] = 1;
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
rtp_header.header.sequenceNumber += 2;
|
rtp_header.header.sequenceNumber += 2;
|
||||||
rtp_header.header.timestamp += 2 * kPayloadLengthSamples;
|
rtp_header.header.timestamp += 2 * kPayloadLengthSamples;
|
||||||
payload[0] = 2;
|
payload[0] = 2;
|
||||||
EXPECT_EQ(NetEq::kOK,
|
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
|
// Expect only the second packet to be decoded (the one with "2" as the first
|
||||||
// payload byte).
|
// payload byte).
|
||||||
@ -651,7 +651,7 @@ TEST_F(NetEqImplTest, FirstPacketUnknown) {
|
|||||||
// Insert one packet. Note that we have not registered any payload type, so
|
// Insert one packet. Note that we have not registered any payload type, so
|
||||||
// this packet will be rejected.
|
// this packet will be rejected.
|
||||||
EXPECT_EQ(NetEq::kFail,
|
EXPECT_EQ(NetEq::kFail,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
|
EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
|
||||||
|
|
||||||
// Pull audio once.
|
// Pull audio once.
|
||||||
@ -673,7 +673,7 @@ TEST_F(NetEqImplTest, FirstPacketUnknown) {
|
|||||||
rtp_header.header.sequenceNumber++;
|
rtp_header.header.sequenceNumber++;
|
||||||
rtp_header.header.timestamp += kPayloadLengthSamples;
|
rtp_header.header.timestamp += kPayloadLengthSamples;
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
EXPECT_EQ(i + 1, packet_buffer_->NumPacketsInBuffer());
|
EXPECT_EQ(i + 1, packet_buffer_->NumPacketsInBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -760,14 +760,14 @@ TEST_F(NetEqImplTest, CodecInternalCng) {
|
|||||||
|
|
||||||
// Insert one packet (decoder will return speech).
|
// Insert one packet (decoder will return speech).
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
|
|
||||||
// Insert second packet (decoder will return CNG).
|
// Insert second packet (decoder will return CNG).
|
||||||
payload[0] = 1;
|
payload[0] = 1;
|
||||||
rtp_header.header.sequenceNumber++;
|
rtp_header.header.sequenceNumber++;
|
||||||
rtp_header.header.timestamp += kPayloadLengthSamples;
|
rtp_header.header.timestamp += kPayloadLengthSamples;
|
||||||
EXPECT_EQ(NetEq::kOK,
|
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);
|
const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateKhz);
|
||||||
AudioFrame output;
|
AudioFrame output;
|
||||||
@ -818,7 +818,7 @@ TEST_F(NetEqImplTest, CodecInternalCng) {
|
|||||||
rtp_header.header.sequenceNumber += 2;
|
rtp_header.header.sequenceNumber += 2;
|
||||||
rtp_header.header.timestamp += 2 * kPayloadLengthSamples;
|
rtp_header.header.timestamp += 2 * kPayloadLengthSamples;
|
||||||
EXPECT_EQ(NetEq::kOK,
|
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) {
|
for (size_t i = 6; i < 8; ++i) {
|
||||||
ASSERT_EQ(kMaxOutputSize, output.samples_per_channel_);
|
ASSERT_EQ(kMaxOutputSize, output.samples_per_channel_);
|
||||||
@ -896,7 +896,7 @@ TEST_F(NetEqImplTest, UnsupportedDecoder) {
|
|||||||
// Insert one packet.
|
// Insert one packet.
|
||||||
payload[0] = kFirstPayloadValue; // This will make Decode() fail.
|
payload[0] = kFirstPayloadValue; // This will make Decode() fail.
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
|
|
||||||
// Insert another packet.
|
// Insert another packet.
|
||||||
payload[0] = kSecondPayloadValue; // This will make Decode() successful.
|
payload[0] = kSecondPayloadValue; // This will make Decode() successful.
|
||||||
@ -905,7 +905,7 @@ TEST_F(NetEqImplTest, UnsupportedDecoder) {
|
|||||||
// the second packet get decoded.
|
// the second packet get decoded.
|
||||||
rtp_header.header.timestamp += 3 * kPayloadLengthSamples;
|
rtp_header.header.timestamp += 3 * kPayloadLengthSamples;
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
|
|
||||||
AudioFrame output;
|
AudioFrame output;
|
||||||
bool muted;
|
bool muted;
|
||||||
@ -957,7 +957,7 @@ TEST_F(NetEqImplTest, FloodBufferAndGetNetworkStats) {
|
|||||||
for (size_t i = 0; i <= config_.max_packets_in_buffer; ++i) {
|
for (size_t i = 0; i <= config_.max_packets_in_buffer; ++i) {
|
||||||
EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer());
|
EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer());
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
rtp_header.header.timestamp +=
|
rtp_header.header.timestamp +=
|
||||||
rtc::checked_cast<uint32_t>(kPayloadLengthSamples);
|
rtc::checked_cast<uint32_t>(kPayloadLengthSamples);
|
||||||
++rtp_header.header.sequenceNumber;
|
++rtp_header.header.sequenceNumber;
|
||||||
@ -1013,7 +1013,7 @@ TEST_F(NetEqImplTest, DecodedPayloadTooShort) {
|
|||||||
|
|
||||||
// Insert one packet.
|
// Insert one packet.
|
||||||
EXPECT_EQ(NetEq::kOK,
|
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());
|
EXPECT_EQ(5u, neteq_->sync_buffer_for_test()->FutureLength());
|
||||||
|
|
||||||
@ -1109,7 +1109,7 @@ TEST_F(NetEqImplTest, DecodingError) {
|
|||||||
rtp_header.header.sequenceNumber += 1;
|
rtp_header.header.sequenceNumber += 1;
|
||||||
rtp_header.header.timestamp += kFrameLengthSamples;
|
rtp_header.header.timestamp += kFrameLengthSamples;
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pull audio.
|
// Pull audio.
|
||||||
@ -1221,7 +1221,7 @@ TEST_F(NetEqImplTest, DecodingErrorDuringInternalCng) {
|
|||||||
rtp_header.header.sequenceNumber += 1;
|
rtp_header.header.sequenceNumber += 1;
|
||||||
rtp_header.header.timestamp += kFrameLengthSamples;
|
rtp_header.header.timestamp += kFrameLengthSamples;
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(NetEq::kOK,
|
||||||
neteq_->InsertPacket(rtp_header.header, payload, kReceiveTime));
|
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pull audio.
|
// Pull audio.
|
||||||
@ -1341,7 +1341,7 @@ class NetEqImplTest120ms : public NetEqImplTest {
|
|||||||
rtp_header.header.ssrc = 15;
|
rtp_header.header.ssrc = 15;
|
||||||
const size_t kPayloadLengthBytes = 1; // This can be arbitrary.
|
const size_t kPayloadLengthBytes = 1; // This can be arbitrary.
|
||||||
uint8_t payload[kPayloadLengthBytes] = {0};
|
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_++;
|
sequence_number_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -197,15 +197,14 @@ class NetEqStereoTest : public ::testing::TestWithParam<TestParameters> {
|
|||||||
while (time_now >= next_arrival_time) {
|
while (time_now >= next_arrival_time) {
|
||||||
// Insert packet in mono instance.
|
// Insert packet in mono instance.
|
||||||
ASSERT_EQ(NetEq::kOK,
|
ASSERT_EQ(NetEq::kOK,
|
||||||
neteq_mono_->InsertPacket(rtp_header_mono_.header,
|
neteq_mono_->InsertPacket(rtp_header_mono_,
|
||||||
rtc::ArrayView<const uint8_t>(
|
rtc::ArrayView<const uint8_t>(
|
||||||
encoded_, payload_size_bytes_),
|
encoded_, payload_size_bytes_),
|
||||||
next_arrival_time));
|
next_arrival_time));
|
||||||
// Insert packet in multi-channel instance.
|
// Insert packet in multi-channel instance.
|
||||||
ASSERT_EQ(NetEq::kOK,
|
ASSERT_EQ(NetEq::kOK, neteq_->InsertPacket(
|
||||||
neteq_->InsertPacket(
|
rtp_header_, rtc::ArrayView<const uint8_t>(
|
||||||
rtp_header_.header,
|
encoded_multi_channel_,
|
||||||
rtc::ArrayView<const uint8_t>(encoded_multi_channel_,
|
|
||||||
multi_payload_size_bytes_),
|
multi_payload_size_bytes_),
|
||||||
next_arrival_time));
|
next_arrival_time));
|
||||||
// Get next input packets (mono and multi-channel).
|
// Get next input packets (mono and multi-channel).
|
||||||
|
|||||||
@ -324,9 +324,8 @@ void NetEqDecodingTest::Process() {
|
|||||||
// Ignore payload type 104 (iSAC-swb) if ISAC is not supported.
|
// Ignore payload type 104 (iSAC-swb) if ISAC is not supported.
|
||||||
if (rtp_header.header.payloadType != 104)
|
if (rtp_header.header.payloadType != 104)
|
||||||
#endif
|
#endif
|
||||||
ASSERT_EQ(0,
|
ASSERT_EQ(0, neteq_->InsertPacket(
|
||||||
neteq_->InsertPacket(
|
rtp_header,
|
||||||
rtp_header.header,
|
|
||||||
rtc::ArrayView<const uint8_t>(
|
rtc::ArrayView<const uint8_t>(
|
||||||
packet_->payload(), packet_->payload_length_bytes()),
|
packet_->payload(), packet_->payload_length_bytes()),
|
||||||
static_cast<uint32_t>(packet_->time_ms() *
|
static_cast<uint32_t>(packet_->time_ms() *
|
||||||
@ -527,7 +526,7 @@ TEST_F(NetEqDecodingTestFaxMode, TestFrameWaitingTimeStatistics) {
|
|||||||
rtp_info.header.ssrc = 0x1234; // Just an arbitrary SSRC.
|
rtp_info.header.ssrc = 0x1234; // Just an arbitrary SSRC.
|
||||||
rtp_info.header.payloadType = 94; // PCM16b WB codec.
|
rtp_info.header.payloadType = 94; // PCM16b WB codec.
|
||||||
rtp_info.header.markerBit = 0;
|
rtp_info.header.markerBit = 0;
|
||||||
ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
|
ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
|
||||||
}
|
}
|
||||||
// Pull out all data.
|
// Pull out all data.
|
||||||
for (size_t i = 0; i < num_frames; ++i) {
|
for (size_t i = 0; i < num_frames; ++i) {
|
||||||
@ -568,7 +567,7 @@ TEST_F(NetEqDecodingTest, TestAverageInterArrivalTimeNegative) {
|
|||||||
uint8_t payload[kPayloadBytes] = {0};
|
uint8_t payload[kPayloadBytes] = {0};
|
||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
PopulateRtpInfo(frame_index, frame_index * kSamples, &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;
|
++frame_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,7 +595,7 @@ TEST_F(NetEqDecodingTest, TestAverageInterArrivalTimePositive) {
|
|||||||
uint8_t payload[kPayloadBytes] = {0};
|
uint8_t payload[kPayloadBytes] = {0};
|
||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
PopulateRtpInfo(frame_index, frame_index * kSamples, &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;
|
++frame_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +633,7 @@ void NetEqDecodingTest::LongCngWithClockDrift(double drift_factor,
|
|||||||
uint8_t payload[kPayloadBytes] = {0};
|
uint8_t payload[kPayloadBytes] = {0};
|
||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
PopulateRtpInfo(seq_no, timestamp, &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;
|
++seq_no;
|
||||||
timestamp += kSamples;
|
timestamp += kSamples;
|
||||||
next_input_time_ms += static_cast<double>(kFrameSizeMs) * drift_factor;
|
next_input_time_ms += static_cast<double>(kFrameSizeMs) * drift_factor;
|
||||||
@ -662,7 +661,7 @@ void NetEqDecodingTest::LongCngWithClockDrift(double drift_factor,
|
|||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
|
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
|
||||||
ASSERT_EQ(0, neteq_->InsertPacket(
|
ASSERT_EQ(0, neteq_->InsertPacket(
|
||||||
rtp_info.header,
|
rtp_info,
|
||||||
rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
||||||
++seq_no;
|
++seq_no;
|
||||||
timestamp += kCngPeriodSamples;
|
timestamp += kCngPeriodSamples;
|
||||||
@ -705,7 +704,7 @@ void NetEqDecodingTest::LongCngWithClockDrift(double drift_factor,
|
|||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
|
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
|
||||||
ASSERT_EQ(0, neteq_->InsertPacket(
|
ASSERT_EQ(0, neteq_->InsertPacket(
|
||||||
rtp_info.header,
|
rtp_info,
|
||||||
rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
||||||
++seq_no;
|
++seq_no;
|
||||||
timestamp += kCngPeriodSamples;
|
timestamp += kCngPeriodSamples;
|
||||||
@ -722,7 +721,7 @@ void NetEqDecodingTest::LongCngWithClockDrift(double drift_factor,
|
|||||||
uint8_t payload[kPayloadBytes] = {0};
|
uint8_t payload[kPayloadBytes] = {0};
|
||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
PopulateRtpInfo(seq_no, timestamp, &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;
|
++seq_no;
|
||||||
timestamp += kSamples;
|
timestamp += kSamples;
|
||||||
next_input_time_ms += kFrameSizeMs * drift_factor;
|
next_input_time_ms += kFrameSizeMs * drift_factor;
|
||||||
@ -834,7 +833,7 @@ TEST_F(NetEqDecodingTest, UnknownPayloadType) {
|
|||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
PopulateRtpInfo(0, 0, &rtp_info);
|
PopulateRtpInfo(0, 0, &rtp_info);
|
||||||
rtp_info.header.payloadType = 1; // Not registered as a decoder.
|
rtp_info.header.payloadType = 1; // Not registered as a decoder.
|
||||||
EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_info.header, payload, 0));
|
EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_info, payload, 0));
|
||||||
EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
|
EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -850,7 +849,7 @@ TEST_F(NetEqDecodingTest, MAYBE_DecoderError) {
|
|||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
PopulateRtpInfo(0, 0, &rtp_info);
|
PopulateRtpInfo(0, 0, &rtp_info);
|
||||||
rtp_info.header.payloadType = 103; // iSAC, but the payload is invalid.
|
rtp_info.header.payloadType = 103; // iSAC, but the payload is invalid.
|
||||||
EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
|
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
|
// Set all of |out_data_| to 1, and verify that it was set to 0 by the call
|
||||||
// to GetAudio.
|
// to GetAudio.
|
||||||
for (size_t i = 0; i < AudioFrame::kMaxDataSizeSamples; ++i) {
|
for (size_t i = 0; i < AudioFrame::kMaxDataSizeSamples; ++i) {
|
||||||
@ -957,9 +956,8 @@ class NetEqBgnTest : public NetEqDecodingTest {
|
|||||||
WebRtcPcm16b_Encode(block.data(), block.size(), payload);
|
WebRtcPcm16b_Encode(block.data(), block.size(), payload);
|
||||||
ASSERT_EQ(enc_len_bytes, expected_samples_per_channel * 2);
|
ASSERT_EQ(enc_len_bytes, expected_samples_per_channel * 2);
|
||||||
|
|
||||||
ASSERT_EQ(0, neteq_->InsertPacket(
|
ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView<const uint8_t>(
|
||||||
rtp_info.header,
|
payload, enc_len_bytes),
|
||||||
rtc::ArrayView<const uint8_t>(payload, enc_len_bytes),
|
|
||||||
receive_timestamp));
|
receive_timestamp));
|
||||||
output.Reset();
|
output.Reset();
|
||||||
ASSERT_EQ(0, neteq_->GetAudio(&output, &muted));
|
ASSERT_EQ(0, neteq_->GetAudio(&output, &muted));
|
||||||
@ -1094,8 +1092,8 @@ void NetEqDecodingTest::WrapTest(uint16_t start_seq_no,
|
|||||||
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
|
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
|
||||||
if (drop_seq_numbers.find(seq_no) == drop_seq_numbers.end()) {
|
if (drop_seq_numbers.find(seq_no) == drop_seq_numbers.end()) {
|
||||||
// This sequence number was not in the set to drop. Insert it.
|
// This sequence number was not in the set to drop. Insert it.
|
||||||
ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload,
|
ASSERT_EQ(0,
|
||||||
receive_timestamp));
|
neteq_->InsertPacket(rtp_info, payload, receive_timestamp));
|
||||||
++packets_inserted;
|
++packets_inserted;
|
||||||
}
|
}
|
||||||
NetEqNetworkStatistics network_stats;
|
NetEqNetworkStatistics network_stats;
|
||||||
@ -1183,7 +1181,7 @@ void NetEqDecodingTest::DuplicateCng() {
|
|||||||
bool muted;
|
bool muted;
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
PopulateRtpInfo(seq_no, timestamp, &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;
|
++seq_no;
|
||||||
timestamp += kSamples;
|
timestamp += kSamples;
|
||||||
|
|
||||||
@ -1200,9 +1198,9 @@ void NetEqDecodingTest::DuplicateCng() {
|
|||||||
size_t payload_len;
|
size_t payload_len;
|
||||||
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
|
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
|
||||||
// This is the first time this CNG packet is inserted.
|
// This is the first time this CNG packet is inserted.
|
||||||
ASSERT_EQ(0, neteq_->InsertPacket(
|
ASSERT_EQ(
|
||||||
rtp_info.header,
|
0, neteq_->InsertPacket(
|
||||||
rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
||||||
|
|
||||||
// Pull audio once and make sure CNG is played.
|
// Pull audio once and make sure CNG is played.
|
||||||
ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
|
ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
|
||||||
@ -1214,9 +1212,9 @@ void NetEqDecodingTest::DuplicateCng() {
|
|||||||
|
|
||||||
// Insert the same CNG packet again. Note that at this point it is old, since
|
// Insert the same CNG packet again. Note that at this point it is old, since
|
||||||
// we have already decoded the first copy of it.
|
// we have already decoded the first copy of it.
|
||||||
ASSERT_EQ(0, neteq_->InsertPacket(
|
ASSERT_EQ(
|
||||||
rtp_info.header,
|
0, neteq_->InsertPacket(
|
||||||
rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
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
|
// Pull audio until we have played |kCngPeriodMs| of CNG. Start at 10 ms since
|
||||||
// we have already pulled out CNG once.
|
// we have already pulled out CNG once.
|
||||||
@ -1233,7 +1231,7 @@ void NetEqDecodingTest::DuplicateCng() {
|
|||||||
++seq_no;
|
++seq_no;
|
||||||
timestamp += kCngPeriodSamples;
|
timestamp += kCngPeriodSamples;
|
||||||
PopulateRtpInfo(seq_no, timestamp, &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));
|
||||||
|
|
||||||
// Pull audio once and verify that the output is speech again.
|
// Pull audio once and verify that the output is speech again.
|
||||||
ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
|
ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
|
||||||
@ -1266,10 +1264,10 @@ TEST_F(NetEqDecodingTest, CngFirst) {
|
|||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
|
|
||||||
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
|
PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
|
||||||
ASSERT_EQ(NetEq::kOK,
|
ASSERT_EQ(
|
||||||
|
NetEq::kOK,
|
||||||
neteq_->InsertPacket(
|
neteq_->InsertPacket(
|
||||||
rtp_info.header,
|
rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
||||||
rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
|
||||||
++seq_no;
|
++seq_no;
|
||||||
timestamp += kCngPeriodSamples;
|
timestamp += kCngPeriodSamples;
|
||||||
|
|
||||||
@ -1285,7 +1283,7 @@ TEST_F(NetEqDecodingTest, CngFirst) {
|
|||||||
do {
|
do {
|
||||||
ASSERT_LT(timeout_counter++, 20) << "Test timed out";
|
ASSERT_LT(timeout_counter++, 20) << "Test timed out";
|
||||||
PopulateRtpInfo(seq_no, timestamp, &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;
|
++seq_no;
|
||||||
timestamp += kSamples;
|
timestamp += kSamples;
|
||||||
|
|
||||||
@ -1311,7 +1309,7 @@ class NetEqDecodingTestWithMutedState : public NetEqDecodingTest {
|
|||||||
uint8_t payload[kPayloadBytes] = {0};
|
uint8_t payload[kPayloadBytes] = {0};
|
||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
PopulateRtpInfo(0, rtp_timestamp, &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) {
|
void InsertCngPacket(uint32_t rtp_timestamp) {
|
||||||
@ -1319,10 +1317,10 @@ class NetEqDecodingTestWithMutedState : public NetEqDecodingTest {
|
|||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
size_t payload_len;
|
size_t payload_len;
|
||||||
PopulateCng(0, rtp_timestamp, &rtp_info, payload, &payload_len);
|
PopulateCng(0, rtp_timestamp, &rtp_info, payload, &payload_len);
|
||||||
EXPECT_EQ(NetEq::kOK,
|
EXPECT_EQ(
|
||||||
|
NetEq::kOK,
|
||||||
neteq_->InsertPacket(
|
neteq_->InsertPacket(
|
||||||
rtp_info.header,
|
rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
||||||
rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetAudioReturnMuted() {
|
bool GetAudioReturnMuted() {
|
||||||
@ -1547,8 +1545,8 @@ TEST_F(NetEqDecodingTestTwoInstances, CompareMutedStateOnOff) {
|
|||||||
uint8_t payload[kPayloadBytes] = {0};
|
uint8_t payload[kPayloadBytes] = {0};
|
||||||
WebRtcRTPHeader rtp_info;
|
WebRtcRTPHeader rtp_info;
|
||||||
PopulateRtpInfo(0, 0, &rtp_info);
|
PopulateRtpInfo(0, 0, &rtp_info);
|
||||||
EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
|
EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
|
||||||
EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info.header, payload, 0));
|
EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload, 0));
|
||||||
|
|
||||||
AudioFrame out_frame1, out_frame2;
|
AudioFrame out_frame1, out_frame2;
|
||||||
bool muted;
|
bool muted;
|
||||||
@ -1570,8 +1568,8 @@ TEST_F(NetEqDecodingTestTwoInstances, CompareMutedStateOnOff) {
|
|||||||
// Insert new data. Timestamp is corrected for the time elapsed since the last
|
// Insert new data. Timestamp is corrected for the time elapsed since the last
|
||||||
// packet.
|
// packet.
|
||||||
PopulateRtpInfo(0, kSamples * 1000, &rtp_info);
|
PopulateRtpInfo(0, kSamples * 1000, &rtp_info);
|
||||||
EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
|
EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
|
||||||
EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info.header, payload, 0));
|
EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload, 0));
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
while (out_frame1.speech_type_ != AudioFrame::kNormalSpeech) {
|
while (out_frame1.speech_type_ != AudioFrame::kNormalSpeech) {
|
||||||
|
|||||||
@ -40,8 +40,8 @@ void NetEqExternalDecoderTest::InsertPacket(
|
|||||||
WebRtcRTPHeader rtp_header,
|
WebRtcRTPHeader rtp_header,
|
||||||
rtc::ArrayView<const uint8_t> payload,
|
rtc::ArrayView<const uint8_t> payload,
|
||||||
uint32_t receive_timestamp) {
|
uint32_t receive_timestamp) {
|
||||||
ASSERT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header.header, payload,
|
ASSERT_EQ(NetEq::kOK,
|
||||||
receive_timestamp));
|
neteq_->InsertPacket(rtp_header, payload, receive_timestamp));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetEqExternalDecoderTest::GetOutputAudio(AudioFrame* output) {
|
void NetEqExternalDecoderTest::GetOutputAudio(AudioFrame* output) {
|
||||||
|
|||||||
@ -88,7 +88,7 @@ int64_t NetEqPerformanceTest::Run(int runtime_ms,
|
|||||||
if (!lost) {
|
if (!lost) {
|
||||||
// Insert packet.
|
// Insert packet.
|
||||||
int error =
|
int error =
|
||||||
neteq->InsertPacket(rtp_header.header, input_payload,
|
neteq->InsertPacket(rtp_header, input_payload,
|
||||||
packet_input_time_ms * kSampRateHz / 1000);
|
packet_input_time_ms * kSampRateHz / 1000);
|
||||||
if (error != NetEq::kOK)
|
if (error != NetEq::kOK)
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -380,7 +380,7 @@ int NetEqQualityTest::Transmit() {
|
|||||||
if (payload_size_bytes_ > 0) {
|
if (payload_size_bytes_ > 0) {
|
||||||
if (!PacketLost()) {
|
if (!PacketLost()) {
|
||||||
int ret = neteq_->InsertPacket(
|
int ret = neteq_->InsertPacket(
|
||||||
rtp_header_.header,
|
rtp_header_,
|
||||||
rtc::ArrayView<const uint8_t>(payload_.data(), payload_size_bytes_),
|
rtc::ArrayView<const uint8_t>(payload_.data(), payload_size_bytes_),
|
||||||
packet_input_time_ms * in_sampling_khz_);
|
packet_input_time_ms * in_sampling_khz_);
|
||||||
if (ret != NetEq::kOK)
|
if (ret != NetEq::kOK)
|
||||||
|
|||||||
@ -70,7 +70,7 @@ int64_t NetEqTest::Run() {
|
|||||||
std::unique_ptr<NetEqInput::PacketData> packet_data = input_->PopPacket();
|
std::unique_ptr<NetEqInput::PacketData> packet_data = input_->PopPacket();
|
||||||
RTC_CHECK(packet_data);
|
RTC_CHECK(packet_data);
|
||||||
int error = neteq_->InsertPacket(
|
int error = neteq_->InsertPacket(
|
||||||
packet_data->header.header,
|
packet_data->header,
|
||||||
rtc::ArrayView<const uint8_t>(packet_data->payload),
|
rtc::ArrayView<const uint8_t>(packet_data->payload),
|
||||||
static_cast<uint32_t>(packet_data->time_ms * sample_rate_hz_ / 1000));
|
static_cast<uint32_t>(packet_data->time_ms * sample_rate_hz_ / 1000));
|
||||||
if (error != NetEq::kOK && error_callback_) {
|
if (error != NetEq::kOK && error_callback_) {
|
||||||
|
|||||||
Reference in New Issue
Block a user