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

Side by Side Diff: webrtc/modules/audio_coding/neteq/packet_buffer.cc

Issue 1172163004: Reformat existing code. There should be no functional effects. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 int PacketBuffer::NumSamplesInBuffer(DecoderDatabase* decoder_database, 244 int PacketBuffer::NumSamplesInBuffer(DecoderDatabase* decoder_database,
245 int last_decoded_length) const { 245 int last_decoded_length) const {
246 PacketList::const_iterator it; 246 PacketList::const_iterator it;
247 int num_samples = 0; 247 int num_samples = 0;
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) { 253 if (decoder && !packet->sync_packet) {
254 int duration; 254 if (!packet->primary) {
255 if (packet->sync_packet) {
256 duration = last_duration;
257 } else if (packet->primary) {
258 duration =
259 decoder->PacketDuration(packet->payload, packet->payload_length);
260 } else {
261 continue; 255 continue;
262 } 256 }
257 int duration =
258 decoder->PacketDuration(packet->payload, packet->payload_length);
263 if (duration >= 0) { 259 if (duration >= 0) {
264 last_duration = duration; // Save the most up-to-date (valid) duration. 260 last_duration = duration; // Save the most up-to-date (valid) duration.
265 } 261 }
266 } 262 }
267 num_samples += last_duration; 263 num_samples += last_duration;
268 } 264 }
269 return num_samples; 265 return num_samples;
270 } 266 }
271 267
272 void PacketBuffer::IncrementWaitingTimes(int inc) { 268 void PacketBuffer::IncrementWaitingTimes(int inc) {
(...skipping 19 matching lines...) Expand all
292 // Continue while the list is not empty. 288 // Continue while the list is not empty.
293 } 289 }
294 } 290 }
295 291
296 void PacketBuffer::BufferStat(int* num_packets, int* max_num_packets) const { 292 void PacketBuffer::BufferStat(int* num_packets, int* max_num_packets) const {
297 *num_packets = static_cast<int>(buffer_.size()); 293 *num_packets = static_cast<int>(buffer_.size());
298 *max_num_packets = static_cast<int>(max_number_of_packets_); 294 *max_num_packets = static_cast<int>(max_number_of_packets_);
299 } 295 }
300 296
301 } // namespace webrtc 297 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698