Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: webrtc/modules/audio_coding/neteq/neteq_impl.cc

Issue 2342443005: Moved Opus-specific payload splitting into AudioDecoderOpus. (Closed)
Patch Set: Priority levels are ints, kHighestPriority is gone. Also small cleanups. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/neteq_impl.cc
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index 014bd044ddeb9f5fc051664261ca5c767cf7f27c..2252e573adcd9a5a3cc356e73bb373b344d9dec9 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -529,7 +529,6 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
packet->header.ssrc = rtp_header.header.ssrc;
packet->header.numCSRCs = 0;
packet->payload.SetData(payload.data(), payload.size());
- packet->primary = true;
// Waiting time will be set upon inserting the packet in the buffer.
RTC_DCHECK(!packet->waiting_time);
// Insert packet in a packet list.
@@ -571,7 +570,7 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
// Check for RED payload type, and separate payloads into several packets.
if (decoder_database_->IsRed(main_header.payloadType)) {
- if (payload_splitter_->SplitRed(&packet_list) != PayloadSplitter::kOK) {
+ if (!payload_splitter_->SplitRed(&packet_list)) {
PacketBuffer::DeleteAllPackets(&packet_list);
return kRedundancySplitError;
}
@@ -620,18 +619,6 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
}
}
- // Check for FEC in packets, and separate payloads into several packets.
- int ret = payload_splitter_->SplitFec(&packet_list, decoder_database_.get());
- if (ret != PayloadSplitter::kOK) {
- PacketBuffer::DeleteAllPackets(&packet_list);
- switch (ret) {
- case PayloadSplitter::kUnknownPayloadType:
- return kUnknownRtpPayloadType;
- default:
- return kOtherError;
- }
- }
-
// Update bandwidth estimate, if the packet is not comfort noise.
if (!packet_list.empty() &&
!decoder_database_->IsComfortNoise(main_header.payloadType)) {
@@ -664,9 +651,9 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
} else {
std::vector<AudioDecoder::ParseResult> results =
info->GetDecoder()->ParsePayload(std::move(packet->payload),
- packet->header.timestamp,
- packet->primary);
+ packet->header.timestamp);
const RTPHeader& original_header = packet->header;
+ const Packet::Priority original_priority = packet->priority;
for (auto& result : results) {
RTC_DCHECK(result.frame);
// Reuse the packet if possible.
@@ -675,8 +662,8 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
packet->header = original_header;
}
packet->header.timestamp = result.timestamp;
- // TODO(ossu): Move from primary to some sort of priority level.
- packet->primary = result.primary;
+ packet->priority.codec_level = result.priority;
+ packet->priority.red_level = original_priority.red_level;
packet->frame = std::move(result.frame);
parsed_packet_list.push_back(packet.release());
}
@@ -696,7 +683,7 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header,
// Insert packets in buffer.
const size_t buffer_length_before_insert =
packet_buffer_->NumPacketsInBuffer();
- ret = packet_buffer_->InsertPacketList(
+ const int ret = packet_buffer_->InsertPacketList(
&parsed_packet_list, *decoder_database_, &current_rtp_payload_type_,
&current_cng_rtp_payload_type_);
if (ret == PacketBuffer::kFlushed) {
@@ -1941,9 +1928,8 @@ int NetEqImpl::ExtractPackets(size_t required_samples,
size_t packet_duration = 0;
if (packet->frame) {
packet_duration = packet->frame->Duration();
- // TODO(ossu): Is this the correct way to track samples decoded from a
- // redundant packet?
- if (packet_duration > 0 && !packet->primary) {
+ // TODO(ossu): Is this the correct way to track Opus FEC packets?
+ if (packet->priority.codec_level > 0) {
stats_.SecondaryDecodedSamples(rtc::checked_cast<int>(packet_duration));
}
} else if (!decoder_database_->IsComfortNoise(packet->header.payloadType)) {

Powered by Google App Engine
This is Rietveld 408576698