• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
13 
14 #include "webrtc/base/scoped_ptr.h"
15 #include "webrtc/typedefs.h"
16 
17 namespace webrtc {
18 
19 struct VCMFrameInformation;
20 
21 class VCMTimestampMap {
22  public:
23   explicit VCMTimestampMap(size_t capacity);
24   ~VCMTimestampMap();
25 
26   // Empty the map.
27   void Reset();
28 
29   void Add(uint32_t timestamp, VCMFrameInformation* data);
30   VCMFrameInformation* Pop(uint32_t timestamp);
31 
32  private:
33   struct TimestampDataTuple {
34     uint32_t timestamp;
35     VCMFrameInformation* data;
36   };
37   bool IsEmpty() const;
38 
39   rtc::scoped_ptr<TimestampDataTuple[]> ring_buffer_;
40   const size_t capacity_;
41   size_t next_add_idx_;
42   size_t next_pop_idx_;
43 };
44 
45 }  // namespace webrtc
46 
47 #endif  // WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
48