WebRTC-DeprecateGlobalFieldTrialString/Enabled/ - part 10/inf

This patch takes a stab at modules/video_coding,
but reaches only about half.

Bug: webrtc:10335
Change-Id: I0d47d0468b818145470c51ae4e8e75ff58d499ae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256112
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36335}
diff --git a/modules/video_coding/video_coding_impl.cc b/modules/video_coding/video_coding_impl.cc
index 0129aa1..f3187d9 100644
--- a/modules/video_coding/video_coding_impl.cc
+++ b/modules/video_coding/video_coding_impl.cc
@@ -14,9 +14,12 @@
 #include <memory>
 
 #include "api/sequence_checker.h"
+#include "api/transport/field_trial_based_config.h"
 #include "api/video/encoded_image.h"
+#include "api/webrtc_key_value_config.h"
 #include "modules/video_coding/include/video_codec_interface.h"
 #include "modules/video_coding/timing.h"
+#include "rtc_base/memory/always_valid_pointer.h"
 #include "system_wrappers/include/clock.h"
 
 namespace webrtc {
@@ -41,10 +44,12 @@
 
 class VideoCodingModuleImpl : public VideoCodingModule {
  public:
-  explicit VideoCodingModuleImpl(Clock* clock)
+  explicit VideoCodingModuleImpl(Clock* clock,
+                                 const WebRtcKeyValueConfig* field_trials)
       : VideoCodingModule(),
-        timing_(new VCMTiming(clock)),
-        receiver_(clock, timing_.get()) {}
+        field_trials_(field_trials),
+        timing_(new VCMTiming(clock, *field_trials_)),
+        receiver_(clock, timing_.get(), *field_trials_) {}
 
   ~VideoCodingModuleImpl() override {}
 
@@ -104,6 +109,8 @@
   }
 
  private:
+  AlwaysValidPointer<const WebRtcKeyValueConfig, FieldTrialBasedConfig>
+      field_trials_;
   SequenceChecker construction_thread_;
   const std::unique_ptr<VCMTiming> timing_;
   vcm::VideoReceiver receiver_;
@@ -112,9 +119,11 @@
 
 // DEPRECATED.  Create method for current interface, will be removed when the
 // new jitter buffer is in place.
-VideoCodingModule* VideoCodingModule::Create(Clock* clock) {
+VideoCodingModule* VideoCodingModule::Create(
+    Clock* clock,
+    const WebRtcKeyValueConfig* field_trials) {
   RTC_DCHECK(clock);
-  return new VideoCodingModuleImpl(clock);
+  return new VideoCodingModuleImpl(clock, field_trials);
 }
 
 }  // namespace webrtc