blob: c85666c9aa08844a304df133e8e7a72f42fff366 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
12#define MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
kwiberg3f55dea2016-02-29 05:51:59 -080014#include <memory>
15
pbos1968d3f2015-09-28 08:52:18 -070016namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000017
pbos1968d3f2015-09-28 08:52:18 -070018struct VCMFrameInformation;
niklase@google.com470e71d2011-07-07 08:21:25 +000019
pbos1968d3f2015-09-28 08:52:18 -070020class VCMTimestampMap {
21 public:
22 explicit VCMTimestampMap(size_t capacity);
23 ~VCMTimestampMap();
niklase@google.com470e71d2011-07-07 08:21:25 +000024
pbos1968d3f2015-09-28 08:52:18 -070025 void Add(uint32_t timestamp, VCMFrameInformation* data);
26 VCMFrameInformation* Pop(uint32_t timestamp);
niklase@google.com470e71d2011-07-07 08:21:25 +000027
pbos1968d3f2015-09-28 08:52:18 -070028 private:
29 struct TimestampDataTuple {
30 uint32_t timestamp;
31 VCMFrameInformation* data;
32 };
33 bool IsEmpty() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000034
kwiberg3f55dea2016-02-29 05:51:59 -080035 std::unique_ptr<TimestampDataTuple[]> ring_buffer_;
pbos1968d3f2015-09-28 08:52:18 -070036 const size_t capacity_;
37 size_t next_add_idx_;
38 size_t next_pop_idx_;
niklase@google.com470e71d2011-07-07 08:21:25 +000039};
40
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000041} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000042
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020043#endif // MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_