Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: webrtc/modules/video_coding/main/source/timestamp_map.h

Issue 1358863002: Simplify VCMTimestampMap. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/main/source/timestamp_map.h
diff --git a/webrtc/modules/video_coding/main/source/timestamp_map.h b/webrtc/modules/video_coding/main/source/timestamp_map.h
index 14e06290ff94996be4fc151a8a96d51efe0a8eec..40b7610707b4cd78f52fb3ca16c60b90cf359487 100644
--- a/webrtc/modules/video_coding/main/source/timestamp_map.h
+++ b/webrtc/modules/video_coding/main/source/timestamp_map.h
@@ -11,40 +11,35 @@
#ifndef WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
#define WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
+#include "webrtc/base/scoped_ptr.h"
#include "webrtc/typedefs.h"
-namespace webrtc
-{
+namespace webrtc {
-struct VCMTimestampDataTuple
-{
- uint32_t timestamp;
- void* data;
-};
-
-class VCMTimestampMap
-{
-public:
- // Constructor. Optional parameter specifies maximum number of
- // timestamps in map.
- VCMTimestampMap(const int32_t length = 10);
+class VCMTimestampMap {
+ public:
+ explicit VCMTimestampMap(size_t size);
- // Destructor.
- ~VCMTimestampMap();
+ // Destructor.
stefan-webrtc 2015/09/21 15:15:46 Remove this comment.
pbos-webrtc 2015/09/23 13:51:55 Done.
+ ~VCMTimestampMap();
- // Empty the map
- void Reset();
+ // Empty the map
stefan-webrtc 2015/09/21 15:15:46 End with .
pbos-webrtc 2015/09/23 13:51:55 Done.
+ void Reset();
- int32_t Add(uint32_t timestamp, void* data);
- void* Pop(uint32_t timestamp);
+ void Add(uint32_t timestamp, void* data);
stefan-webrtc 2015/09/21 15:15:47 Should we switch the type of data from void* to wh
pbos-webrtc 2015/09/23 13:51:55 Done.
+ void* Pop(uint32_t timestamp);
-private:
- bool IsEmpty() const;
+ private:
+ struct TimestampDataTuple {
+ uint32_t timestamp;
+ void* data;
+ };
+ bool IsEmpty() const;
- VCMTimestampDataTuple* _map;
- int32_t _nextAddIx;
- int32_t _nextPopIx;
- int32_t _length;
+ rtc::scoped_ptr<TimestampDataTuple[]> ring_buffer_;
+ const size_t length_;
stefan-webrtc 2015/09/21 15:15:46 Name it size or capacity instead?
pbos-webrtc 2015/09/23 13:51:55 capacity_ done.
+ size_t next_add_idx_;
+ size_t next_pop_idx_;
};
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698