#include "modules/rtp_rtcp/source/receive_statistics_impl.h"
#include <cmath>
#include <cstdlib>
#include <memory>
#include <utility>
#include <vector>
#include "api/units/time_delta.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
#include "modules/rtp_rtcp/source/rtp_rtcp_config.h"
#include "rtc_base/logging.h"
#include "rtc_base/time_utils.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
namespace {
constexpr TimeDelta kStatisticsTimeout = …;
constexpr TimeDelta kStatisticsProcessInterval = …;
TimeDelta UnixEpochDelta(Clock& clock) { … }
}
StreamStatistician::~StreamStatistician() { … }
StreamStatisticianImpl::StreamStatisticianImpl(uint32_t ssrc,
Clock* clock,
int max_reordering_threshold)
: … { … }
StreamStatisticianImpl::~StreamStatisticianImpl() = default;
bool StreamStatisticianImpl::UpdateOutOfOrder(const RtpPacketReceived& packet,
int64_t sequence_number,
Timestamp now) { … }
void StreamStatisticianImpl::UpdateCounters(const RtpPacketReceived& packet) { … }
void StreamStatisticianImpl::UpdateJitter(const RtpPacketReceived& packet,
Timestamp receive_time) { … }
void StreamStatisticianImpl::ReviseFrequencyAndJitter(
int payload_type_frequency) { … }
void StreamStatisticianImpl::SetMaxReorderingThreshold(
int max_reordering_threshold) { … }
void StreamStatisticianImpl::EnableRetransmitDetection(bool enable) { … }
RtpReceiveStats StreamStatisticianImpl::GetStats() const { … }
void StreamStatisticianImpl::MaybeAppendReportBlockAndReset(
std::vector<rtcp::ReportBlock>& report_blocks) { … }
absl::optional<int> StreamStatisticianImpl::GetFractionLostInPercent() const { … }
StreamDataCounters StreamStatisticianImpl::GetReceiveStreamDataCounters()
const { … }
uint32_t StreamStatisticianImpl::BitrateReceived() const { … }
bool StreamStatisticianImpl::IsRetransmitOfOldPacket(
const RtpPacketReceived& packet,
Timestamp now) const { … }
std::unique_ptr<ReceiveStatistics> ReceiveStatistics::Create(Clock* clock) { … }
std::unique_ptr<ReceiveStatistics> ReceiveStatistics::CreateThreadCompatible(
Clock* clock) { … }
ReceiveStatisticsImpl::ReceiveStatisticsImpl(
Clock* clock,
std::function<std::unique_ptr<StreamStatisticianImplInterface>(
uint32_t ssrc,
Clock* clock,
int max_reordering_threshold)> stream_statistician_factory)
: … { … }
void ReceiveStatisticsImpl::OnRtpPacket(const RtpPacketReceived& packet) { … }
StreamStatistician* ReceiveStatisticsImpl::GetStatistician(
uint32_t ssrc) const { … }
StreamStatisticianImplInterface* ReceiveStatisticsImpl::GetOrCreateStatistician(
uint32_t ssrc) { … }
void ReceiveStatisticsImpl::SetMaxReorderingThreshold(
int max_reordering_threshold) { … }
void ReceiveStatisticsImpl::SetMaxReorderingThreshold(
uint32_t ssrc,
int max_reordering_threshold) { … }
void ReceiveStatisticsImpl::EnableRetransmitDetection(uint32_t ssrc,
bool enable) { … }
std::vector<rtcp::ReportBlock> ReceiveStatisticsImpl::RtcpReportBlocks(
size_t max_blocks) { … }
}