Files
platform-external-webrtc/webrtc/modules/bitrate_controller/send_time_history.h
sprang@webrtc.org b144b4b74e Fixed bug in SendTimeHistory, where deleting packets via the getter
would not update the oldest suence number.

BUG=
R=stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/42589004

Cr-Commit-Position: refs/heads/master@{#8574}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8574 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-03 15:44:54 +00:00

43 lines
1.3 KiB
C++

/*
* Copyright (c) 2015 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_BITRATE_CONTROLLER_SEND_TIME_HISTORY_H_
#define WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_TIME_HISTORY_H_
#include <map>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/basictypes.h"
namespace webrtc {
class SendTimeHistory {
public:
explicit SendTimeHistory(int64_t packet_age_limit);
virtual ~SendTimeHistory();
void AddAndRemoveOldSendTimes(uint16_t sequence_number, int64_t timestamp);
bool GetSendTime(uint16_t sequence_number, int64_t* timestamp, bool remove);
void Clear();
private:
void EraseOld(int64_t limit);
void UpdateOldestSequenceNumber();
const int64_t packet_age_limit_;
uint16_t oldest_sequence_number_; // Oldest may not be lowest.
std::map<uint16_t, int64_t> history_;
DISALLOW_COPY_AND_ASSIGN(SendTimeHistory);
};
} // namespace webrtc
#endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_TIME_HISTORY_H_