#include "media/cast/sender/congestion_control.h"
#include <algorithm>
#include <deque>
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/trace_event/trace_event.h"
#include "media/cast/constants.h"
namespace media {
namespace cast {
class AdaptiveCongestionControl final : public CongestionControl { … };
class FixedCongestionControl final : public CongestionControl { … };
CongestionControl* NewAdaptiveCongestionControl(const base::TickClock* clock,
int max_bitrate_configured,
int min_bitrate_configured,
double max_frame_rate) { … }
CongestionControl* NewFixedCongestionControl(int bitrate) { … }
static const double kTargetEmptyBufferFraction = …;
static const size_t kHistorySize = …;
AdaptiveCongestionControl::FrameStats::FrameStats() : … { … }
AdaptiveCongestionControl::AdaptiveCongestionControl(
const base::TickClock* clock,
int max_bitrate_configured,
int min_bitrate_configured,
double max_frame_rate)
: … { … }
CongestionControl::~CongestionControl() = default;
AdaptiveCongestionControl::~AdaptiveCongestionControl() = default;
void AdaptiveCongestionControl::UpdateRtt(base::TimeDelta rtt) { … }
void AdaptiveCongestionControl::UpdateTargetPlayoutDelay(
base::TimeDelta delay) { … }
base::TimeDelta AdaptiveCongestionControl::DeadTime(const FrameStats& a,
const FrameStats& b) { … }
double AdaptiveCongestionControl::CalculateSafeBitrate() { … }
AdaptiveCongestionControl::FrameStats* AdaptiveCongestionControl::GetFrameStats(
FrameId frame_id) { … }
void AdaptiveCongestionControl::PruneFrameStats() { … }
void AdaptiveCongestionControl::AckFrame(FrameId frame_id,
base::TimeTicks when) { … }
void AdaptiveCongestionControl::AckLaterFrames(
std::vector<FrameId> received_frames,
base::TimeTicks when) { … }
void AdaptiveCongestionControl::WillSendFrameToTransport(
FrameId frame_id,
size_t frame_size_in_bytes,
base::TimeTicks when) { … }
base::TimeTicks AdaptiveCongestionControl::EstimatedSendingTime(
FrameId frame_id,
double estimated_bitrate) { … }
int AdaptiveCongestionControl::GetBitrate(base::TimeTicks playout_time,
base::TimeDelta playout_delay) { … }
}
}