From e4b5023f6509a93f382b7d8f2214cdd5edeea184 Mon Sep 17 00:00:00 2001 From: Elad Alon Date: Mon, 14 Jan 2019 18:56:14 +0100 Subject: [PATCH] Avoid repeated semi-expensive field_trials read in frame_buffer2.cc Bug: webrtc:10202 Change-Id: Ib8bfe7c1d62bc5091a8bfb2ce137ba749f9042e6 Reviewed-on: https://webrtc-review.googlesource.com/c/117361 Reviewed-by: Philip Eliasson Commit-Queue: Elad Alon Cr-Commit-Position: refs/heads/master@{#26261} --- modules/video_coding/frame_buffer2.cc | 7 ++++--- modules/video_coding/frame_buffer2.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/video_coding/frame_buffer2.cc b/modules/video_coding/frame_buffer2.cc index e52af53353..2eb5866595 100644 --- a/modules/video_coding/frame_buffer2.cc +++ b/modules/video_coding/frame_buffer2.cc @@ -60,7 +60,9 @@ FrameBuffer::FrameBuffer(Clock* clock, stopped_(false), protection_mode_(kProtectionNack), stats_callback_(stats_callback), - last_log_non_decoded_ms_(-kLogNonDecodedIntervalMs) {} + last_log_non_decoded_ms_(-kLogNonDecodedIntervalMs), + add_rtt_to_playout_delay_( + webrtc::field_trial::IsEnabled("WebRTC-AddRttToPlayoutDelay")) {} FrameBuffer::~FrameBuffer() {} @@ -214,8 +216,7 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame( timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms); } else { - if (RttMultExperiment::RttMultEnabled() || - webrtc::field_trial::IsEnabled("WebRTC-AddRttToPlayoutDelay")) + if (RttMultExperiment::RttMultEnabled() || add_rtt_to_playout_delay_) jitter_estimator_->FrameNacked(); } diff --git a/modules/video_coding/frame_buffer2.h b/modules/video_coding/frame_buffer2.h index 1f41bfa7e4..c71c19fcf1 100644 --- a/modules/video_coding/frame_buffer2.h +++ b/modules/video_coding/frame_buffer2.h @@ -173,6 +173,8 @@ class FrameBuffer { VCMReceiveStatisticsCallback* const stats_callback_; int64_t last_log_non_decoded_ms_ RTC_GUARDED_BY(crit_); + const bool add_rtt_to_playout_delay_; + RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer); };