video RTT 作用笔记
作者:LanPZzzz
文章目录
1. RTT 下发 video\call_stats.cc 120,通过线程
void CallStats::Process() {
RTC_DCHECK_RUN_ON(&process_thread_checker_);
int64_t now = clock_->TimeInMilliseconds();
last_process_time_ = now;
int64_t avg_rtt_ms = avg_rtt_ms_;
RemoveOldReports(now, &reports_);
获取
max_rtt_ms_ = GetMaxRttMs(reports_);
avg_rtt_ms = GetNewAvgRttMs(reports_, avg_rtt_ms);
{
rtc::CritScope lock(&avg_rtt_ms_lock_);
avg_rtt_ms_ = avg_rtt_ms;
}
// If there is a valid rtt, update all observers with the max rtt.
if (max_rtt_ms_ >= 0) {
RTC_DCHECK_GE(avg_rtt_ms, 0);
下发
for (CallStatsObserver* observer : observers_)
observer->OnRttUpdate(avg_rtt_ms, max_rtt_ms_);
// Sum for Histogram of average RTT reported over the entire call.
sum_avg_rtt_ms_ += avg_rtt_ms;
++num_avg_rtt_;
}
}
2. RTT 下发,作用,发送给各个ObServer 用于各自的计算
for (CallStatsObserver* observer : observers_)
observer->OnRttUpdate(avg_rtt_ms, max_rtt_ms_);
-> OnRttUpdate 下的3个observer
-> VideoReceiveStream::OnRttUpdate (\video\video_receive_stream.cc 360ÿ