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}
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index 501e567..89bddec 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -131,7 +131,7 @@
NetEqImpl::~NetEqImpl() = default;
-int NetEqImpl::InsertPacket(const WebRtcRTPHeader& rtp_header,
+int NetEqImpl::InsertPacket(const RTPHeader& rtp_header,
rtc::ArrayView<const uint8_t> payload,
uint32_t receive_timestamp) {
rtc::MsanCheckInitialized(payload);
@@ -581,7 +581,7 @@
// Methods below this line are private.
-int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
+int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
rtc::ArrayView<const uint8_t> payload,
uint32_t receive_timestamp) {
if (payload.empty()) {
@@ -594,24 +594,24 @@
packet_list.push_back([&rtp_header, &payload] {
// Convert to Packet.
Packet packet;
- packet.payload_type = rtp_header.header.payloadType;
- packet.sequence_number = rtp_header.header.sequenceNumber;
- packet.timestamp = rtp_header.header.timestamp;
+ packet.payload_type = rtp_header.payloadType;
+ packet.sequence_number = rtp_header.sequenceNumber;
+ packet.timestamp = rtp_header.timestamp;
packet.payload.SetData(payload.data(), payload.size());
// Waiting time will be set upon inserting the packet in the buffer.
RTC_DCHECK(!packet.waiting_time);
return packet;
}());
- bool update_sample_rate_and_channels = first_packet_ ||
- (rtp_header.header.ssrc != ssrc_);
+ bool update_sample_rate_and_channels =
+ first_packet_ || (rtp_header.ssrc != ssrc_);
if (update_sample_rate_and_channels) {
// Reset timestamp scaling.
timestamp_scaler_->Reset();
}
- if (!decoder_database_->IsRed(rtp_header.header.payloadType)) {
+ if (!decoder_database_->IsRed(rtp_header.payloadType)) {
// Scale timestamp to internal domain (only for some codecs).
timestamp_scaler_->ToInternal(&packet_list);
}
@@ -627,14 +627,14 @@
// Note: |first_packet_| will be cleared further down in this method, once
// the packet has been successfully inserted into the packet buffer.
- rtcp_.Init(rtp_header.header.sequenceNumber);
+ rtcp_.Init(rtp_header.sequenceNumber);
// Flush the packet buffer and DTMF buffer.
packet_buffer_->Flush();
dtmf_buffer_->Flush();
// Store new SSRC.
- ssrc_ = rtp_header.header.ssrc;
+ ssrc_ = rtp_header.ssrc;
// Update audio buffer timestamp.
sync_buffer_->IncreaseEndTimestamp(main_timestamp - timestamp_);
@@ -644,19 +644,19 @@
}
// Update RTCP statistics, only for regular packets.
- rtcp_.Update(rtp_header.header, receive_timestamp);
+ rtcp_.Update(rtp_header, receive_timestamp);
if (nack_enabled_) {
RTC_DCHECK(nack_);
if (update_sample_rate_and_channels) {
nack_->Reset();
}
- nack_->UpdateLastReceivedPacket(rtp_header.header.sequenceNumber,
- rtp_header.header.timestamp);
+ nack_->UpdateLastReceivedPacket(rtp_header.sequenceNumber,
+ rtp_header.timestamp);
}
// Check for RED payload type, and separate payloads into several packets.
- if (decoder_database_->IsRed(rtp_header.header.payloadType)) {
+ if (decoder_database_->IsRed(rtp_header.payloadType)) {
if (!red_payload_splitter_->SplitRed(&packet_list)) {
return kRedundancySplitError;
}
@@ -675,7 +675,7 @@
// Update main_timestamp, if new packets appear in the list
// after RED splitting.
- if (decoder_database_->IsRed(rtp_header.header.payloadType)) {
+ if (decoder_database_->IsRed(rtp_header.payloadType)) {
timestamp_scaler_->ToInternal(&packet_list);
main_timestamp = packet_list.front().timestamp;
main_payload_type = packet_list.front().payload_type;