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