blob: cfa12573ec7a26df2b5398e82fbb335082d75c2c [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);
Johannes Kron111e9812020-10-26 13:54:40 +010027 size_t Size() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000028
pbos1968d3f2015-09-28 08:52:18 -070029 private:
30 struct TimestampDataTuple {
31 uint32_t timestamp;
32 VCMFrameInformation* data;
33 };
34 bool IsEmpty() const;
niklase@google.com470e71d2011-07-07 08:21:25 +000035
kwiberg3f55dea2016-02-29 05:51:59 -080036 std::unique_ptr<TimestampDataTuple[]> ring_buffer_;
pbos1968d3f2015-09-28 08:52:18 -070037 const size_t capacity_;
38 size_t next_add_idx_;
39 size_t next_pop_idx_;
niklase@google.com470e71d2011-07-07 08:21:25 +000040};
41
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000042} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000043
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020044#endif // MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_