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 MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_ 12 #define MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_ 13 14 #include <memory> 15 16 namespace webrtc { 17 18 struct VCMFrameInformation; 19 20 class VCMTimestampMap { 21 public: 22 explicit VCMTimestampMap(size_t capacity); 23 ~VCMTimestampMap(); 24 25 void Add(uint32_t timestamp, VCMFrameInformation* data); 26 VCMFrameInformation* Pop(uint32_t timestamp); 27 28 private: 29 struct TimestampDataTuple { 30 uint32_t timestamp; 31 VCMFrameInformation* data; 32 }; 33 bool IsEmpty() const; 34 35 std::unique_ptr<TimestampDataTuple[]> ring_buffer_; 36 const size_t capacity_; 37 size_t next_add_idx_; 38 size_t next_pop_idx_; 39 }; 40 41 } // namespace webrtc 42 43 #endif // MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_ 44