#include "media/cast/logging/stats_event_subscriber.h"
#include <algorithm>
#include <cmath>
#include <memory>
#include <utility>
#include "base/check_op.h"
#include "base/format_macros.h"
#include "base/notreached.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#define STAT_ENUM_TO_STRING(enum) …
namespace media {
namespace cast {
namespace {
CastLoggingEvent;
EventMediaType;
const size_t kMaxPacketEventTimeMapSize = …;
bool IsReceiverEvent(CastLoggingEvent event) { … }
}
StatsEventSubscriber::SimpleHistogram::SimpleHistogram(int64_t min,
int64_t max,
int64_t width)
: … { … }
StatsEventSubscriber::SimpleHistogram::~SimpleHistogram() = default;
void StatsEventSubscriber::SimpleHistogram::Add(int64_t sample) { … }
void StatsEventSubscriber::SimpleHistogram::Reset() { … }
base::Value::List StatsEventSubscriber::SimpleHistogram::GetHistogram() const { … }
StatsEventSubscriber::StatsEventSubscriber(
EventMediaType event_media_type,
const base::TickClock* clock,
ReceiverTimeOffsetEstimator* offset_estimator)
: … { … }
StatsEventSubscriber::~StatsEventSubscriber() { … }
void StatsEventSubscriber::OnReceiveFrameEvent(const FrameEvent& frame_event) { … }
void StatsEventSubscriber::OnReceivePacketEvent(
const PacketEvent& packet_event) { … }
void StatsEventSubscriber::UpdateFirstLastEventTime(base::TimeTicks timestamp,
bool is_receiver_event) { … }
base::Value::Dict StatsEventSubscriber::GetStats() const { … }
void StatsEventSubscriber::Reset() { … }
const char* StatsEventSubscriber::CastStatToString(CastStat stat) { … }
const int kDefaultMaxLatencyBucketMs = …;
const int kDefaultBucketWidthMs = …;
const int kSmallMaxLatencyBucketMs = …;
const int kSmallBucketWidthMs = …;
const int kLargeMaxLatencyBucketMs = …;
const int kLargeBucketWidthMs = …;
void StatsEventSubscriber::InitHistograms() { … }
void StatsEventSubscriber::GetStatsInternal(StatsMap* stats_map) const { … }
StatsEventSubscriber::SimpleHistogram*
StatsEventSubscriber::GetHistogramForTesting(
CastStat stats) const { … }
bool StatsEventSubscriber::GetReceiverOffset(base::TimeDelta* offset) { … }
void StatsEventSubscriber::MaybeInsertFrameInfo(RtpTimeTicks rtp_timestamp,
const FrameInfo& frame_info) { … }
void StatsEventSubscriber::RecordFrameCaptureTime(
const FrameEvent& frame_event) { … }
void StatsEventSubscriber::RecordCaptureLatency(const FrameEvent& frame_event) { … }
void StatsEventSubscriber::RecordEncodeLatency(const FrameEvent& frame_event) { … }
void StatsEventSubscriber::RecordFrameTxLatency(const FrameEvent& frame_event) { … }
void StatsEventSubscriber::RecordE2ELatency(const FrameEvent& frame_event) { … }
void StatsEventSubscriber::UpdateLastResponseTime(
base::TimeTicks receiver_time) { … }
void StatsEventSubscriber::ErasePacketSentTime(
const PacketEvent& packet_event) { … }
void StatsEventSubscriber::RecordPacketRelatedLatencies(
const PacketEvent& packet_event) { … }
void StatsEventSubscriber::PopulateFpsStat(base::TimeTicks end_time,
CastLoggingEvent event,
CastStat stat,
StatsMap* stats_map) const { … }
void StatsEventSubscriber::PopulateFrameCountStat(CastLoggingEvent event,
CastStat stat,
StatsMap* stats_map) const { … }
void StatsEventSubscriber::PopulatePacketCountStat(CastLoggingEvent event,
CastStat stat,
StatsMap* stats_map) const { … }
void StatsEventSubscriber::PopulateFrameBitrateStat(base::TimeTicks end_time,
StatsMap* stats_map) const { … }
void StatsEventSubscriber::PopulatePacketBitrateStat(
base::TimeTicks end_time,
CastLoggingEvent event,
CastStat stat,
StatsMap* stats_map) const { … }
StatsEventSubscriber::FrameLogStats::FrameLogStats()
: … { … }
StatsEventSubscriber::FrameLogStats::~FrameLogStats() = default;
StatsEventSubscriber::PacketLogStats::PacketLogStats()
: … { … }
StatsEventSubscriber::PacketLogStats::~PacketLogStats() = default;
StatsEventSubscriber::FrameInfo::FrameInfo() : … { … }
StatsEventSubscriber::FrameInfo::~FrameInfo() = default;
}
}