Chromium Code Reviews

Side by Side Diff: webrtc/modules/video_coding/timestamp_map.cc

Issue 1528503003: Lint enabled for webrtc/modules/video_coding folder. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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
11 #include <assert.h> 11 #include <assert.h>
12 #include <stdlib.h> 12 #include <stdlib.h>
13 13
14 #include "webrtc/modules/include/module_common_types.h" 14 #include "webrtc/modules/include/module_common_types.h"
15 #include "webrtc/modules/video_coding/timestamp_map.h" 15 #include "webrtc/modules/video_coding/timestamp_map.h"
16 16
17 namespace webrtc { 17 namespace webrtc {
18 18
19 VCMTimestampMap::VCMTimestampMap(size_t capacity) 19 VCMTimestampMap::VCMTimestampMap(size_t capacity)
20 : ring_buffer_(new TimestampDataTuple[capacity]), 20 : ring_buffer_(new TimestampDataTuple[capacity]),
21 capacity_(capacity), 21 capacity_(capacity),
22 next_add_idx_(0), 22 next_add_idx_(0),
23 next_pop_idx_(0) { 23 next_pop_idx_(0) {}
24 }
25 24
26 VCMTimestampMap::~VCMTimestampMap() { 25 VCMTimestampMap::~VCMTimestampMap() {}
27 }
28 26
29 void VCMTimestampMap::Add(uint32_t timestamp, VCMFrameInformation* data) { 27 void VCMTimestampMap::Add(uint32_t timestamp, VCMFrameInformation* data) {
30 ring_buffer_[next_add_idx_].timestamp = timestamp; 28 ring_buffer_[next_add_idx_].timestamp = timestamp;
31 ring_buffer_[next_add_idx_].data = data; 29 ring_buffer_[next_add_idx_].data = data;
32 next_add_idx_ = (next_add_idx_ + 1) % capacity_; 30 next_add_idx_ = (next_add_idx_ + 1) % capacity_;
33 31
34 if (next_add_idx_ == next_pop_idx_) { 32 if (next_add_idx_ == next_pop_idx_) {
35 // Circular list full; forget oldest entry. 33 // Circular list full; forget oldest entry.
36 next_pop_idx_ = (next_pop_idx_ + 1) % capacity_; 34 next_pop_idx_ = (next_pop_idx_ + 1) % capacity_;
37 } 35 }
(...skipping 17 matching lines...)
55 next_pop_idx_ = (next_pop_idx_ + 1) % capacity_; 53 next_pop_idx_ = (next_pop_idx_ + 1) % capacity_;
56 } 54 }
57 55
58 // Could not find matching timestamp in list. 56 // Could not find matching timestamp in list.
59 return nullptr; 57 return nullptr;
60 } 58 }
61 59
62 bool VCMTimestampMap::IsEmpty() const { 60 bool VCMTimestampMap::IsEmpty() const {
63 return (next_add_idx_ == next_pop_idx_); 61 return (next_add_idx_ == next_pop_idx_);
64 } 62 }
65 } 63 } // namespace webrtc
OLDNEW

Powered by Google App Engine