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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 | 262 |
263 size_t PacketBuffer::NumPacketsInBuffer() const { | 263 size_t PacketBuffer::NumPacketsInBuffer() const { |
264 return buffer_.size(); | 264 return buffer_.size(); |
265 } | 265 } |
266 | 266 |
267 size_t PacketBuffer::NumSamplesInBuffer(size_t last_decoded_length) const { | 267 size_t PacketBuffer::NumSamplesInBuffer(size_t last_decoded_length) const { |
268 size_t num_samples = 0; | 268 size_t num_samples = 0; |
269 size_t last_duration = last_decoded_length; | 269 size_t last_duration = last_decoded_length; |
270 for (Packet* packet : buffer_) { | 270 for (Packet* packet : buffer_) { |
271 if (packet->frame) { | 271 if (packet->frame) { |
272 if (!packet->primary) { | 272 // TODO(ossu): Check that this is really want we want to filter on. |
hlundin-webrtc
2016/09/15 09:33:30
I would argue that also the old code was wrong. Th
ossu
2016/09/15 12:22:53
Acknowledged.
ossu
2016/09/19 14:07:34
I tried putting something else here: checking only
| |
273 if (packet->priority != Packet::kHighestPriority) { | |
273 continue; | 274 continue; |
274 } | 275 } |
275 size_t duration = packet->frame->Duration(); | 276 size_t duration = packet->frame->Duration(); |
276 if (duration > 0) { | 277 if (duration > 0) { |
277 last_duration = duration; // Save the most up-to-date (valid) duration. | 278 last_duration = duration; // Save the most up-to-date (valid) duration. |
278 } | 279 } |
279 } | 280 } |
280 num_samples += last_duration; | 281 num_samples += last_duration; |
281 } | 282 } |
282 return num_samples; | 283 return num_samples; |
(...skipping 14 matching lines...) Expand all Loading... | |
297 // Continue while the list is not empty. | 298 // Continue while the list is not empty. |
298 } | 299 } |
299 } | 300 } |
300 | 301 |
301 void PacketBuffer::BufferStat(int* num_packets, int* max_num_packets) const { | 302 void PacketBuffer::BufferStat(int* num_packets, int* max_num_packets) const { |
302 *num_packets = static_cast<int>(buffer_.size()); | 303 *num_packets = static_cast<int>(buffer_.size()); |
303 *max_num_packets = static_cast<int>(max_number_of_packets_); | 304 *max_num_packets = static_cast<int>(max_number_of_packets_); |
304 } | 305 } |
305 | 306 |
306 } // namespace webrtc | 307 } // namespace webrtc |
OLD | NEW |