OLD | NEW |
---|---|
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 #ifndef WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_ |
12 #define WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_ |
13 | 13 |
14 #include "webrtc/base/scoped_ptr.h" | |
14 #include "webrtc/typedefs.h" | 15 #include "webrtc/typedefs.h" |
15 | 16 |
16 namespace webrtc | 17 namespace webrtc { |
17 { | |
18 | 18 |
19 struct VCMTimestampDataTuple | 19 class VCMTimestampMap { |
20 { | 20 public: |
21 uint32_t timestamp; | 21 explicit VCMTimestampMap(size_t size); |
22 void* data; | |
23 }; | |
24 | 22 |
25 class VCMTimestampMap | 23 // Destructor. |
stefan-webrtc
2015/09/21 15:15:46
Remove this comment.
pbos-webrtc
2015/09/23 13:51:55
Done.
| |
26 { | 24 ~VCMTimestampMap(); |
27 public: | |
28 // Constructor. Optional parameter specifies maximum number of | |
29 // timestamps in map. | |
30 VCMTimestampMap(const int32_t length = 10); | |
31 | 25 |
32 // Destructor. | 26 // Empty the map |
stefan-webrtc
2015/09/21 15:15:46
End with .
pbos-webrtc
2015/09/23 13:51:55
Done.
| |
33 ~VCMTimestampMap(); | 27 void Reset(); |
34 | 28 |
35 // Empty the map | 29 void Add(uint32_t timestamp, void* data); |
stefan-webrtc
2015/09/21 15:15:47
Should we switch the type of data from void* to wh
pbos-webrtc
2015/09/23 13:51:55
Done.
| |
36 void Reset(); | 30 void* Pop(uint32_t timestamp); |
37 | 31 |
38 int32_t Add(uint32_t timestamp, void* data); | 32 private: |
39 void* Pop(uint32_t timestamp); | 33 struct TimestampDataTuple { |
34 uint32_t timestamp; | |
35 void* data; | |
36 }; | |
37 bool IsEmpty() const; | |
40 | 38 |
41 private: | 39 rtc::scoped_ptr<TimestampDataTuple[]> ring_buffer_; |
42 bool IsEmpty() const; | 40 const size_t length_; |
stefan-webrtc
2015/09/21 15:15:46
Name it size or capacity instead?
pbos-webrtc
2015/09/23 13:51:55
capacity_ done.
| |
43 | 41 size_t next_add_idx_; |
44 VCMTimestampDataTuple* _map; | 42 size_t next_pop_idx_; |
45 int32_t _nextAddIx; | |
46 int32_t _nextPopIx; | |
47 int32_t _length; | |
48 }; | 43 }; |
49 | 44 |
50 } // namespace webrtc | 45 } // namespace webrtc |
51 | 46 |
52 #endif // WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_ | 47 #endif // WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_ |
OLD | NEW |