Fixing pipewire patch

This commit is contained in:
Jan Horak 2020-04-06 08:30:41 +02:00
parent 830bb9636f
commit 143fa360a2
2 changed files with 25 additions and 19 deletions

View File

@ -65,7 +65,7 @@ index 1eb8ead26efa..316468eed1fc 100644
}; };
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 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
index 379341c833de..a51f7851b20f 100644 index 379341c833de..d156be1c18a0 100644
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc --- 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 +++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
@@ -18,6 +18,11 @@ @@ -18,6 +18,11 @@
@ -80,12 +80,13 @@ index 379341c833de..a51f7851b20f 100644
#include <memory> #include <memory>
#include <utility> #include <utility>
@@ -36,6 +41,26 @@ const char kSessionInterfaceName[] = "org.freedesktop.portal.Session"; @@ -36,6 +41,27 @@ const char kSessionInterfaceName[] = "org.freedesktop.portal.Session";
const char kRequestInterfaceName[] = "org.freedesktop.portal.Request"; const char kRequestInterfaceName[] = "org.freedesktop.portal.Request";
const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast"; const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast";
+ +
+static void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) { +// static
+void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) {
+ struct dma_buf_sync sync = { 0 }; + struct dma_buf_sync sync = { 0 };
+ +
+ sync.flags = start_or_end | DMA_BUF_SYNC_READ; + sync.flags = start_or_end | DMA_BUF_SYNC_READ;
@ -107,7 +108,7 @@ index 379341c833de..a51f7851b20f 100644
// static // static
void BaseCapturerPipeWire::OnStateChanged(void* data, void BaseCapturerPipeWire::OnStateChanged(void* data,
pw_remote_state old_state, pw_remote_state old_state,
@@ -112,7 +137,7 @@ void BaseCapturerPipeWire::OnStreamFormatChanged(void* data, @@ -112,7 +138,7 @@ void BaseCapturerPipeWire::OnStreamFormatChanged(void* data,
auto builder = spa_pod_builder{buffer, sizeof(buffer)}; auto builder = spa_pod_builder{buffer, sizeof(buffer)};
// Setup buffers and meta header for new format. // Setup buffers and meta header for new format.
@ -116,7 +117,7 @@ index 379341c833de..a51f7851b20f 100644
params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object( params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
&builder, &builder,
// id to enumerate buffer requirements // id to enumerate buffer requirements
@@ -141,8 +166,14 @@ void BaseCapturerPipeWire::OnStreamFormatChanged(void* data, @@ -141,8 +167,14 @@ void BaseCapturerPipeWire::OnStreamFormatChanged(void* data,
// Size: size of the metadata, specified as integer (i) // Size: size of the metadata, specified as integer (i)
":", that->pw_core_type_->param_meta.size, "i", ":", that->pw_core_type_->param_meta.size, "i",
sizeof(struct spa_meta_header))); sizeof(struct spa_meta_header)));
@ -133,7 +134,7 @@ index 379341c833de..a51f7851b20f 100644
} }
// static // static
@@ -150,15 +181,25 @@ void BaseCapturerPipeWire::OnStreamProcess(void* data) { @@ -150,15 +182,25 @@ void BaseCapturerPipeWire::OnStreamProcess(void* data) {
BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data); BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
RTC_DCHECK(that); RTC_DCHECK(that);
@ -163,7 +164,7 @@ index 379341c833de..a51f7851b20f 100644
} }
BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type) BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type)
@@ -197,10 +238,6 @@ BaseCapturerPipeWire::~BaseCapturerPipeWire() { @@ -197,10 +239,6 @@ BaseCapturerPipeWire::~BaseCapturerPipeWire() {
pw_loop_destroy(pw_loop_); pw_loop_destroy(pw_loop_);
} }
@ -174,7 +175,7 @@ index 379341c833de..a51f7851b20f 100644
if (start_request_signal_id_) { if (start_request_signal_id_) {
g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_); g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_);
} }
@@ -332,8 +369,7 @@ void BaseCapturerPipeWire::CreateReceivingStream() { @@ -332,8 +370,7 @@ void BaseCapturerPipeWire::CreateReceivingStream() {
pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_, pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_,
this); this);
pw_stream_flags flags = static_cast<pw_stream_flags>( pw_stream_flags flags = static_cast<pw_stream_flags>(
@ -184,7 +185,7 @@ index 379341c833de..a51f7851b20f 100644
if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr, if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr,
flags, params, flags, params,
/*n_params=*/1) != 0) { /*n_params=*/1) != 0) {
@@ -344,15 +380,75 @@ void BaseCapturerPipeWire::CreateReceivingStream() { @@ -344,15 +381,77 @@ void BaseCapturerPipeWire::CreateReceivingStream() {
} }
void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) { void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) {
@ -199,21 +200,23 @@ index 379341c833de..a51f7851b20f 100644
+ map = nullptr; + map = nullptr;
+ src = nullptr; + src = nullptr;
+ } else if (spaBuffer->datas[0].type == pw_core_type_->data.MemFd) { + } else if (spaBuffer->datas[0].type == pw_core_type_->data.MemFd) {
+ map = mmap(nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, + map = static_cast<uint8_t*>(mmap(
+ PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0); + nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
+ PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0));
+ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); + src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
+ } else if (spaBuffer->datas[0].type == pw_core_type_->data.DmaBuf) { + } else if (spaBuffer->datas[0].type == pw_core_type_->data.DmaBuf) {
+ int fd; + int fd;
+ fd = spaBuffer->datas[0].fd; + fd = spaBuffer->datas[0].fd;
+ +
+ map = mmap (nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, + map = static_cast<uint8_t*>(mmap(
+ PROT_READ, MAP_PRIVATE, fd, 0); + nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
+ PROT_READ, MAP_PRIVATE, fd, 0));
+ SyncDmaBuf(fd, DMA_BUF_SYNC_START); + SyncDmaBuf(fd, DMA_BUF_SYNC_START);
+ +
+ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); + src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
+ } else if (spaBuffer->datas[0].type == pw_core_type_->data.MemPtr) { + } else if (spaBuffer->datas[0].type == pw_core_type_->data.MemPtr) {
+ map = nullptr; + map = nullptr;
+ src = spaBuffer->datas[0].data; + src = static_cast<uint8_t*>(spaBuffer->datas[0].data);
+ } else { + } else {
+ return; + return;
+ } + }
@ -264,7 +267,7 @@ index 379341c833de..a51f7851b20f 100644
if (srcStride != (desktop_size_.width() * kBytesPerPixel)) { if (srcStride != (desktop_size_.width() * kBytesPerPixel)) {
RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: " RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: "
<< srcStride << srcStride
@@ -361,21 +457,39 @@ void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) { @@ -361,21 +460,39 @@ void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) {
return; return;
} }
@ -317,7 +320,7 @@ index 379341c833de..a51f7851b20f 100644
} }
} }
@@ -813,10 +927,12 @@ void BaseCapturerPipeWire::CaptureFrame() { @@ -813,10 +930,12 @@ void BaseCapturerPipeWire::CaptureFrame() {
return; return;
} }
@ -333,7 +336,7 @@ index 379341c833de..a51f7851b20f 100644
if (!result) { if (!result) {
callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
return; return;
@@ -837,4 +953,22 @@ bool BaseCapturerPipeWire::SelectSource(SourceId id) { @@ -837,4 +956,22 @@ bool BaseCapturerPipeWire::SelectSource(SourceId id) {
return true; return true;
} }

View File

@ -118,7 +118,7 @@ ExcludeArch: s390x
Summary: Mozilla Firefox Web browser Summary: Mozilla Firefox Web browser
Name: firefox Name: firefox
Version: 74.0.1 Version: 74.0.1
Release: 1%{?nss_tag}%{?dist} Release: 2%{?nss_tag}%{?dist}
URL: https://www.mozilla.org/firefox/ URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+ License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
@ -969,6 +969,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#--------------------------------------------------------------------- #---------------------------------------------------------------------
%changelog %changelog
* Mon Apr 06 2020 Jan Horak <jhorak@redhat.com> - 74.0.1-2
- Fixing pipewire patch
* Sat Apr 4 2020 Martin Stransky <stransky@redhat.com> - 74.0.1-1 * Sat Apr 4 2020 Martin Stransky <stransky@redhat.com> - 74.0.1-1
- Updated to latest upstream - Updated to latest upstream
- Added fix for mozbz#1624745 - Added fix for mozbz#1624745