Files
platform-external-webrtc/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.h
kjellander@webrtc.org 14665ff7d4 Roll chromium_revision e144d30..6fdb142 (318658:318841) + remove OVERRIDE macro
Clang version changed 223108:230914
Details: e144d30..6fdb142/tools/clang/scripts/update.sh

Removes the OVERRIDE macro defined in:
* webrtc/base/common.h
* webrtc/typedefs.h

The majority of the source changes were done by running this in src/:
perl -0pi -e "s/virtual\s([^({;]*(\([^({;]*\)[^({;]*))(OVERRIDE|override)/\1override/sg" `find {talk,webrtc} -name "*.h"  -o -name "*.cc*" -o -name "*.mm*"`

which converted all:
virtual Foo() OVERRIDE
functions to:
Foo() override

Then I manually edited:
* talk/media/webrtc/fakewebrtccommon.h
* webrtc/test/fake_common.h

Remaining uses of OVERRIDE was fixed by search+replace.

Manual edits were done to fix virtual destructors that were
overriding inherited ones.

Finally a build error related to the pure virtual definitions of
Read, Write and Rewind in common_types.h required a bit of
refactoring in:
* webrtc/common_types.cc
* webrtc/common_types.h
* webrtc/system_wrappers/interface/file_wrapper.h
* webrtc/system_wrappers/source/file_impl.cc

This roll should make it possible for us to finally re-enable deadlock
detection for TSan on the buildbots.

BUG=4106
R=pbos@webrtc.org, tommi@webrtc.org

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

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

148 lines
5.4 KiB
C++

/*
* Copyright (c) 2013 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_RECEIVE_STATISTICS_IMPL_H_
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVE_STATISTICS_IMPL_H_
#include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h"
#include <algorithm>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/rtp_rtcp/source/bitrate.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
namespace webrtc {
class CriticalSectionWrapper;
class StreamStatisticianImpl : public StreamStatistician {
public:
StreamStatisticianImpl(Clock* clock,
RtcpStatisticsCallback* rtcp_callback,
StreamDataCountersCallback* rtp_callback);
virtual ~StreamStatisticianImpl() {}
bool GetStatistics(RtcpStatistics* statistics, bool reset) override;
void GetDataCounters(size_t* bytes_received,
uint32_t* packets_received) const override;
void GetReceiveStreamDataCounters(
StreamDataCounters* data_counters) const override;
uint32_t BitrateReceived() const override;
void ResetStatistics() override;
bool IsRetransmitOfOldPacket(const RTPHeader& header,
int64_t min_rtt) const override;
bool IsPacketInOrder(uint16_t sequence_number) const override;
void IncomingPacket(const RTPHeader& rtp_header,
size_t packet_length,
bool retransmitted);
void FecPacketReceived(const RTPHeader& header, size_t packet_length);
void SetMaxReorderingThreshold(int max_reordering_threshold);
void ProcessBitrate();
virtual void LastReceiveTimeNtp(uint32_t* secs, uint32_t* frac) const;
private:
bool InOrderPacketInternal(uint16_t sequence_number) const;
RtcpStatistics CalculateRtcpStatistics();
void UpdateJitter(const RTPHeader& header,
uint32_t receive_time_secs,
uint32_t receive_time_frac);
void UpdateCounters(const RTPHeader& rtp_header,
size_t packet_length,
bool retransmitted);
void NotifyRtpCallback() LOCKS_EXCLUDED(stream_lock_.get());
void NotifyRtcpCallback() LOCKS_EXCLUDED(stream_lock_.get());
Clock* clock_;
rtc::scoped_ptr<CriticalSectionWrapper> stream_lock_;
Bitrate incoming_bitrate_;
uint32_t ssrc_;
int max_reordering_threshold_; // In number of packets or sequence numbers.
// Stats on received RTP packets.
uint32_t jitter_q4_;
uint32_t cumulative_loss_;
uint32_t jitter_q4_transmission_time_offset_;
int64_t last_receive_time_ms_;
uint32_t last_receive_time_secs_;
uint32_t last_receive_time_frac_;
uint32_t last_received_timestamp_;
int32_t last_received_transmission_time_offset_;
uint16_t received_seq_first_;
uint16_t received_seq_max_;
uint16_t received_seq_wraps_;
// Current counter values.
size_t received_packet_overhead_;
StreamDataCounters receive_counters_;
// Stored counter values. Includes sum of reset counter values for the stream.
StreamDataCounters stored_sum_receive_counters_;
// Counter values when we sent the last report.
uint32_t last_report_inorder_packets_;
uint32_t last_report_old_packets_;
uint16_t last_report_seq_max_;
RtcpStatistics last_reported_statistics_;
RtcpStatisticsCallback* const rtcp_callback_;
StreamDataCountersCallback* const rtp_callback_;
};
class ReceiveStatisticsImpl : public ReceiveStatistics,
public RtcpStatisticsCallback,
public StreamDataCountersCallback {
public:
explicit ReceiveStatisticsImpl(Clock* clock);
~ReceiveStatisticsImpl();
// Implement ReceiveStatistics.
void IncomingPacket(const RTPHeader& header,
size_t packet_length,
bool retransmitted) override;
void FecPacketReceived(const RTPHeader& header,
size_t packet_length) override;
StatisticianMap GetActiveStatisticians() const override;
StreamStatistician* GetStatistician(uint32_t ssrc) const override;
void SetMaxReorderingThreshold(int max_reordering_threshold) override;
// Implement Module.
int32_t Process() override;
int64_t TimeUntilNextProcess() override;
void RegisterRtcpStatisticsCallback(
RtcpStatisticsCallback* callback) override;
void RegisterRtpStatisticsCallback(
StreamDataCountersCallback* callback) override;
private:
void StatisticsUpdated(const RtcpStatistics& statistics,
uint32_t ssrc) override;
void CNameChanged(const char* cname, uint32_t ssrc) override;
void DataCountersUpdated(const StreamDataCounters& counters,
uint32_t ssrc) override;
typedef std::map<uint32_t, StreamStatisticianImpl*> StatisticianImplMap;
Clock* clock_;
rtc::scoped_ptr<CriticalSectionWrapper> receive_statistics_lock_;
int64_t last_rate_update_ms_;
StatisticianImplMap statisticians_;
RtcpStatisticsCallback* rtcp_stats_callback_;
StreamDataCountersCallback* rtp_stats_callback_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RECEIVE_STATISTICS_IMPL_H_