
This is a pure reformat patch, with the exception that I also fixed all comments and moved a constant. I did not change the types in this patch since I though that is more risky, so I'll do that in a separate patch later (perhaps we could purge the types from the whole module in one go?) BUG= TEST=Trybots, vie_ & voe_auto_test --automated Review URL: https://webrtc-codereview.appspot.com/998007 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3338 4adac7df-926f-26a2-2b94-8c16560cd09d
62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
/*
|
|
* Copyright (c) 2012 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_RTP_RTCP_SOURCE_BITRATE_H_
|
|
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_BITRATE_H_
|
|
|
|
#include <stdio.h>
|
|
#include <list>
|
|
|
|
#include "webrtc/common_types.h"
|
|
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
|
|
#include "webrtc/typedefs.h"
|
|
|
|
namespace webrtc {
|
|
|
|
class RtpRtcpClock;
|
|
|
|
class Bitrate {
|
|
public:
|
|
explicit Bitrate(RtpRtcpClock* clock);
|
|
|
|
// Calculates rates.
|
|
void Process();
|
|
|
|
// Update with a packet.
|
|
void Update(const WebRtc_Word32 bytes);
|
|
|
|
// Packet rate last second, updated roughly every 100 ms.
|
|
WebRtc_UWord32 PacketRate() const;
|
|
|
|
// Bitrate last second, updated roughly every 100 ms.
|
|
WebRtc_UWord32 BitrateLast() const;
|
|
|
|
// Bitrate last second, updated now.
|
|
WebRtc_UWord32 BitrateNow() const;
|
|
|
|
protected:
|
|
RtpRtcpClock& clock_;
|
|
|
|
private:
|
|
WebRtc_UWord32 packet_rate_;
|
|
WebRtc_UWord32 bitrate_;
|
|
WebRtc_UWord8 bitrate_next_idx_;
|
|
WebRtc_Word64 packet_rate_array_[10];
|
|
WebRtc_Word64 bitrate_array_[10];
|
|
WebRtc_Word64 bitrate_diff_ms_[10];
|
|
WebRtc_Word64 time_last_rate_update_;
|
|
WebRtc_UWord32 bytes_count_;
|
|
WebRtc_UWord32 packet_count_;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_BITRATE_H_
|