| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 int last_duration = last_decoded_length; | 248 int last_duration = last_decoded_length; |
| 249 for (it = buffer_.begin(); it != buffer_.end(); ++it) { | 249 for (it = buffer_.begin(); it != buffer_.end(); ++it) { |
| 250 Packet* packet = (*it); | 250 Packet* packet = (*it); |
| 251 AudioDecoder* decoder = | 251 AudioDecoder* decoder = |
| 252 decoder_database->GetDecoder(packet->header.payloadType); | 252 decoder_database->GetDecoder(packet->header.payloadType); |
| 253 if (decoder && !packet->sync_packet) { | 253 if (decoder && !packet->sync_packet) { |
| 254 if (!packet->primary) { | 254 if (!packet->primary) { |
| 255 continue; | 255 continue; |
| 256 } | 256 } |
| 257 int duration = | 257 int duration = |
| 258 decoder->PacketDuration(packet->payload, packet->payload_length); | 258 decoder->PacketDuration(packet->payload, packet->payload_length); |
| 259 if (duration >= 0) { | 259 if (duration >= 0) { |
| 260 last_duration = duration; // Save the most up-to-date (valid) duration. | 260 last_duration = duration; // Save the most up-to-date (valid) duration. |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 num_samples += last_duration; | 263 num_samples += last_duration; |
| 264 } | 264 } |
| 265 return num_samples; | 265 return num_samples; |
| 266 } | 266 } |
| 267 | 267 |
| 268 void PacketBuffer::IncrementWaitingTimes(int inc) { | 268 void PacketBuffer::IncrementWaitingTimes(int inc) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 288 // Continue while the list is not empty. | 288 // Continue while the list is not empty. |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 void PacketBuffer::BufferStat(int* num_packets, int* max_num_packets) const { | 292 void PacketBuffer::BufferStat(int* num_packets, int* max_num_packets) const { |
| 293 *num_packets = static_cast<int>(buffer_.size()); | 293 *num_packets = static_cast<int>(buffer_.size()); |
| 294 *max_num_packets = static_cast<int>(max_number_of_packets_); | 294 *max_num_packets = static_cast<int>(max_number_of_packets_); |
| 295 } | 295 } |
| 296 | 296 |
| 297 } // namespace webrtc | 297 } // namespace webrtc |
| OLD | NEW |