Chromium Code Reviews| Index: webrtc/modules/remote_bitrate_estimator/include/send_time_history.h |
| diff --git a/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h b/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h |
| index f59790b4a544de02ee6dfc5c8f7d2174e56008c8..735acb324cb81bd07480a52ad93eae8c2d860e79 100644 |
| --- a/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h |
| +++ b/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h |
| @@ -13,37 +13,44 @@ |
| #include <map> |
| -#include "webrtc/base/constructormagic.h" |
| #include "webrtc/base/basictypes.h" |
| -#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" |
| +#include "webrtc/base/constructormagic.h" |
| namespace webrtc { |
| +class Clock; |
| +struct PacketInfo; |
| class SendTimeHistory { |
| public: |
| - SendTimeHistory(Clock* clock, int64_t packet_age_limit); |
| - virtual ~SendTimeHistory(); |
| + SendTimeHistory(Clock* clock, int64_t packet_age_limit_ms); |
| + ~SendTimeHistory(); |
| + |
| + void Clear(); |
| + // Cleanup old entries, then add new packet info with provided parameters. |
| void AddAndRemoveOld(uint16_t sequence_number, |
| - size_t length, |
| + size_t payload_size, |
| int probe_cluster_id); |
| - bool OnSentPacket(uint16_t sequence_number, int64_t timestamp); |
| + |
| + // Updates packet info identified by |sequence_number| with |send_time_ms|. |
| + // Return false if not found. |
| + bool OnSentPacket(uint16_t sequence_number, int64_t send_time_ms); |
| + |
| // Look up PacketInfo for a sent packet, based on the sequence number, and |
| - // populate all fields except for receive_time. The packet parameter must |
| + // populate all fields except for arrival_time. The packet parameter must |
| // thus be non-null and have the sequence_number field set. |
| - bool GetInfo(PacketInfo* packet, bool remove); |
| - void Clear(); |
| + bool GetInfo(PacketInfo* packet_info, bool remove); |
| private: |
| - void EraseOld(); |
| - void UpdateOldestSequenceNumber(); |
| + struct SeqNoComparer { |
|
stefan-webrtc
2016/08/01 11:22:49
SeqNumComparator?
danilchap
2016/08/01 11:47:08
Done.
|
| + bool operator()(uint16_t lhs, uint16_t rhs) const; |
| + }; |
| Clock* const clock_; |
| - const int64_t packet_age_limit_; |
| - uint16_t oldest_sequence_number_; // Oldest may not be lowest. |
| - std::map<uint16_t, PacketInfo> history_; |
| + const int64_t packet_age_limit_ms_; |
| + std::map<uint16_t, PacketInfo, SeqNoComparer> history_; |
| - RTC_DISALLOW_COPY_AND_ASSIGN(SendTimeHistory); |
| + RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SendTimeHistory); |
| }; |
| } // namespace webrtc |