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

Side by Side Diff: webrtc/modules/video_coding/main/source/timestamp_map.h

Issue 1358863002: Simplify VCMTimestampMap. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback Created 5 years, 2 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) 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 struct VCMFrameInformation;
20 {
21 uint32_t timestamp;
22 void* data;
23 };
24 20
25 class VCMTimestampMap 21 class VCMTimestampMap {
26 { 22 public:
27 public: 23 explicit VCMTimestampMap(size_t capacity);
28 // Constructor. Optional parameter specifies maximum number of 24 ~VCMTimestampMap();
29 // timestamps in map.
30 VCMTimestampMap(const int32_t length = 10);
31 25
32 // Destructor. 26 // Empty the map.
33 ~VCMTimestampMap(); 27 void Reset();
34 28
35 // Empty the map 29 void Add(uint32_t timestamp, VCMFrameInformation* data);
36 void Reset(); 30 VCMFrameInformation* 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 VCMFrameInformation* 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 capacity_;
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_
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/main/source/generic_decoder.cc ('k') | webrtc/modules/video_coding/main/source/timestamp_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698