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

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

Issue 2326953003: Added a ParsePayload method to AudioDecoder. (Closed)
Patch Set: Clarifications. 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/packet_buffer.cc
diff --git a/webrtc/modules/audio_coding/neteq/packet_buffer.cc b/webrtc/modules/audio_coding/neteq/packet_buffer.cc
index 1c8713c48744e3d77b195ff24007d3d11e2a66e6..16c4e707bc8c836ad3968d243ff10d115ff0adc7 100644
--- a/webrtc/modules/audio_coding/neteq/packet_buffer.cc
+++ b/webrtc/modules/audio_coding/neteq/packet_buffer.cc
@@ -68,7 +68,7 @@ bool PacketBuffer::Empty() const {
}
int PacketBuffer::InsertPacket(Packet* packet) {
- if (!packet || packet->payload.empty()) {
+ if (!packet || packet->empty()) {
if (packet) {
delete packet;
}
@@ -209,7 +209,7 @@ Packet* PacketBuffer::GetNextPacket(size_t* discard_count) {
Packet* packet = buffer_.front();
// Assert that the packet sanity checks in InsertPacket method works.
- assert(packet && !packet->payload.empty());
+ RTC_DCHECK(packet && !packet->empty());
buffer_.pop_front();
// Discard other packets with the same timestamp. These are duplicates or
@@ -237,8 +237,8 @@ int PacketBuffer::DiscardNextPacket() {
return kBufferEmpty;
}
// Assert that the packet sanity checks in InsertPacket method works.
- assert(buffer_.front());
- assert(!buffer_.front()->payload.empty());
+ RTC_DCHECK(buffer_.front());
+ RTC_DCHECK(!buffer_.front()->empty());
DeleteFirstPacket(&buffer_);
return kOK;
}
@@ -264,22 +264,16 @@ size_t PacketBuffer::NumPacketsInBuffer() const {
return buffer_.size();
}
-size_t PacketBuffer::NumSamplesInBuffer(DecoderDatabase* decoder_database,
- size_t last_decoded_length) const {
- PacketList::const_iterator it;
+size_t PacketBuffer::NumSamplesInBuffer(size_t last_decoded_length) const {
size_t num_samples = 0;
size_t last_duration = last_decoded_length;
- for (it = buffer_.begin(); it != buffer_.end(); ++it) {
- Packet* packet = (*it);
- AudioDecoder* decoder =
- decoder_database->GetDecoder(packet->header.payloadType);
- if (decoder) {
+ for (Packet* packet : buffer_) {
+ if (packet->frame) {
if (!packet->primary) {
continue;
}
- int duration = decoder->PacketDuration(packet->payload.data(),
- packet->payload.size());
- if (duration >= 0) {
+ size_t duration = packet->frame->Duration();
+ if (duration > 0) {
last_duration = duration; // Save the most up-to-date (valid) duration.
}
}

Powered by Google App Engine
This is Rietveld 408576698