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

Unified Diff: webrtc/modules/remote_bitrate_estimator/include/send_time_history.h

Issue 2011473002: Cleanup BWE SendTimeHistory class (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback2 Created 4 years, 5 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/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..194899219dddc10ae72ae242d2642b381046d027 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 SeqNumComparator {
+ 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, SeqNumComparator> history_;
- RTC_DISALLOW_COPY_AND_ASSIGN(SendTimeHistory);
+ RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SendTimeHistory);
};
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698