f1b26c
diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
f1b26c
index 2081d0c683a4..641133bf1ea4 100644
f1b26c
--- a/config/system-headers.mozbuild
f1b26c
+++ b/config/system-headers.mozbuild
f1b26c
@@ -314,6 +314,7 @@ system_headers = [
f1b26c
     'Gestalt.h',
f1b26c
     'getopt.h',
f1b26c
     'gio/gio.h',
f1b26c
+    'gio/gunixfdlist.h',
f1b26c
     'glibconfig.h',
f1b26c
     'glib.h',
f1b26c
     'glib-object.h',
f1b26c
@@ -607,6 +608,7 @@ system_headers = [
f1b26c
     'Pgenerr.h',
f1b26c
     'PGenErr.h',
f1b26c
     'Ph.h',
f1b26c
+    'pipewire/pipewire.h',
f1b26c
     'pixman.h',
f1b26c
     'pk11func.h',
f1b26c
     'pk11pqg.h',
f1b26c
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn b/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn
f1b26c
index ba885217b3ba..201d3b755221 100644
f1b26c
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn
f1b26c
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn
f1b26c
@@ -158,7 +158,7 @@ if (rtc_include_tests) {
f1b26c
 if (is_linux) {
f1b26c
   if (rtc_use_pipewire) {
f1b26c
     pkg_config("pipewire") {
f1b26c
-      packages = [ "libpipewire-0.2" ]
f1b26c
+      packages = [ "libpipewire-0.3" ]
f1b26c
 
f1b26c
       defines = [ "WEBRTC_USE_PIPEWIRE" ]
f1b26c
     }
f1b26c
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
f1b26c
index 90b40431c7e4..d844aa79d591 100644
f1b26c
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
f1b26c
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
f1b26c
@@ -194,6 +194,30 @@ if CONFIG["OS_TARGET"] == "Linux":
f1b26c
         "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc"
f1b26c
     ]
f1b26c
 
f1b26c
+# PipeWire specific files
f1b26c
+if CONFIG["OS_TARGET"] == "Linux":
f1b26c
+
f1b26c
+    DEFINES["WEBRTC_USE_PIPEWIRE"] = "1"
f1b26c
+
f1b26c
+    OS_LIBS += [
f1b26c
+        "rt",
f1b26c
+        "pipewire-0.3",
f1b26c
+        "glib-2.0",
f1b26c
+        "gio-2.0",
f1b26c
+        "gobject-2.0"
f1b26c
+    ]
f1b26c
+
f1b26c
+    CXXFLAGS += CONFIG['TK_CFLAGS']
f1b26c
+    CXXFLAGS += [ "-I/usr/include/pipewire-0.3" ]
f1b26c
+    CXXFLAGS += [ "-I/usr/include/spa-0.2" ]
f1b26c
+
f1b26c
+    UNIFIED_SOURCES += [
f1b26c
+        "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc",
f1b26c
+        "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc",
f1b26c
+        "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc"
f1b26c
+    ]
f1b26c
+
f1b26c
+
f1b26c
 if CONFIG["OS_TARGET"] == "NetBSD":
f1b26c
 
f1b26c
     DEFINES["USE_X11"] = "1"
f1b26c
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
f1b26c
index 1eb8ead26efa..316468eed1fc 100644
f1b26c
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
f1b26c
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
f1b26c
@@ -141,7 +141,7 @@ class DesktopCaptureOptions {
f1b26c
   bool disable_effects_ = true;
f1b26c
   bool detect_updated_region_ = false;
f1b26c
 #if defined(WEBRTC_USE_PIPEWIRE)
f1b26c
-  bool allow_pipewire_ = false;
f1b26c
+  bool allow_pipewire_ = true;
f1b26c
 #endif
f1b26c
 };
f1b26c
 
f1b26c
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
f1b26c
index 379341c833de..76349f1fbd4d 100644
f1b26c
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
f1b26c
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
f1b26c
@@ -15,8 +15,11 @@
f1b26c
 
f1b26c
 #include <spa/param/format-utils.h>
f1b26c
 #include <spa/param/props.h>
f1b26c
-#include <spa/param/video/raw-utils.h>
f1b26c
-#include <spa/support/type-map.h>
f1b26c
+
f1b26c
+#include <linux/dma-buf.h>
f1b26c
+#include <sys/mman.h>
f1b26c
+#include <sys/ioctl.h>
f1b26c
+#include <sys/syscall.h>
f1b26c
 
f1b26c
 #include <memory>
f1b26c
 #include <utility>
f1b26c
@@ -36,31 +39,36 @@ const char kSessionInterfaceName[] = "org.freedesktop.portal.Session";
f1b26c
 const char kRequestInterfaceName[] = "org.freedesktop.portal.Request";
f1b26c
 const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast";
f1b26c
 
f1b26c
-// static
f1b26c
-void BaseCapturerPipeWire::OnStateChanged(void* data,
f1b26c
-                                          pw_remote_state old_state,
f1b26c
-                                          pw_remote_state state,
f1b26c
-                                          const char* error_message) {
f1b26c
-  BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
f1b26c
-  RTC_DCHECK(that);
f1b26c
 
f1b26c
-  switch (state) {
f1b26c
-    case PW_REMOTE_STATE_ERROR:
f1b26c
-      RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message;
f1b26c
-      break;
f1b26c
-    case PW_REMOTE_STATE_CONNECTED:
f1b26c
-      RTC_LOG(LS_INFO) << "PipeWire remote state: connected.";
f1b26c
-      that->CreateReceivingStream();
f1b26c
-      break;
f1b26c
-    case PW_REMOTE_STATE_CONNECTING:
f1b26c
-      RTC_LOG(LS_INFO) << "PipeWire remote state: connecting.";
f1b26c
+// static
f1b26c
+void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) {
f1b26c
+  struct dma_buf_sync sync = { 0 };
f1b26c
+
f1b26c
+  sync.flags = start_or_end | DMA_BUF_SYNC_READ;
f1b26c
+
f1b26c
+  while(true) {
f1b26c
+    int ret;
f1b26c
+    ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync);
f1b26c
+    if (ret == -1 && errno == EINTR) {
f1b26c
+      continue;
f1b26c
+    } else if (ret == -1) {
f1b26c
+      RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: " << g_strerror(errno);
f1b26c
       break;
f1b26c
-    case PW_REMOTE_STATE_UNCONNECTED:
f1b26c
-      RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected.";
f1b26c
+    } else {
f1b26c
       break;
f1b26c
+    }
f1b26c
   }
f1b26c
 }
f1b26c
 
f1b26c
+// static
f1b26c
+void BaseCapturerPipeWire::OnCoreError(void *data,
f1b26c
+                                       uint32_t id,
f1b26c
+                                       int seq,
f1b26c
+                                       int res,
f1b26c
+                                       const char *message) {
f1b26c
+  RTC_LOG(LS_ERROR) << "core error: " << message;
f1b26c
+}
f1b26c
+
f1b26c
 // static
f1b26c
 void BaseCapturerPipeWire::OnStreamStateChanged(void* data,
f1b26c
                                                 pw_stream_state old_state,
f1b26c
@@ -73,76 +81,54 @@ void BaseCapturerPipeWire::OnStreamStateChanged(void* data,
f1b26c
     case PW_STREAM_STATE_ERROR:
f1b26c
       RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message;
f1b26c
       break;
f1b26c
-    case PW_STREAM_STATE_CONFIGURE:
f1b26c
-      pw_stream_set_active(that->pw_stream_, true);
f1b26c
-      break;
f1b26c
-    case PW_STREAM_STATE_UNCONNECTED:
f1b26c
-    case PW_STREAM_STATE_CONNECTING:
f1b26c
-    case PW_STREAM_STATE_READY:
f1b26c
     case PW_STREAM_STATE_PAUSED:
f1b26c
     case PW_STREAM_STATE_STREAMING:
f1b26c
+    case PW_STREAM_STATE_UNCONNECTED:
f1b26c
+    case PW_STREAM_STATE_CONNECTING:
f1b26c
       break;
f1b26c
   }
f1b26c
 }
f1b26c
 
f1b26c
 // static
f1b26c
-void BaseCapturerPipeWire::OnStreamFormatChanged(void* data,
f1b26c
-                                                 const struct spa_pod* format) {
f1b26c
+void BaseCapturerPipeWire::OnStreamParamChanged(void *data, uint32_t id,
f1b26c
+                                                const struct spa_pod *format) {
f1b26c
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
f1b26c
   RTC_DCHECK(that);
f1b26c
 
f1b26c
-  RTC_LOG(LS_INFO) << "PipeWire stream format changed.";
f1b26c
+  RTC_LOG(LS_INFO) << "PipeWire stream param changed.";
f1b26c
 
f1b26c
-  if (!format) {
f1b26c
-    pw_stream_finish_format(that->pw_stream_, /*res=*/0, /*params=*/nullptr,
f1b26c
-                            /*n_params=*/0);
f1b26c
+  if (!format || id != SPA_PARAM_Format) {
f1b26c
     return;
f1b26c
   }
f1b26c
 
f1b26c
-  that->spa_video_format_ = new spa_video_info_raw();
f1b26c
-  spa_format_video_raw_parse(format, that->spa_video_format_,
f1b26c
-                             &that->pw_type_->format_video);
f1b26c
+  spa_format_video_raw_parse(format, &that->spa_video_format_);
f1b26c
 
f1b26c
-  auto width = that->spa_video_format_->size.width;
f1b26c
-  auto height = that->spa_video_format_->size.height;
f1b26c
+  auto width = that->spa_video_format_.size.width;
f1b26c
+  auto height = that->spa_video_format_.size.height;
f1b26c
   auto stride = SPA_ROUND_UP_N(width * kBytesPerPixel, 4);
f1b26c
   auto size = height * stride;
f1b26c
 
f1b26c
+  that->desktop_size_ = DesktopSize(width, height);
f1b26c
+
f1b26c
   uint8_t buffer[1024] = {};
f1b26c
   auto builder = spa_pod_builder{buffer, sizeof(buffer)};
f1b26c
 
f1b26c
   // Setup buffers and meta header for new format.
f1b26c
-  const struct spa_pod* params[2];
f1b26c
-  params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
f1b26c
-      &builder,
f1b26c
-      // id to enumerate buffer requirements
f1b26c
-      that->pw_core_type_->param.idBuffers,
f1b26c
-      that->pw_core_type_->param_buffers.Buffers,
f1b26c
-      // Size: specified as integer (i) and set to specified size
f1b26c
-      ":", that->pw_core_type_->param_buffers.size, "i", size,
f1b26c
-      // Stride: specified as integer (i) and set to specified stride
f1b26c
-      ":", that->pw_core_type_->param_buffers.stride, "i", stride,
f1b26c
-      // Buffers: specifies how many buffers we want to deal with, set as
f1b26c
-      // integer (i) where preferred number is 8, then allowed number is defined
f1b26c
-      // as range (r) from min and max values and it is undecided (u) to allow
f1b26c
-      // negotiation
f1b26c
-      ":", that->pw_core_type_->param_buffers.buffers, "iru", 8,
f1b26c
-      SPA_POD_PROP_MIN_MAX(1, 32),
f1b26c
-      // Align: memory alignment of the buffer, set as integer (i) to specified
f1b26c
-      // value
f1b26c
-      ":", that->pw_core_type_->param_buffers.align, "i", 16));
f1b26c
-  params[1] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
f1b26c
-      &builder,
f1b26c
-      // id to enumerate supported metadata
f1b26c
-      that->pw_core_type_->param.idMeta, that->pw_core_type_->param_meta.Meta,
f1b26c
-      // Type: specified as id or enum (I)
f1b26c
-      ":", that->pw_core_type_->param_meta.type, "I",
f1b26c
-      that->pw_core_type_->meta.Header,
f1b26c
-      // Size: size of the metadata, specified as integer (i)
f1b26c
-      ":", that->pw_core_type_->param_meta.size, "i",
f1b26c
-      sizeof(struct spa_meta_header)));
f1b26c
-
f1b26c
-  pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2);
f1b26c
+  const struct spa_pod* params[3];
f1b26c
+  params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
f1b26c
+              SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
f1b26c
+              SPA_PARAM_BUFFERS_size, SPA_POD_Int(size),
f1b26c
+              SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
f1b26c
+              SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 1, 32)));
f1b26c
+  params[1] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
f1b26c
+              SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
f1b26c
+              SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
f1b26c
+              SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header))));
f1b26c
+  params[2] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
f1b26c
+              SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
f1b26c
+              SPA_PARAM_META_type, SPA_POD_Id (SPA_META_VideoCrop),
f1b26c
+              SPA_PARAM_META_size, SPA_POD_Int (sizeof(struct spa_meta_region))));
f1b26c
+  pw_stream_update_params(that->pw_stream_, params, 3);
f1b26c
 }
f1b26c
 
f1b26c
 // static
f1b26c
@@ -150,15 +136,25 @@ void BaseCapturerPipeWire::OnStreamProcess(void* data) {
f1b26c
   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
f1b26c
   RTC_DCHECK(that);
f1b26c
 
f1b26c
-  pw_buffer* buf = nullptr;
f1b26c
+  struct pw_buffer *next_buffer;
f1b26c
+  struct pw_buffer *buffer = nullptr;
f1b26c
+
f1b26c
+  next_buffer = pw_stream_dequeue_buffer(that->pw_stream_);
f1b26c
+  while (next_buffer) {
f1b26c
+    buffer = next_buffer;
f1b26c
+    next_buffer = pw_stream_dequeue_buffer(that->pw_stream_);
f1b26c
 
f1b26c
-  if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) {
f1b26c
+    if (next_buffer)
f1b26c
+      pw_stream_queue_buffer (that->pw_stream_, buffer);
f1b26c
+  }
f1b26c
+
f1b26c
+  if (!buffer) {
f1b26c
     return;
f1b26c
   }
f1b26c
 
f1b26c
-  that->HandleBuffer(buf);
f1b26c
+  that->HandleBuffer(buffer);
f1b26c
 
f1b26c
-  pw_stream_queue_buffer(that->pw_stream_, buf);
f1b26c
+  pw_stream_queue_buffer(that->pw_stream_, buffer);
f1b26c
 }
f1b26c
 
f1b26c
 BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type)
f1b26c
@@ -169,38 +165,22 @@ BaseCapturerPipeWire::~BaseCapturerPipeWire() {
f1b26c
     pw_thread_loop_stop(pw_main_loop_);
f1b26c
   }
f1b26c
 
f1b26c
-  if (pw_type_) {
f1b26c
-    delete pw_type_;
f1b26c
-  }
f1b26c
-
f1b26c
-  if (spa_video_format_) {
f1b26c
-    delete spa_video_format_;
f1b26c
-  }
f1b26c
-
f1b26c
   if (pw_stream_) {
f1b26c
     pw_stream_destroy(pw_stream_);
f1b26c
   }
f1b26c
 
f1b26c
-  if (pw_remote_) {
f1b26c
-    pw_remote_destroy(pw_remote_);
f1b26c
+  if (pw_core_) {
f1b26c
+    pw_core_disconnect(pw_core_);
f1b26c
   }
f1b26c
 
f1b26c
-  if (pw_core_) {
f1b26c
-    pw_core_destroy(pw_core_);
f1b26c
+  if (pw_context_) {
f1b26c
+    pw_context_destroy(pw_context_);
f1b26c
   }
f1b26c
 
f1b26c
   if (pw_main_loop_) {
f1b26c
     pw_thread_loop_destroy(pw_main_loop_);
f1b26c
   }
f1b26c
 
f1b26c
-  if (pw_loop_) {
f1b26c
-    pw_loop_destroy(pw_loop_);
f1b26c
-  }
f1b26c
-
f1b26c
-  if (current_frame_) {
f1b26c
-    free(current_frame_);
f1b26c
-  }
f1b26c
-
f1b26c
   if (start_request_signal_id_) {
f1b26c
     g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_);
f1b26c
   }
f1b26c
@@ -250,27 +230,35 @@ void BaseCapturerPipeWire::InitPortal() {
f1b26c
 void BaseCapturerPipeWire::InitPipeWire() {
f1b26c
   pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
f1b26c
 
f1b26c
-  pw_loop_ = pw_loop_new(/*properties=*/nullptr);
f1b26c
-  pw_main_loop_ = pw_thread_loop_new(pw_loop_, "pipewire-main-loop");
f1b26c
-
f1b26c
-  pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr);
f1b26c
-  pw_core_type_ = pw_core_get_type(pw_core_);
f1b26c
-  pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0);
f1b26c
+  pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
f1b26c
+  pw_context_ = pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0);
f1b26c
+  if (!pw_context_) {
f1b26c
+    RTC_LOG(LS_ERROR) << "Failed to create PipeWire context";
f1b26c
+    return;
f1b26c
+  }
f1b26c
 
f1b26c
-  InitPipeWireTypes();
f1b26c
+  pw_core_ = pw_context_connect(pw_context_, nullptr, 0);
f1b26c
+  if (!pw_core_) {
f1b26c
+    RTC_LOG(LS_ERROR) << "Failed to connect PipeWire context";
f1b26c
+    return;
f1b26c
+  }
f1b26c
 
f1b26c
   // Initialize event handlers, remote end and stream-related.
f1b26c
-  pw_remote_events_.version = PW_VERSION_REMOTE_EVENTS;
f1b26c
-  pw_remote_events_.state_changed = &OnStateChanged;
f1b26c
+  pw_core_events_.version = PW_VERSION_CORE_EVENTS;
f1b26c
+  pw_core_events_.error = &OnCoreError;
f1b26c
 
f1b26c
   pw_stream_events_.version = PW_VERSION_STREAM_EVENTS;
f1b26c
   pw_stream_events_.state_changed = &OnStreamStateChanged;
f1b26c
-  pw_stream_events_.format_changed = &OnStreamFormatChanged;
f1b26c
+  pw_stream_events_.param_changed = &OnStreamParamChanged;
f1b26c
   pw_stream_events_.process = &OnStreamProcess;
f1b26c
 
f1b26c
-  pw_remote_add_listener(pw_remote_, &spa_remote_listener_, &pw_remote_events_,
f1b26c
-                         this);
f1b26c
-  pw_remote_connect_fd(pw_remote_, pw_fd_);
f1b26c
+  pw_core_add_listener(pw_core_, &spa_core_listener_, &pw_core_events_, this);
f1b26c
+
f1b26c
+  pw_stream_ = CreateReceivingStream();
f1b26c
+  if (!pw_stream_) {
f1b26c
+    RTC_LOG(LS_ERROR) << "Failed to create PipeWire stream";
f1b26c
+    return;
f1b26c
+  }
f1b26c
 
f1b26c
   if (pw_thread_loop_start(pw_main_loop_) < 0) {
f1b26c
     RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop";
f1b26c
@@ -278,81 +266,132 @@ void BaseCapturerPipeWire::InitPipeWire() {
f1b26c
   }
f1b26c
 }
f1b26c
 
f1b26c
-void BaseCapturerPipeWire::InitPipeWireTypes() {
f1b26c
-  spa_type_map* map = pw_core_type_->map;
f1b26c
-  pw_type_ = new PipeWireType();
f1b26c
-
f1b26c
-  spa_type_media_type_map(map, &pw_type_->media_type);
f1b26c
-  spa_type_media_subtype_map(map, &pw_type_->media_subtype);
f1b26c
-  spa_type_format_video_map(map, &pw_type_->format_video);
f1b26c
-  spa_type_video_format_map(map, &pw_type_->video_format);
f1b26c
-}
f1b26c
-
f1b26c
-void BaseCapturerPipeWire::CreateReceivingStream() {
f1b26c
+pw_stream* BaseCapturerPipeWire::CreateReceivingStream() {
f1b26c
   spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1};
f1b26c
-  spa_rectangle pwScreenBounds =
f1b26c
-      spa_rectangle{static_cast<uint32_t>(desktop_size_.width()),
f1b26c
-                    static_cast<uint32_t>(desktop_size_.height())};
f1b26c
+  spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX};
f1b26c
 
f1b26c
-  spa_fraction pwFrameRateMin = spa_fraction{0, 1};
f1b26c
-  spa_fraction pwFrameRateMax = spa_fraction{60, 1};
f1b26c
+  auto stream = pw_stream_new(pw_core_, "webrtc-pipewire-stream", nullptr);
f1b26c
 
f1b26c
-  pw_properties* reuseProps = pw_properties_new("pipewire.client.reuse", "1",
f1b26c
-                                                /*end of varargs*/ nullptr);
f1b26c
-  pw_stream_ = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps);
f1b26c
+  if (!stream) {
f1b26c
+    RTC_LOG(LS_ERROR) << "Could not create receiving stream.";
f1b26c
+    return nullptr;
f1b26c
+  }
f1b26c
 
f1b26c
   uint8_t buffer[1024] = {};
f1b26c
-  const spa_pod* params[1];
f1b26c
-  spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)};
f1b26c
-  params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
f1b26c
-      &builder,
f1b26c
-      // id to enumerate formats
f1b26c
-      pw_core_type_->param.idEnumFormat, pw_core_type_->spa_format, "I",
f1b26c
-      pw_type_->media_type.video, "I", pw_type_->media_subtype.raw,
f1b26c
-      // Video format: specified as id or enum (I), preferred format is BGRx,
f1b26c
-      // then allowed formats are enumerated (e) and the format is undecided (u)
f1b26c
-      // to allow negotiation
f1b26c
-      ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx,
f1b26c
-      SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx,
f1b26c
-                        pw_type_->video_format.BGRx),
f1b26c
-      // Video size: specified as rectangle (R), preferred size is specified as
f1b26c
-      // first parameter, then allowed size is defined as range (r) from min and
f1b26c
-      // max values and the format is undecided (u) to allow negotiation
f1b26c
-      ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2,
f1b26c
-      &pwMinScreenBounds, &pwScreenBounds,
f1b26c
-      // Frame rate: specified as fraction (F) and set to minimum frame rate
f1b26c
-      // value
f1b26c
-      ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin,
f1b26c
-      // Max frame rate: specified as fraction (F), preferred frame rate is set
f1b26c
-      // to maximum value, then allowed frame rate is defined as range (r) from
f1b26c
-      // min and max values and it is undecided (u) to allow negotiation
f1b26c
-      ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2,
f1b26c
-      &pwFrameRateMin, &pwFrameRateMax));
f1b26c
-
f1b26c
-  pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_,
f1b26c
-                         this);
f1b26c
+  const spa_pod* params[2];
f1b26c
+  spa_pod_builder builder = SPA_POD_BUILDER_INIT(buffer, sizeof (buffer));
f1b26c
+
f1b26c
+  params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
f1b26c
+              SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
f1b26c
+              SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
f1b26c
+              SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
f1b26c
+              SPA_FORMAT_VIDEO_format, SPA_POD_CHOICE_ENUM_Id(5, SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx, SPA_VIDEO_FORMAT_RGBA,
f1b26c
+                                                                 SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_BGRA),
f1b26c
+              SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle(&pwMinScreenBounds,
f1b26c
+                                                                    &pwMinScreenBounds,
f1b26c
+                                                                    &pwMaxScreenBounds),
f1b26c
+              0));
f1b26c
+  pw_stream_add_listener(stream, &spa_stream_listener_, &pw_stream_events_, this);
f1b26c
+
f1b26c
   pw_stream_flags flags = static_cast<pw_stream_flags>(
f1b26c
-      PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE |
f1b26c
-      PW_STREAM_FLAG_MAP_BUFFERS);
f1b26c
-  if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr,
f1b26c
-                        flags, params,
f1b26c
-                        /*n_params=*/1) != 0) {
f1b26c
+      PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE);
f1b26c
+
f1b26c
+  if (pw_stream_connect(stream, PW_DIRECTION_INPUT, pw_stream_node_id_, PW_STREAM_FLAG_AUTOCONNECT, params, 1) != 0) {
f1b26c
     RTC_LOG(LS_ERROR) << "Could not connect receiving stream.";
f1b26c
     portal_init_failed_ = true;
f1b26c
-    return;
f1b26c
   }
f1b26c
+
f1b26c
+  return stream;
f1b26c
 }
f1b26c
 
f1b26c
 void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) {
f1b26c
+  struct spa_meta_region* video_crop;
f1b26c
   spa_buffer* spaBuffer = buffer->buffer;
f1b26c
-  void* src = nullptr;
f1b26c
+  uint8_t *map = nullptr;
f1b26c
+  uint8_t* src = nullptr;
f1b26c
+  uint8_t* dst = nullptr;
f1b26c
+
f1b26c
+  if (spaBuffer->datas[0].chunk->size == 0) {
f1b26c
+    map = nullptr;
f1b26c
+    src = nullptr;
f1b26c
+  } else if (spaBuffer->datas[0].type == SPA_DATA_MemFd) {
f1b26c
+    map = static_cast<uint8_t*>(mmap(
f1b26c
+        nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
f1b26c
+        PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0));
f1b26c
+
f1b26c
+    if (map == MAP_FAILED) {
f1b26c
+      RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno);
f1b26c
+      return;
f1b26c
+    }
f1b26c
+
f1b26c
+    src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
f1b26c
+  } else if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) {
f1b26c
+    int fd;
f1b26c
+    fd = spaBuffer->datas[0].fd;
f1b26c
 
f1b26c
-  if (!(src = spaBuffer->datas[0].data)) {
f1b26c
+    map = static_cast<uint8_t*>(mmap(
f1b26c
+        nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
f1b26c
+        PROT_READ, MAP_PRIVATE, fd, 0));
f1b26c
+
f1b26c
+    if (map == MAP_FAILED) {
f1b26c
+      RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno);
f1b26c
+      return;
f1b26c
+    }
f1b26c
+
f1b26c
+    SyncDmaBuf(fd, DMA_BUF_SYNC_START);
f1b26c
+
f1b26c
+    src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
f1b26c
+  } else if (spaBuffer->datas[0].type == SPA_DATA_MemPtr) {
f1b26c
+    map = nullptr;
f1b26c
+    src = static_cast<uint8_t*>(spaBuffer->datas[0].data);
f1b26c
+  } else {
f1b26c
     return;
f1b26c
   }
f1b26c
 
f1b26c
-  uint32_t maxSize = spaBuffer->datas[0].maxsize;
f1b26c
-  int32_t srcStride = spaBuffer->datas[0].chunk->stride;
f1b26c
+  if (!src) {
f1b26c
+    return;
f1b26c
+  }
f1b26c
+
f1b26c
+  DesktopSize prev_crop_size = DesktopSize(0, 0);
f1b26c
+  if (video_crop_size_initialized_) {
f1b26c
+    prev_crop_size = video_crop_size_;
f1b26c
+  }  
f1b26c
+
f1b26c
+  if ((video_crop = static_cast<struct spa_meta_region*>(
f1b26c
+           spa_buffer_find_meta_data(spaBuffer, SPA_META_VideoCrop, sizeof(*video_crop))))) {
f1b26c
+    RTC_DCHECK(video_crop->region.size.width <= desktop_size_.width() &&
f1b26c
+               video_crop->region.size.height <= desktop_size_.height());
f1b26c
+    if ((video_crop->region.size.width != desktop_size_.width() ||
f1b26c
+        video_crop->region.size.height != desktop_size_.height()) && video_crop->region.size.width && video_crop->region.size.height) {
f1b26c
+      video_crop_size_ = DesktopSize(video_crop->region.size.width, video_crop->region.size.height);
f1b26c
+      video_crop_size_initialized_ = true;
f1b26c
+    } else {
f1b26c
+      video_crop_size_initialized_ = false;
f1b26c
+    }
f1b26c
+  } else {
f1b26c
+    video_crop_size_initialized_ = false;
f1b26c
+  }
f1b26c
+
f1b26c
+  size_t frame_size;
f1b26c
+  if (video_crop_size_initialized_) {
f1b26c
+    frame_size =
f1b26c
+        video_crop_size_.width() * video_crop_size_.height() * kBytesPerPixel;
f1b26c
+  } else {
f1b26c
+    frame_size =
f1b26c
+        desktop_size_.width() * desktop_size_.height() * kBytesPerPixel;
f1b26c
+  }
f1b26c
+
f1b26c
+  if (!current_frame_ ||
f1b26c
+      (video_crop_size_initialized_ && !video_crop_size_.equals(prev_crop_size))) {
f1b26c
+    current_frame_ = std::make_unique<uint8_t[]>(frame_size);
f1b26c
+  }
f1b26c
+  RTC_DCHECK(current_frame_ != nullptr);
f1b26c
+
f1b26c
+  const int32_t dstStride = video_crop_size_initialized_
f1b26c
+                                ? video_crop_size_.width() * kBytesPerPixel
f1b26c
+                                : desktop_size_.width() * kBytesPerPixel;
f1b26c
+  const int32_t srcStride = spaBuffer->datas[0].chunk->stride;
f1b26c
+
f1b26c
   if (srcStride != (desktop_size_.width() * kBytesPerPixel)) {
f1b26c
     RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: "
f1b26c
                       << srcStride
f1b26c
@@ -361,21 +400,40 @@ void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) {
f1b26c
     return;
f1b26c
   }
f1b26c
 
f1b26c
-  if (!current_frame_) {
f1b26c
-    current_frame_ = static_cast<uint8_t*>(malloc(maxSize));
f1b26c
+  dst = current_frame_.get();
f1b26c
+
f1b26c
+  // Adjust source content based on crop video position
f1b26c
+  if (video_crop_size_initialized_ &&
f1b26c
+      (video_crop->region.position.y + video_crop_size_.height() <= desktop_size_.height())) {
f1b26c
+    for (int i = 0; i < video_crop->region.position.y; ++i) {
f1b26c
+      src += srcStride;
f1b26c
+    }
f1b26c
+  }
f1b26c
+  const int xOffset =
f1b26c
+      video_crop_size_initialized_ && (video_crop->region.position.x + video_crop_size_.width() <=
f1b26c
+                           desktop_size_.width())
f1b26c
+          ? video_crop->region.position.x * kBytesPerPixel
f1b26c
+          : 0;
f1b26c
+  const int height = video_crop_size_initialized_ ? video_crop_size_.height() : desktop_size_.height();
f1b26c
+  for (int i = 0; i < height; ++i) {
f1b26c
+    // Adjust source content based on crop video position if needed
f1b26c
+    src += xOffset;
f1b26c
+    std::memcpy(dst, src, dstStride);
f1b26c
+    // If both sides decided to go with the RGBx format we need to convert it to
f1b26c
+    // BGRx to match color format expected by WebRTC.
f1b26c
+    if (spa_video_format_.format == SPA_VIDEO_FORMAT_RGBx ||
f1b26c
+        spa_video_format_.format == SPA_VIDEO_FORMAT_RGBA) {
f1b26c
+      ConvertRGBxToBGRx(dst, dstStride);
f1b26c
+    }
f1b26c
+    src += srcStride - xOffset;
f1b26c
+    dst += dstStride;
f1b26c
   }
f1b26c
-  RTC_DCHECK(current_frame_ != nullptr);
f1b26c
 
f1b26c
-  // If both sides decided to go with the RGBx format we need to convert it to
f1b26c
-  // BGRx to match color format expected by WebRTC.
f1b26c
-  if (spa_video_format_->format == pw_type_->video_format.RGBx) {
f1b26c
-    uint8_t* tempFrame = static_cast<uint8_t*>(malloc(maxSize));
f1b26c
-    std::memcpy(tempFrame, src, maxSize);
f1b26c
-    ConvertRGBxToBGRx(tempFrame, maxSize);
f1b26c
-    std::memcpy(current_frame_, tempFrame, maxSize);
f1b26c
-    free(tempFrame);
f1b26c
-  } else {
f1b26c
-    std::memcpy(current_frame_, src, maxSize);
f1b26c
+  if (map) {
f1b26c
+    if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) {
f1b26c
+      SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_END);
f1b26c
+    }
f1b26c
+    munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset);
f1b26c
   }
f1b26c
 }
f1b26c
 
f1b26c
@@ -725,10 +783,7 @@ void BaseCapturerPipeWire::OnStartRequestResponseSignal(
f1b26c
       g_variant_get(variant, "(u@a{sv})", &stream_id, &options);
f1b26c
       RTC_DCHECK(options != nullptr);
f1b26c
 
f1b26c
-      g_variant_lookup(options, "size", "(ii)", &width, &height);
f1b26c
-
f1b26c
-      that->desktop_size_.set(width, height);
f1b26c
-
f1b26c
+      that->pw_stream_node_id_ = stream_id;
f1b26c
       g_variant_unref(options);
f1b26c
       g_variant_unref(variant);
f1b26c
     }
f1b26c
@@ -813,10 +868,15 @@ void BaseCapturerPipeWire::CaptureFrame() {
f1b26c
     return;
f1b26c
   }
f1b26c
 
f1b26c
-  std::unique_ptr<DesktopFrame> result(new BasicDesktopFrame(desktop_size_));
f1b26c
+  DesktopSize frame_size = desktop_size_;
f1b26c
+  if (video_crop_size_initialized_) {
f1b26c
+    frame_size = video_crop_size_;
f1b26c
+  }
f1b26c
+  
f1b26c
+  std::unique_ptr<DesktopFrame> result(new BasicDesktopFrame(frame_size));
f1b26c
   result->CopyPixelsFrom(
f1b26c
-      current_frame_, (desktop_size_.width() * kBytesPerPixel),
f1b26c
-      DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height()));
f1b26c
+      current_frame_.get(), (frame_size.width() * kBytesPerPixel),
f1b26c
+      DesktopRect::MakeWH(frame_size.width(), frame_size.height()));
f1b26c
   if (!result) {
f1b26c
     callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
f1b26c
     return;
f1b26c
@@ -837,4 +897,22 @@ bool BaseCapturerPipeWire::SelectSource(SourceId id) {
f1b26c
   return true;
f1b26c
 }
f1b26c
 
f1b26c
+// static
f1b26c
+std::unique_ptr<DesktopCapturer>
f1b26c
+BaseCapturerPipeWire::CreateRawScreenCapturer(
f1b26c
+    const DesktopCaptureOptions& options) {
f1b26c
+  std::unique_ptr<BaseCapturerPipeWire> capturer =
f1b26c
+      std::make_unique<BaseCapturerPipeWire>(BaseCapturerPipeWire::CaptureSourceType::kAny);
f1b26c
+  return std::move(capturer);}
f1b26c
+
f1b26c
+// static
f1b26c
+std::unique_ptr<DesktopCapturer>
f1b26c
+BaseCapturerPipeWire::CreateRawWindowCapturer(
f1b26c
+    const DesktopCaptureOptions& options) {
f1b26c
+
f1b26c
+  std::unique_ptr<BaseCapturerPipeWire> capturer =
f1b26c
+      std::make_unique<BaseCapturerPipeWire>(BaseCapturerPipeWire::CaptureSourceType::kAny);
f1b26c
+  return std::move(capturer);
f1b26c
+}
f1b26c
+
f1b26c
 }  // namespace webrtc
f1b26c
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
f1b26c
index 56b101acbaa6..de54157d1a2a 100644
f1b26c
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
f1b26c
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
f1b26c
@@ -22,17 +22,13 @@
f1b26c
 
f1b26c
 namespace webrtc {
f1b26c
 
f1b26c
-class PipeWireType {
f1b26c
- public:
f1b26c
-  spa_type_media_type media_type;
f1b26c
-  spa_type_media_subtype media_subtype;
f1b26c
-  spa_type_format_video format_video;
f1b26c
-  spa_type_video_format video_format;
f1b26c
-};
f1b26c
-
f1b26c
 class BaseCapturerPipeWire : public DesktopCapturer {
f1b26c
  public:
f1b26c
-  enum CaptureSourceType { Screen = 1, Window };
f1b26c
+  enum CaptureSourceType : uint32_t {
f1b26c
+    kScreen = 0b01,
f1b26c
+    kWindow = 0b10,
f1b26c
+    kAny = 0b11
f1b26c
+  };
f1b26c
 
f1b26c
   explicit BaseCapturerPipeWire(CaptureSourceType source_type);
f1b26c
   ~BaseCapturerPipeWire() override;
f1b26c
@@ -43,28 +39,32 @@ class BaseCapturerPipeWire : public DesktopCapturer {
f1b26c
   bool GetSourceList(SourceList* sources) override;
f1b26c
   bool SelectSource(SourceId id) override;
f1b26c
 
f1b26c
+  static std::unique_ptr<DesktopCapturer> CreateRawScreenCapturer(
f1b26c
+      const DesktopCaptureOptions& options);
f1b26c
+
f1b26c
+  static std::unique_ptr<DesktopCapturer> CreateRawWindowCapturer(
f1b26c
+      const DesktopCaptureOptions& options);
f1b26c
+
f1b26c
  private:
f1b26c
   // PipeWire types -->
f1b26c
+  pw_context* pw_context_ = nullptr;
f1b26c
   pw_core* pw_core_ = nullptr;
f1b26c
-  pw_type* pw_core_type_ = nullptr;
f1b26c
   pw_stream* pw_stream_ = nullptr;
f1b26c
-  pw_remote* pw_remote_ = nullptr;
f1b26c
-  pw_loop* pw_loop_ = nullptr;
f1b26c
   pw_thread_loop* pw_main_loop_ = nullptr;
f1b26c
-  PipeWireType* pw_type_ = nullptr;
f1b26c
 
f1b26c
+  spa_hook spa_core_listener_ = {};
f1b26c
   spa_hook spa_stream_listener_ = {};
f1b26c
-  spa_hook spa_remote_listener_ = {};
f1b26c
 
f1b26c
+  pw_core_events pw_core_events_ = {};
f1b26c
   pw_stream_events pw_stream_events_ = {};
f1b26c
-  pw_remote_events pw_remote_events_ = {};
f1b26c
 
f1b26c
-  spa_video_info_raw* spa_video_format_ = nullptr;
f1b26c
+  struct spa_video_info_raw spa_video_format_;
f1b26c
 
f1b26c
+  guint32 pw_stream_node_id_ = 0;
f1b26c
   gint32 pw_fd_ = -1;
f1b26c
 
f1b26c
   CaptureSourceType capture_source_type_ =
f1b26c
-      BaseCapturerPipeWire::CaptureSourceType::Screen;
f1b26c
+      BaseCapturerPipeWire::CaptureSourceType::kAny;
f1b26c
 
f1b26c
   // <-- end of PipeWire types
f1b26c
 
f1b26c
@@ -78,33 +78,37 @@ class BaseCapturerPipeWire : public DesktopCapturer {
f1b26c
   guint sources_request_signal_id_ = 0;
f1b26c
   guint start_request_signal_id_ = 0;
f1b26c
 
f1b26c
+  bool video_crop_size_initialized_ = false;
f1b26c
+  DesktopSize video_crop_size_;;
f1b26c
   DesktopSize desktop_size_ = {};
f1b26c
   DesktopCaptureOptions options_ = {};
f1b26c
 
f1b26c
-  uint8_t* current_frame_ = nullptr;
f1b26c
+  std::unique_ptr<uint8_t[]> current_frame_;
f1b26c
   Callback* callback_ = nullptr;
f1b26c
 
f1b26c
   bool portal_init_failed_ = false;
f1b26c
 
f1b26c
   void InitPortal();
f1b26c
   void InitPipeWire();
f1b26c
-  void InitPipeWireTypes();
f1b26c
 
f1b26c
-  void CreateReceivingStream();
f1b26c
+  pw_stream* CreateReceivingStream();
f1b26c
   void HandleBuffer(pw_buffer* buffer);
f1b26c
 
f1b26c
   void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size);
f1b26c
 
f1b26c
-  static void OnStateChanged(void* data,
f1b26c
-                             pw_remote_state old_state,
f1b26c
-                             pw_remote_state state,
f1b26c
-                             const char* error);
f1b26c
+  static void SyncDmaBuf(int fd, uint64_t start_or_end);
f1b26c
+  static void OnCoreError(void *data,
f1b26c
+                          uint32_t id,
f1b26c
+                          int seq,
f1b26c
+                          int res,
f1b26c
+                          const char *message);
f1b26c
+  static void OnStreamParamChanged(void *data,
f1b26c
+                                   uint32_t id,
f1b26c
+                                   const struct spa_pod *format);
f1b26c
   static void OnStreamStateChanged(void* data,
f1b26c
                                    pw_stream_state old_state,
f1b26c
                                    pw_stream_state state,
f1b26c
                                    const char* error_message);
f1b26c
-
f1b26c
-  static void OnStreamFormatChanged(void* data, const struct spa_pod* format);
f1b26c
   static void OnStreamProcess(void* data);
f1b26c
   static void OnNewBuffer(void* data, uint32_t id);
f1b26c
 
f1b26c
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
f1b26c
index 26956fc67dc8..3813d697bb38 100644
f1b26c
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
f1b26c
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
f1b26c
@@ -15,7 +15,7 @@
f1b26c
 namespace webrtc {
f1b26c
 
f1b26c
 ScreenCapturerPipeWire::ScreenCapturerPipeWire()
f1b26c
-    : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {}
f1b26c
+    : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kScreen) {}
f1b26c
 ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {}
f1b26c
 
f1b26c
 // static
f1b26c
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
f1b26c
index 35436475cb4d..c43a1f1a0c4e 100644
f1b26c
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
f1b26c
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
f1b26c
@@ -15,7 +15,7 @@
f1b26c
 namespace webrtc {
f1b26c
 
f1b26c
 WindowCapturerPipeWire::WindowCapturerPipeWire()
f1b26c
-    : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {}
f1b26c
+    : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kWindow) {}
f1b26c
 WindowCapturerPipeWire::~WindowCapturerPipeWire() {}
f1b26c
 
f1b26c
 // static
f1b26c
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
f1b26c
index cf8a9dd0e0db..d27fab8d28d9 100644
f1b26c
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
f1b26c
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
f1b26c
@@ -26,7 +26,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
f1b26c
     const DesktopCaptureOptions& options) {
f1b26c
 #if defined(WEBRTC_USE_PIPEWIRE)
f1b26c
   if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
f1b26c
-    return ScreenCapturerPipeWire::CreateRawScreenCapturer(options);
f1b26c
+    return BaseCapturerPipeWire::CreateRawScreenCapturer(options);
f1b26c
   }
f1b26c
 #endif  // defined(WEBRTC_USE_PIPEWIRE)
f1b26c
 
f1b26c
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
f1b26c
index 82359e50c2db..bb9724cf7cc2 100644
f1b26c
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
f1b26c
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
f1b26c
@@ -26,7 +26,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
f1b26c
     const DesktopCaptureOptions& options) {
f1b26c
 #if defined(WEBRTC_USE_PIPEWIRE)
f1b26c
   if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
f1b26c
-    return WindowCapturerPipeWire::CreateRawWindowCapturer(options);
f1b26c
+    return BaseCapturerPipeWire::CreateRawWindowCapturer(options);
f1b26c
   }
f1b26c
 #endif  // defined(WEBRTC_USE_PIPEWIRE)
f1b26c