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 <philipel@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26261}
diff --git a/modules/video_coding/frame_buffer2.cc b/modules/video_coding/frame_buffer2.cc
index e52af53..2eb5866 100644
--- a/modules/video_coding/frame_buffer2.cc
+++ b/modules/video_coding/frame_buffer2.cc
@@ -60,7 +60,9 @@
       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 @@
         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 1f41bfa..c71c19f 100644
--- a/modules/video_coding/frame_buffer2.h
+++ b/modules/video_coding/frame_buffer2.h
@@ -173,6 +173,8 @@
   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);
 };