timestamp_map.h 1.1 KB

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