2011-07-07 08:21:25 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
|
|
|
|
|
#define WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
|
|
|
|
|
|
2016-02-29 05:51:59 -08:00
|
|
|
#include <memory>
|
|
|
|
|
|
2013-07-16 12:32:05 +00:00
|
|
|
#include "webrtc/typedefs.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-09-28 08:52:18 -07:00
|
|
|
namespace webrtc {
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-09-28 08:52:18 -07:00
|
|
|
struct VCMFrameInformation;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-09-28 08:52:18 -07:00
|
|
|
class VCMTimestampMap {
|
|
|
|
|
public:
|
|
|
|
|
explicit VCMTimestampMap(size_t capacity);
|
|
|
|
|
~VCMTimestampMap();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-09-28 08:52:18 -07:00
|
|
|
// Empty the map.
|
|
|
|
|
void Reset();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-09-28 08:52:18 -07:00
|
|
|
void Add(uint32_t timestamp, VCMFrameInformation* data);
|
|
|
|
|
VCMFrameInformation* Pop(uint32_t timestamp);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-09-28 08:52:18 -07:00
|
|
|
private:
|
|
|
|
|
struct TimestampDataTuple {
|
|
|
|
|
uint32_t timestamp;
|
|
|
|
|
VCMFrameInformation* data;
|
|
|
|
|
};
|
|
|
|
|
bool IsEmpty() const;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2016-02-29 05:51:59 -08:00
|
|
|
std::unique_ptr<TimestampDataTuple[]> ring_buffer_;
|
2015-09-28 08:52:18 -07:00
|
|
|
const size_t capacity_;
|
|
|
|
|
size_t next_add_idx_;
|
|
|
|
|
size_t next_pop_idx_;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
2013-07-03 15:12:26 +00:00
|
|
|
} // namespace webrtc
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-21 08:23:20 -08:00
|
|
|
#endif // WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
|