Revert "Use injected clock in android_video_track_source"

This reverts commit 3b4a327fe1f6531050b6dc50c6573f20b587c91a.

Reason for revert: Breaks upstream

Original change's description:
> Use injected clock in android_video_track_source
>
> This adds Environment to the OwnedFactoryAndThreads for propagation to
> utilities created by the PeerConnectionFactory.
>
> Bug: webrtc:42223992
> Change-Id: I08550f7e06f77cdeeb911ec7fb3b94d26a6a6964
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/446602
> Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
> Reviewed-by: Zoé Lepaul <zlep@webrtc.org>
> Commit-Queue: Zoé Lepaul <zlep@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#46842}

Bug: webrtc:42223992
Change-Id: I1593f606a408604f4f0acb835e31be5c366a45b6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/446241
Commit-Queue: Zoé Lepaul <zlep@webrtc.org>
Reviewed-by: Zoé Lepaul <zlep@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46845}
diff --git a/examples/androidnativeapi/BUILD.gn b/examples/androidnativeapi/BUILD.gn
index ff4458e..adc9a33 100644
--- a/examples/androidnativeapi/BUILD.gn
+++ b/examples/androidnativeapi/BUILD.gn
@@ -54,8 +54,6 @@
       "../../api:rtc_error",
       "../../api:scoped_refptr",
       "../../api:sequence_checker",
-      "../../api/environment",
-      "../../api/environment:environment_factory",
       "../../api/video:video_frame",
       "../../rtc_base:checks",
       "../../rtc_base:logging",
diff --git a/examples/androidnativeapi/jni/android_call_client.cc b/examples/androidnativeapi/jni/android_call_client.cc
index c2a6454..e2fa4e7 100644
--- a/examples/androidnativeapi/jni/android_call_client.cc
+++ b/examples/androidnativeapi/jni/android_call_client.cc
@@ -19,7 +19,6 @@
 #include "api/create_modular_peer_connection_factory.h"
 #include "api/data_channel_interface.h"
 #include "api/enable_media_with_defaults.h"
-#include "api/environment/environment_factory.h"
 #include "api/jsep.h"
 #include "api/make_ref_counted.h"
 #include "api/media_stream_interface.h"
@@ -94,9 +93,7 @@
 }  // namespace
 
 AndroidCallClient::AndroidCallClient()
-    : env_(webrtc::CreateEnvironment()),
-      call_started_(false),
-      pc_observer_(std::make_unique<PCObserver>(this)) {
+    : call_started_(false), pc_observer_(std::make_unique<PCObserver>(this)) {
   thread_checker_.Detach();
   CreatePeerConnectionFactory();
 }
@@ -118,10 +115,9 @@
   local_sink_ = webrtc::JavaToNativeVideoSink(env, local_sink.obj());
   remote_sink_ = webrtc::JavaToNativeVideoSink(env, remote_sink.obj());
 
-  video_source_ =
-      webrtc::CreateJavaVideoSource(env, signaling_thread_.get(),
-                                    /* is_screencast= */ false,
-                                    /* align_timestamps= */ true, env_);
+  video_source_ = webrtc::CreateJavaVideoSource(env, signaling_thread_.get(),
+                                                /* is_screencast= */ false,
+                                                /* align_timestamps= */ true);
 
   CreatePeerConnection();
   Connect();
@@ -172,10 +168,10 @@
   RTC_CHECK(signaling_thread_->Start()) << "Failed to start thread";
 
   webrtc::PeerConnectionFactoryDependencies pcf_deps;
-  pcf_deps.env = env_;
   pcf_deps.network_thread = network_thread_.get();
   pcf_deps.worker_thread = worker_thread_.get();
   pcf_deps.signaling_thread = signaling_thread_.get();
+  pcf_deps.event_log_factory = std::make_unique<webrtc::RtcEventLogFactory>();
 
   pcf_deps.video_encoder_factory =
       std::make_unique<webrtc::InternalEncoderFactory>();
diff --git a/examples/androidnativeapi/jni/android_call_client.h b/examples/androidnativeapi/jni/android_call_client.h
index 5853ae6..6fffdad 100644
--- a/examples/androidnativeapi/jni/android_call_client.h
+++ b/examples/androidnativeapi/jni/android_call_client.h
@@ -15,7 +15,6 @@
 
 #include <memory>
 
-#include "api/environment/environment.h"
 #include "api/peer_connection_interface.h"
 #include "api/scoped_refptr.h"
 #include "api/sequence_checker.h"
@@ -50,7 +49,6 @@
   void CreatePeerConnection() RTC_RUN_ON(thread_checker_);
   void Connect() RTC_RUN_ON(thread_checker_);
 
-  const webrtc::Environment env_;
   webrtc::SequenceChecker thread_checker_;
 
   bool call_started_ RTC_GUARDED_BY(thread_checker_);
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index 00a9d33..21687fa 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -617,7 +617,6 @@
       "../../api:scoped_refptr",
       "../../api:sequence_checker",
       "../../api/audio:audio_processing",
-      "../../api/environment",
       "../../api/task_queue:pending_task_safety_flag",
       "../../rtc_base:checks",
       "../../rtc_base:ip_address",
@@ -1148,7 +1147,6 @@
       "../../api:jsep",
       "../../api:libjingle_peerconnection_api",
       "../../api:scoped_refptr",
-      "../../api/environment",
       "../../api/video_codecs:video_codecs_api",
       "../../rtc_base:socket_factory",
       "../../rtc_base:threading",
@@ -1191,7 +1189,6 @@
       "../../api:make_ref_counted",
       "../../api:media_stream_interface",
       "../../api:scoped_refptr",
-      "../../api/environment",
       "../../api/video:recordable_encoded_frame",
       "../../api/video:video_frame",
       "../../api/video:video_rtp_headers",
@@ -1795,7 +1792,6 @@
       "../../rtc_base:timeutils",
       "../../rtc_base/synchronization:mutex",
       "../../rtc_base/system:inline",
-      "../../test:create_test_environment",
       "../../test:create_test_field_trials",
       "../../test:fileutils",
       "../../test:test_support",
diff --git a/sdk/android/native_api/peerconnection/peer_connection_factory.cc b/sdk/android/native_api/peerconnection/peer_connection_factory.cc
index e594cf0..74ac367 100644
--- a/sdk/android/native_api/peerconnection/peer_connection_factory.cc
+++ b/sdk/android/native_api/peerconnection/peer_connection_factory.cc
@@ -28,11 +28,10 @@
     std::unique_ptr<SocketFactory> socket_factory,
     std::unique_ptr<Thread> network_thread,
     std::unique_ptr<Thread> worker_thread,
-    std::unique_ptr<Thread> signaling_thread,
-    const Environment& env) {
+    std::unique_ptr<Thread> signaling_thread) {
   return jni::NativeToJavaPeerConnectionFactory(
       jni, pcf, std::move(socket_factory), std::move(network_thread),
-      std::move(worker_thread), std::move(signaling_thread), env);
+      std::move(worker_thread), std::move(signaling_thread));
 }
 
 }  // namespace webrtc
diff --git a/sdk/android/native_api/peerconnection/peer_connection_factory.h b/sdk/android/native_api/peerconnection/peer_connection_factory.h
index 1252626..1f5d845 100644
--- a/sdk/android/native_api/peerconnection/peer_connection_factory.h
+++ b/sdk/android/native_api/peerconnection/peer_connection_factory.h
@@ -15,7 +15,6 @@
 
 #include <memory>
 
-#include "api/environment/environment.h"
 #include "api/peer_connection_interface.h"
 #include "api/scoped_refptr.h"
 #include "rtc_base/socket_factory.h"
@@ -30,8 +29,7 @@
     std::unique_ptr<SocketFactory> socket_factory,
     std::unique_ptr<Thread> network_thread,
     std::unique_ptr<Thread> worker_thread,
-    std::unique_ptr<Thread> signaling_thread,
-    const Environment& env);
+    std::unique_ptr<Thread> signaling_thread);
 
 }  // namespace webrtc
 
diff --git a/sdk/android/native_api/video/video_source.cc b/sdk/android/native_api/video/video_source.cc
index eec15b5..3b1a399 100644
--- a/sdk/android/native_api/video/video_source.cc
+++ b/sdk/android/native_api/video/video_source.cc
@@ -39,14 +39,12 @@
   JavaVideoTrackSourceImpl(JNIEnv* env,
                            Thread* signaling_thread,
                            bool is_screencast,
-                           bool align_timestamps,
-                           const Environment& env_webrtc)
+                           bool align_timestamps)
       : android_video_track_source_(
             make_ref_counted<jni::AndroidVideoTrackSource>(signaling_thread,
                                                            env,
                                                            is_screencast,
-                                                           align_timestamps,
-                                                           env_webrtc)),
+                                                           align_timestamps)),
         native_capturer_observer_(jni::CreateJavaNativeCapturerObserver(
             env,
             android_video_track_source_)) {}
@@ -121,10 +119,9 @@
     JNIEnv* jni,
     Thread* signaling_thread,
     bool is_screencast,
-    bool align_timestamps,
-    const Environment& env_webrtc) {
+    bool align_timestamps) {
   return make_ref_counted<JavaVideoTrackSourceImpl>(
-      jni, signaling_thread, is_screencast, align_timestamps, env_webrtc);
+      jni, signaling_thread, is_screencast, align_timestamps);
 }
 
 }  // namespace webrtc
diff --git a/sdk/android/native_api/video/video_source.h b/sdk/android/native_api/video/video_source.h
index 0c9c8ff..7f6779d 100644
--- a/sdk/android/native_api/video/video_source.h
+++ b/sdk/android/native_api/video/video_source.h
@@ -13,7 +13,6 @@
 
 #include <jni.h>
 
-#include "api/environment/environment.h"
 #include "api/media_stream_interface.h"
 #include "api/scoped_refptr.h"
 #include "rtc_base/thread.h"
@@ -36,8 +35,7 @@
     JNIEnv* env,
     Thread* signaling_thread,
     bool is_screencast,
-    bool align_timestamps,
-    const Environment& env_webrtc);
+    bool align_timestamps);
 
 }  // namespace webrtc
 
diff --git a/sdk/android/native_unittests/peerconnection/peer_connection_factory_unittest.cc b/sdk/android/native_unittests/peerconnection/peer_connection_factory_unittest.cc
index 1070171..d789828 100644
--- a/sdk/android/native_unittests/peerconnection/peer_connection_factory_unittest.cc
+++ b/sdk/android/native_unittests/peerconnection/peer_connection_factory_unittest.cc
@@ -17,6 +17,7 @@
 
 #include "api/create_modular_peer_connection_factory.h"
 #include "api/enable_media_with_defaults.h"
+#include "api/environment/environment_factory.h"
 #include "api/peer_connection_interface.h"
 #include "api/rtc_event_log/rtc_event_log_factory.h"
 #include "api/scoped_refptr.h"
@@ -30,7 +31,6 @@
 #include "sdk/android/native_api/audio_device_module/audio_device_android.h"
 #include "sdk/android/native_api/jni/application_context_provider.h"
 #include "sdk/android/native_api/jni/jvm.h"
-#include "test/create_test_environment.h"
 #include "test/gtest.h"
 
 namespace webrtc {
@@ -42,8 +42,7 @@
     JNIEnv* jni,
     webrtc::Thread* network_thread,
     webrtc::Thread* worker_thread,
-    webrtc::Thread* signaling_thread,
-    const Environment& env) {
+    webrtc::Thread* signaling_thread) {
   // talk/ assumes pretty widely that the current Thread is ThreadManager'd, but
   // ThreadManager only WrapCurrentThread()s the thread where it is first
   // created.  Since the semantics around when auto-wrapping happens in
@@ -55,7 +54,8 @@
   pcf_deps.network_thread = network_thread;
   pcf_deps.worker_thread = worker_thread;
   pcf_deps.signaling_thread = signaling_thread;
-  pcf_deps.env = env;
+  pcf_deps.event_log_factory = std::make_unique<RtcEventLogFactory>();
+  pcf_deps.env = CreateEnvironment();
 
   pcf_deps.adm =
       CreateJavaAudioDeviceModule(jni, *pcf_deps.env, GetAppContext(jni).obj());
@@ -96,14 +96,13 @@
   signaling_thread->SetName("signaling_thread", NULL);
   RTC_CHECK(signaling_thread->Start()) << "Failed to start thread";
 
-  const Environment env = CreateTestEnvironment();
   webrtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory =
       CreateTestPCF(jni, network_thread.get(), worker_thread.get(),
-                    signaling_thread.get(), env);
+                    signaling_thread.get());
 
   jobject java_factory = NativeToJavaPeerConnectionFactory(
       jni, factory, std::move(socket_server), std::move(network_thread),
-      std::move(worker_thread), std::move(signaling_thread), env);
+      std::move(worker_thread), std::move(signaling_thread));
 
   RTC_LOG(LS_INFO) << java_factory;
 
diff --git a/sdk/android/native_unittests/video/video_source_unittest.cc b/sdk/android/native_unittests/video/video_source_unittest.cc
index 9a5144b..0dce960 100644
--- a/sdk/android/native_unittests/video/video_source_unittest.cc
+++ b/sdk/android/native_unittests/video/video_source_unittest.cc
@@ -23,7 +23,6 @@
 #include "rtc_base/thread.h"
 #include "sdk/android/generated_native_unittests_jni/JavaVideoSourceTestHelper_jni.h"
 #include "sdk/android/native_api/jni/jvm.h"
-#include "test/create_test_environment.h"
 #include "test/gtest.h"
 
 namespace webrtc {
@@ -53,8 +52,7 @@
   webrtc::scoped_refptr<JavaVideoTrackSourceInterface> video_track_source =
       CreateJavaVideoSource(
           env, webrtc::ThreadManager::Instance()->CurrentThread(),
-          false /* is_screencast */, true /* align_timestamps */,
-          CreateTestEnvironment());
+          false /* is_screencast */, true /* align_timestamps */);
 
   ASSERT_NE(nullptr, video_track_source);
   EXPECT_NE(nullptr,
@@ -71,8 +69,7 @@
   webrtc::scoped_refptr<JavaVideoTrackSourceInterface> video_track_source =
       CreateJavaVideoSource(
           env, webrtc::ThreadManager::Instance()->CurrentThread(),
-          false /* is_screencast */, true /* align_timestamps */,
-          CreateTestEnvironment());
+          false /* is_screencast */, true /* align_timestamps */);
   video_track_source->AddOrUpdateSink(&test_video_sink,
                                       webrtc::VideoSinkWants());
 
@@ -106,8 +103,7 @@
   webrtc::scoped_refptr<JavaVideoTrackSourceInterface> video_track_source =
       CreateJavaVideoSource(
           env, webrtc::ThreadManager::Instance()->CurrentThread(),
-          false /* is_screencast */, false /* align_timestamps */,
-          CreateTestEnvironment());
+          false /* is_screencast */, false /* align_timestamps */);
   video_track_source->AddOrUpdateSink(&test_video_sink,
                                       webrtc::VideoSinkWants());
 
@@ -139,8 +135,7 @@
   webrtc::scoped_refptr<JavaVideoTrackSourceInterface> video_track_source =
       CreateJavaVideoSource(
           env, webrtc::ThreadManager::Instance()->CurrentThread(),
-          false /* is_screencast */, true /* align_timestamps */,
-          CreateTestEnvironment());
+          false /* is_screencast */, true /* align_timestamps */);
 
   jni::Java_JavaVideoSourceTestHelper_startCapture(
       env, video_track_source->GetJavaVideoCapturerObserver(env),
@@ -158,8 +153,7 @@
   webrtc::scoped_refptr<JavaVideoTrackSourceInterface> video_track_source =
       CreateJavaVideoSource(
           env, webrtc::ThreadManager::Instance()->CurrentThread(),
-          false /* is_screencast */, true /* align_timestamps */,
-          CreateTestEnvironment());
+          false /* is_screencast */, true /* align_timestamps */);
 
   jni::Java_JavaVideoSourceTestHelper_startCapture(
       env, video_track_source->GetJavaVideoCapturerObserver(env),
@@ -177,8 +171,7 @@
   webrtc::scoped_refptr<JavaVideoTrackSourceInterface> video_track_source =
       CreateJavaVideoSource(
           env, webrtc::ThreadManager::Instance()->CurrentThread(),
-          false /* is_screencast */, true /* align_timestamps */,
-          CreateTestEnvironment());
+          false /* is_screencast */, true /* align_timestamps */);
 
   jni::Java_JavaVideoSourceTestHelper_startCapture(
       env, video_track_source->GetJavaVideoCapturerObserver(env),
diff --git a/sdk/android/src/jni/android_video_track_source.cc b/sdk/android/src/jni/android_video_track_source.cc
index d075081..bfa493f 100644
--- a/sdk/android/src/jni/android_video_track_source.cc
+++ b/sdk/android/src/jni/android_video_track_source.cc
@@ -57,10 +57,8 @@
 AndroidVideoTrackSource::AndroidVideoTrackSource(Thread* signaling_thread,
                                                  JNIEnv* jni,
                                                  bool is_screencast,
-                                                 bool align_timestamps,
-                                                 const Environment& env)
+                                                 bool align_timestamps)
     : AdaptedVideoTrackSource(kRequiredResolutionAlignment),
-      env_(env),
       signaling_thread_(signaling_thread),
       is_screencast_(is_screencast),
       align_timestamps_(align_timestamps),
@@ -113,9 +111,8 @@
   const int64_t camera_time_us = j_timestamp_ns / kNumNanosecsPerMicrosec;
   const int64_t aligned_timestamp_ns =
       align_timestamps_
-          ? kNumNanosecsPerMicrosec *
-                timestamp_aligner_.TranslateTimestamp(
-                    camera_time_us, env_.clock().TimeInMicroseconds())
+          ? kNumNanosecsPerMicrosec * timestamp_aligner_.TranslateTimestamp(
+                                          camera_time_us, TimeMicros())
           : j_timestamp_ns;
 
   int adapted_width = 0;
diff --git a/sdk/android/src/jni/android_video_track_source.h b/sdk/android/src/jni/android_video_track_source.h
index cdc19ef..3ea1e71 100644
--- a/sdk/android/src/jni/android_video_track_source.h
+++ b/sdk/android/src/jni/android_video_track_source.h
@@ -16,7 +16,6 @@
 #include <atomic>
 #include <optional>
 
-#include "api/environment/environment.h"
 #include "api/scoped_refptr.h"
 #include "api/task_queue/pending_task_safety_flag.h"
 #include "media/base/adapted_video_track_source.h"
@@ -37,8 +36,7 @@
   AndroidVideoTrackSource(Thread* signaling_thread,
                           JNIEnv* jni,
                           bool is_screencast,
-                          bool align_timestamps,
-                          const Environment& env);
+                          bool align_timestamps);
   ~AndroidVideoTrackSource() override;
 
   bool is_screencast() const override;
@@ -89,7 +87,6 @@
   void SetIsScreencast(JNIEnv* env, jboolean j_is_screencast);
 
  private:
-  const Environment env_;
   Thread* signaling_thread_;
   std::atomic<SourceState> state_;
   std::atomic<bool> is_screencast_;
diff --git a/sdk/android/src/jni/pc/owned_factory_and_threads.cc b/sdk/android/src/jni/pc/owned_factory_and_threads.cc
index ec08c88..ccf360c 100644
--- a/sdk/android/src/jni/pc/owned_factory_and_threads.cc
+++ b/sdk/android/src/jni/pc/owned_factory_and_threads.cc
@@ -26,13 +26,11 @@
     std::unique_ptr<Thread> network_thread,
     std::unique_ptr<Thread> worker_thread,
     std::unique_ptr<Thread> signaling_thread,
-    const Environment& env,
     const scoped_refptr<PeerConnectionFactoryInterface>& factory)
     : socket_factory_(std::move(socket_factory)),
       network_thread_(std::move(network_thread)),
       worker_thread_(std::move(worker_thread)),
       signaling_thread_(std::move(signaling_thread)),
-      env_(env),
       factory_(factory) {}
 
 }  // namespace jni
diff --git a/sdk/android/src/jni/pc/owned_factory_and_threads.h b/sdk/android/src/jni/pc/owned_factory_and_threads.h
index 28ba838..4b22cb9 100644
--- a/sdk/android/src/jni/pc/owned_factory_and_threads.h
+++ b/sdk/android/src/jni/pc/owned_factory_and_threads.h
@@ -11,9 +11,9 @@
 #ifndef SDK_ANDROID_SRC_JNI_PC_OWNED_FACTORY_AND_THREADS_H_
 #define SDK_ANDROID_SRC_JNI_PC_OWNED_FACTORY_AND_THREADS_H_
 
+
 #include <memory>
 
-#include "api/environment/environment.h"
 #include "api/peer_connection_interface.h"
 #include "api/scoped_refptr.h"
 #include "rtc_base/socket_factory.h"
@@ -35,7 +35,6 @@
       std::unique_ptr<Thread> network_thread,
       std::unique_ptr<Thread> worker_thread,
       std::unique_ptr<Thread> signaling_thread,
-      const Environment& env,
       const scoped_refptr<PeerConnectionFactoryInterface>& factory);
 
   ~OwnedFactoryAndThreads() = default;
@@ -45,7 +44,6 @@
   Thread* network_thread() { return network_thread_.get(); }
   Thread* signaling_thread() { return signaling_thread_.get(); }
   Thread* worker_thread() { return worker_thread_.get(); }
-  const Environment& env() const { return env_; }
 
  private:
   // Usually implemented by the SocketServer associated with the network thread,
@@ -54,7 +52,6 @@
   const std::unique_ptr<Thread> network_thread_;
   const std::unique_ptr<Thread> worker_thread_;
   const std::unique_ptr<Thread> signaling_thread_;
-  const Environment env_;
   const scoped_refptr<PeerConnectionFactoryInterface> factory_;
 };
 
diff --git a/sdk/android/src/jni/pc/peer_connection_factory.cc b/sdk/android/src/jni/pc/peer_connection_factory.cc
index 4fae2fb..bd26b84 100644
--- a/sdk/android/src/jni/pc/peer_connection_factory.cc
+++ b/sdk/android/src/jni/pc/peer_connection_factory.cc
@@ -147,11 +147,10 @@
     std::unique_ptr<SocketFactory> socket_factory,
     std::unique_ptr<Thread> network_thread,
     std::unique_ptr<Thread> worker_thread,
-    std::unique_ptr<Thread> signaling_thread,
-    const Environment& webrtc_env) {
+    std::unique_ptr<Thread> signaling_thread) {
   OwnedFactoryAndThreads* owned_factory = new OwnedFactoryAndThreads(
       std::move(socket_factory), std::move(network_thread),
-      std::move(worker_thread), std::move(signaling_thread), webrtc_env, pcf);
+      std::move(worker_thread), std::move(signaling_thread), pcf);
 
   jni_zero::ScopedJavaLocalRef<jobject> j_pcf =
       Java_PeerConnectionFactory_Constructor(
@@ -188,11 +187,10 @@
     std::unique_ptr<SocketFactory> socket_factory,
     std::unique_ptr<Thread> network_thread,
     std::unique_ptr<Thread> worker_thread,
-    std::unique_ptr<Thread> signaling_thread,
-    const Environment& env) {
+    std::unique_ptr<Thread> signaling_thread) {
   return NativeToScopedJavaPeerConnectionFactory(
              jni, pcf, std::move(socket_factory), std::move(network_thread),
-             std::move(worker_thread), std::move(signaling_thread), env)
+             std::move(worker_thread), std::move(signaling_thread))
       .Release();
 }
 
@@ -340,7 +338,7 @@
 
   return NativeToScopedJavaPeerConnectionFactory(
       jni, factory, std::move(socket_server), std::move(network_thread),
-      std::move(worker_thread), std::move(signaling_thread), env);
+      std::move(worker_thread), std::move(signaling_thread));
 }
 
 static jni_zero::ScopedJavaLocalRef<jobject>
@@ -526,9 +524,9 @@
     jboolean align_timestamps) {
   OwnedFactoryAndThreads* factory =
       reinterpret_cast<OwnedFactoryAndThreads*>(native_factory);
-  return jlongFromPointer(CreateVideoSource(
-      jni, factory->signaling_thread(), factory->worker_thread(), is_screencast,
-      align_timestamps, factory->env()));
+  return jlongFromPointer(CreateVideoSource(jni, factory->signaling_thread(),
+                                            factory->worker_thread(),
+                                            is_screencast, align_timestamps));
 }
 
 static jlong JNI_PeerConnectionFactory_CreateVideoTrack(
diff --git a/sdk/android/src/jni/pc/peer_connection_factory.h b/sdk/android/src/jni/pc/peer_connection_factory.h
index 2ed3e30..f09c904e 100644
--- a/sdk/android/src/jni/pc/peer_connection_factory.h
+++ b/sdk/android/src/jni/pc/peer_connection_factory.h
@@ -15,7 +15,6 @@
 
 #include <memory>
 
-#include "api/environment/environment.h"
 #include "api/peer_connection_interface.h"
 #include "api/scoped_refptr.h"
 #include "rtc_base/socket_factory.h"
@@ -31,8 +30,7 @@
     std::unique_ptr<SocketFactory> socket_factory,
     std::unique_ptr<Thread> network_thread,
     std::unique_ptr<Thread> worker_thread,
-    std::unique_ptr<Thread> signaling_thread,
-    const Environment& env);
+    std::unique_ptr<Thread> signaling_thread);
 
 }  // namespace jni
 }  // namespace webrtc
diff --git a/sdk/android/src/jni/pc/video.cc b/sdk/android/src/jni/pc/video.cc
index eed844d..38fb1be 100644
--- a/sdk/android/src/jni/pc/video.cc
+++ b/sdk/android/src/jni/pc/video.cc
@@ -45,10 +45,9 @@
                         Thread* signaling_thread,
                         Thread* worker_thread,
                         jboolean is_screencast,
-                        jboolean align_timestamps,
-                        const Environment& env_webrtc) {
+                        jboolean align_timestamps) {
   auto source = make_ref_counted<AndroidVideoTrackSource>(
-      signaling_thread, env, is_screencast, align_timestamps, env_webrtc);
+      signaling_thread, env, is_screencast, align_timestamps);
   return source.release();
 }
 
diff --git a/sdk/android/src/jni/pc/video.h b/sdk/android/src/jni/pc/video.h
index 60a9f0b..3386cb9 100644
--- a/sdk/android/src/jni/pc/video.h
+++ b/sdk/android/src/jni/pc/video.h
@@ -13,7 +13,6 @@
 
 #include <jni.h>
 
-#include "api/environment/environment.h"
 #include "rtc_base/thread.h"
 #include "sdk/android/native_api/jni/scoped_java_ref.h"
 
@@ -37,8 +36,7 @@
                         Thread* signaling_thread,
                         Thread* worker_thread,
                         jboolean is_screencast,
-                        jboolean align_timestamps,
-                        const Environment& env_webrtc);
+                        jboolean align_timestamps);
 
 }  // namespace jni
 }  // namespace webrtc