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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 266 |
267 size_t PacketBuffer::NumSamplesInBuffer(DecoderDatabase* decoder_database, | 267 size_t PacketBuffer::NumSamplesInBuffer(DecoderDatabase* decoder_database, |
268 size_t last_decoded_length) const { | 268 size_t last_decoded_length) const { |
269 PacketList::const_iterator it; | 269 PacketList::const_iterator it; |
270 size_t num_samples = 0; | 270 size_t num_samples = 0; |
271 size_t last_duration = last_decoded_length; | 271 size_t last_duration = last_decoded_length; |
272 for (it = buffer_.begin(); it != buffer_.end(); ++it) { | 272 for (it = buffer_.begin(); it != buffer_.end(); ++it) { |
273 Packet* packet = (*it); | 273 Packet* packet = (*it); |
274 AudioDecoder* decoder = | 274 AudioDecoder* decoder = |
275 decoder_database->GetDecoder(packet->header.payloadType); | 275 decoder_database->GetDecoder(packet->header.payloadType); |
276 if (decoder && !packet->sync_packet) { | 276 if (decoder) { |
277 if (!packet->primary) { | 277 if (!packet->primary) { |
278 continue; | 278 continue; |
279 } | 279 } |
280 int duration = decoder->PacketDuration(packet->payload.data(), | 280 int duration = decoder->PacketDuration(packet->payload.data(), |
281 packet->payload.size()); | 281 packet->payload.size()); |
282 if (duration >= 0) { | 282 if (duration >= 0) { |
283 last_duration = duration; // Save the most up-to-date (valid) duration. | 283 last_duration = duration; // Save the most up-to-date (valid) duration. |
284 } | 284 } |
285 } | 285 } |
286 num_samples += last_duration; | 286 num_samples += last_duration; |
(...skipping 16 matching lines...) Expand all Loading... |
303 // Continue while the list is not empty. | 303 // Continue while the list is not empty. |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 void PacketBuffer::BufferStat(int* num_packets, int* max_num_packets) const { | 307 void PacketBuffer::BufferStat(int* num_packets, int* max_num_packets) const { |
308 *num_packets = static_cast<int>(buffer_.size()); | 308 *num_packets = static_cast<int>(buffer_.size()); |
309 *max_num_packets = static_cast<int>(max_number_of_packets_); | 309 *max_num_packets = static_cast<int>(max_number_of_packets_); |
310 } | 310 } |
311 | 311 |
312 } // namespace webrtc | 312 } // namespace webrtc |
OLD | NEW |