зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1903098 - Vendor libwebrtc from a18e38fed2
We cherry-picked this in bug 1896575 Upstream commit: https://webrtc.googlesource.com/src/+/a18e38fed2307edd6382760213fa3ddf199fa181 Video capture PipeWire: drop corrupted PipeWire buffers Use SPA_CHUNK_FLAG_CORRUPTED and SPA_META_HEADER_FLAG_CORRUPTED flags to determine corrupted buffers or corrupted buffer data. We used to only rely on compositors setting chunk->size, but this doesn't make sense for dmabufs where they have to make up arbitrary values. It also looks this is not reliable and can cause glitches as we end up processing corrupted buffers. (cherry picked from commit cfbd6b0884db2eab893831e7bde5cfe640fe52db) Bug: chromium:341928670 Change-Id: Ida0c6a5e7a37e19598c6d5884726200f81b94962 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/349881 Commit-Queue: Mark Foltz <mfoltz@chromium.org> Reviewed-by: Mark Foltz <mfoltz@chromium.org> Reviewed-by: Alexander Cooper <alcooper@chromium.org> Cr-Original-Commit-Position: refs/heads/main@{#42292} Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/351563 Commit-Queue: Alexander Cooper <alcooper@chromium.org> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> Cr-Commit-Position: refs/branch-heads/6478@{#1} Cr-Branched-From: 16fb7903e546051483720548168cd40cded7a040-refs/heads/main@{#42290}
This commit is contained in:
Родитель
4d5d44b4e6
Коммит
182c3c676c
|
@ -30642,3 +30642,6 @@ dcdb140576
|
|||
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
|
||||
# base of lastest vendoring
|
||||
16fb7903e5
|
||||
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
|
||||
# base of lastest vendoring
|
||||
a18e38fed2
|
||||
|
|
|
@ -20452,3 +20452,5 @@ libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc
|
|||
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-06-24T15:21:11.779874.
|
||||
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
|
||||
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-06-24T15:22:05.198567.
|
||||
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
|
||||
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2024-06-24T15:23:05.876052.
|
||||
|
|
|
@ -10,7 +10,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/158a888cad8869a2f
|
|||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
index 6998d655c2..1065adbc60 100644
|
||||
index 4e042ef79e..ae834f7714 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
@@ -27,6 +27,13 @@
|
||||
|
|
|
@ -12,10 +12,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/237d19fe96dd7d25b
|
|||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
index 1065adbc60..473f913466 100644
|
||||
index ae834f7714..dbd0f83e64 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
@@ -391,7 +391,9 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(
|
||||
@@ -404,7 +404,9 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(
|
||||
RTC_LOG(LS_ERROR) << "Unable to open PipeWire library";
|
||||
return false;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ index 1065adbc60..473f913466 100644
|
|||
|
||||
pw_stream_node_id_ = stream_node_id;
|
||||
|
||||
@@ -480,7 +482,8 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(
|
||||
@@ -493,7 +495,8 @@ bool SharedScreenCastStreamPrivate::StartScreenCastStream(
|
||||
for (uint32_t format : {SPA_VIDEO_FORMAT_BGRA, SPA_VIDEO_FORMAT_RGBA,
|
||||
SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx}) {
|
||||
// Modifiers can be used with PipeWire >= 0.3.33
|
||||
|
@ -36,7 +36,7 @@ index 1065adbc60..473f913466 100644
|
|||
modifiers_ = egl_dmabuf_->QueryDmaBufModifiers(format);
|
||||
|
||||
if (!modifiers_.empty()) {
|
||||
@@ -899,7 +902,7 @@ bool SharedScreenCastStreamPrivate::ProcessDMABuffer(
|
||||
@@ -925,7 +928,7 @@ bool SharedScreenCastStreamPrivate::ProcessDMABuffer(
|
||||
|
||||
const uint n_planes = spa_buffer->n_datas;
|
||||
|
||||
|
|
|
@ -1,209 +1,31 @@
|
|||
From: Jan Grulich <jgrulich@redhat.com>
|
||||
Date: Tue, 21 May 2024 06:27:00 +0000
|
||||
Subject: Bug 1896575 - WebRTC backport: Video capture PipeWire: drop corrupted
|
||||
PipeWire buffers r=pehrsons,webrtc-reviewers
|
||||
From: Nico Grunbaum <na-g@nostrum.com>
|
||||
Date: Thu, 23 May 2024 17:28:00 +0000
|
||||
Subject: Bug 1897459 - P0 - for BSD do not build physical_socket_server in
|
||||
libwebrtc;r=mjf,webrtc-reviewers
|
||||
|
||||
This is a simple backport of an WebRTC upstream change.
|
||||
libwebrtc added the use of several non-portable socket options in this code.
|
||||
Firefox does not use any of the code in this file, but there is a header dependency chain leading from code that is used.
|
||||
|
||||
Upstream commit: cfbd6b0884db2eab893831e7bde5cfe640fe52db
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D210268
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4efa281b9b917b3b4790ef9ab8bff24fe2f1fd7b
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D210858
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4e7b3c485e549e7e35b227b517acadbbad957004
|
||||
---
|
||||
.../linux/wayland/shared_screencast_stream.cc | 28 ++++++++++++++-
|
||||
.../linux/wayland/shared_screencast_stream.h | 3 ++
|
||||
.../shared_screencast_stream_unittest.cc | 34 ++++++++++++++++++-
|
||||
.../test/test_screencast_stream_provider.cc | 29 ++++++++++++----
|
||||
.../test/test_screencast_stream_provider.h | 4 ++-
|
||||
5 files changed, 88 insertions(+), 10 deletions(-)
|
||||
rtc_base/BUILD.gn | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
index 473f913466..dbd0f83e64 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
@@ -330,6 +330,19 @@ void SharedScreenCastStreamPrivate::OnStreamProcess(void* data) {
|
||||
return;
|
||||
}
|
||||
|
||||
+ struct spa_meta_header* header =
|
||||
+ static_cast<spa_meta_header*>(spa_buffer_find_meta_data(
|
||||
+ buffer->buffer, SPA_META_Header, sizeof(*header)));
|
||||
+ if (header && (header->flags & SPA_META_HEADER_FLAG_CORRUPTED)) {
|
||||
+ RTC_LOG(LS_INFO) << "Dropping corrupted buffer";
|
||||
+ if (that->observer_) {
|
||||
+ that->observer_->OnBufferCorruptedMetadata();
|
||||
+ }
|
||||
+ // Queue buffer for reuse; it will not be processed further.
|
||||
+ pw_stream_queue_buffer(that->pw_stream_, buffer);
|
||||
+ return;
|
||||
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
|
||||
index af8726c77c..39348672f6 100644
|
||||
--- a/rtc_base/BUILD.gn
|
||||
+++ b/rtc_base/BUILD.gn
|
||||
@@ -1033,6 +1033,12 @@ rtc_library("threading") {
|
||||
"thread.cc",
|
||||
"thread.h",
|
||||
]
|
||||
+ if (is_bsd && build_with_mozilla) {
|
||||
+ sources -= [
|
||||
+ "physical_socket_server.cc",
|
||||
+ "physical_socket_server.h",
|
||||
+ ]
|
||||
+ }
|
||||
+
|
||||
that->ProcessBuffer(buffer);
|
||||
|
||||
pw_stream_queue_buffer(that->pw_stream_, buffer);
|
||||
@@ -719,7 +732,20 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
|
||||
}
|
||||
}
|
||||
|
||||
- if (spa_buffer->datas[0].chunk->size == 0) {
|
||||
+ if (spa_buffer->datas[0].chunk->flags & SPA_CHUNK_FLAG_CORRUPTED) {
|
||||
+ RTC_LOG(LS_INFO) << "Dropping buffer with corrupted or missing data";
|
||||
+ if (observer_) {
|
||||
+ observer_->OnBufferCorruptedData();
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (spa_buffer->datas[0].type == SPA_DATA_MemFd &&
|
||||
+ spa_buffer->datas[0].chunk->size == 0) {
|
||||
+ RTC_LOG(LS_INFO) << "Dropping buffer with empty data";
|
||||
+ if (observer_) {
|
||||
+ observer_->OnEmptyBuffer();
|
||||
+ }
|
||||
return;
|
||||
}
|
||||
|
||||
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.h b/modules/desktop_capture/linux/wayland/shared_screencast_stream.h
|
||||
index f57e22cb69..1b00e27476 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.h
|
||||
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.h
|
||||
@@ -35,6 +35,9 @@ class RTC_EXPORT SharedScreenCastStream
|
||||
virtual void OnCursorShapeChanged() = 0;
|
||||
virtual void OnDesktopFrameChanged() = 0;
|
||||
virtual void OnFailedToProcessBuffer() = 0;
|
||||
+ virtual void OnBufferCorruptedMetadata() = 0;
|
||||
+ virtual void OnBufferCorruptedData() = 0;
|
||||
+ virtual void OnEmptyBuffer() = 0;
|
||||
virtual void OnStreamConfigured() = 0;
|
||||
virtual void OnFrameRateChanged(uint32_t frame_rate) = 0;
|
||||
|
||||
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream_unittest.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream_unittest.cc
|
||||
index 6a72edd025..72ce01eb26 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream_unittest.cc
|
||||
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream_unittest.cc
|
||||
@@ -55,6 +55,9 @@ class PipeWireStreamTest : public ::testing::Test,
|
||||
MOCK_METHOD(void, OnCursorShapeChanged, (), (override));
|
||||
MOCK_METHOD(void, OnDesktopFrameChanged, (), (override));
|
||||
MOCK_METHOD(void, OnFailedToProcessBuffer, (), (override));
|
||||
+ MOCK_METHOD(void, OnBufferCorruptedMetadata, (), (override));
|
||||
+ MOCK_METHOD(void, OnBufferCorruptedData, (), (override));
|
||||
+ MOCK_METHOD(void, OnEmptyBuffer, (), (override));
|
||||
MOCK_METHOD(void, OnStreamConfigured, (), (override));
|
||||
MOCK_METHOD(void, OnFrameRateChanged, (uint32_t), (override));
|
||||
|
||||
@@ -103,8 +106,9 @@ TEST_F(PipeWireStreamTest, TestPipeWire) {
|
||||
waitStartStreamingEvent.Wait(kShortWait);
|
||||
|
||||
rtc::Event frameRetrievedEvent;
|
||||
- EXPECT_CALL(*this, OnFrameRecorded).Times(3);
|
||||
+ EXPECT_CALL(*this, OnFrameRecorded).Times(6);
|
||||
EXPECT_CALL(*this, OnDesktopFrameChanged)
|
||||
+ .Times(3)
|
||||
.WillRepeatedly([&frameRetrievedEvent] { frameRetrievedEvent.Set(); });
|
||||
|
||||
// Record a frame in FakePipeWireStream
|
||||
@@ -156,6 +160,34 @@ TEST_F(PipeWireStreamTest, TestPipeWire) {
|
||||
frameRetrievedEvent.Wait(kShortWait);
|
||||
EXPECT_EQ(RgbaColor(frame->data()), blue_color);
|
||||
|
||||
+ // Check we don't process faulty buffers
|
||||
+ rtc::Event corruptedMetadataFrameEvent;
|
||||
+ EXPECT_CALL(*this, OnBufferCorruptedMetadata)
|
||||
+ .WillOnce([&corruptedMetadataFrameEvent] {
|
||||
+ corruptedMetadataFrameEvent.Set();
|
||||
+ });
|
||||
+
|
||||
+ test_screencast_stream_provider_->RecordFrame(
|
||||
+ blue_color, TestScreenCastStreamProvider::CorruptedMetadata);
|
||||
+ corruptedMetadataFrameEvent.Wait(kShortWait);
|
||||
+
|
||||
+ rtc::Event corruptedDataFrameEvent;
|
||||
+ EXPECT_CALL(*this, OnBufferCorruptedData)
|
||||
+ .WillOnce([&corruptedDataFrameEvent] { corruptedDataFrameEvent.Set(); });
|
||||
+
|
||||
+ test_screencast_stream_provider_->RecordFrame(
|
||||
+ blue_color, TestScreenCastStreamProvider::CorruptedData);
|
||||
+ corruptedDataFrameEvent.Wait(kShortWait);
|
||||
+
|
||||
+ rtc::Event emptyFrameEvent;
|
||||
+ EXPECT_CALL(*this, OnEmptyBuffer).WillOnce([&emptyFrameEvent] {
|
||||
+ emptyFrameEvent.Set();
|
||||
+ });
|
||||
+
|
||||
+ test_screencast_stream_provider_->RecordFrame(
|
||||
+ blue_color, TestScreenCastStreamProvider::EmptyData);
|
||||
+ emptyFrameEvent.Wait(kShortWait);
|
||||
+
|
||||
// Update stream parameters.
|
||||
EXPECT_CALL(*this, OnFrameRateChanged(0))
|
||||
.Times(1)
|
||||
diff --git a/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.cc b/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.cc
|
||||
index ee5c17e7d7..10551047a9 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.cc
|
||||
+++ b/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.cc
|
||||
@@ -131,7 +131,8 @@ TestScreenCastStreamProvider::~TestScreenCastStreamProvider() {
|
||||
}
|
||||
}
|
||||
|
||||
-void TestScreenCastStreamProvider::RecordFrame(RgbaColor rgba_color) {
|
||||
+void TestScreenCastStreamProvider::RecordFrame(RgbaColor rgba_color,
|
||||
+ FrameDefect frame_defect) {
|
||||
const char* error;
|
||||
if (pw_stream_get_state(pw_stream_, &error) != PW_STREAM_STATE_STREAMING) {
|
||||
if (error) {
|
||||
@@ -163,13 +164,27 @@ void TestScreenCastStreamProvider::RecordFrame(RgbaColor rgba_color) {
|
||||
spa_data->chunk->size = height_ * stride;
|
||||
spa_data->chunk->stride = stride;
|
||||
|
||||
- uint32_t color = rgba_color.ToUInt32();
|
||||
- for (uint32_t i = 0; i < height_; i++) {
|
||||
- uint32_t* column = reinterpret_cast<uint32_t*>(data);
|
||||
- for (uint32_t j = 0; j < width_; j++) {
|
||||
- column[j] = color;
|
||||
+ // Produce a frame with given defect
|
||||
+ if (frame_defect == EmptyData) {
|
||||
+ spa_data->chunk->size = 0;
|
||||
+ } else if (frame_defect == CorruptedData) {
|
||||
+ spa_data->chunk->flags = SPA_CHUNK_FLAG_CORRUPTED;
|
||||
+ } else if (frame_defect == CorruptedMetadata) {
|
||||
+ struct spa_meta_header* spa_header =
|
||||
+ static_cast<spa_meta_header*>(spa_buffer_find_meta_data(
|
||||
+ spa_buffer, SPA_META_Header, sizeof(spa_meta_header)));
|
||||
+ if (spa_header) {
|
||||
+ spa_header->flags = SPA_META_HEADER_FLAG_CORRUPTED;
|
||||
+ }
|
||||
+ } else {
|
||||
+ uint32_t color = rgba_color.ToUInt32();
|
||||
+ for (uint32_t i = 0; i < height_; i++) {
|
||||
+ uint32_t* column = reinterpret_cast<uint32_t*>(data);
|
||||
+ for (uint32_t j = 0; j < width_; j++) {
|
||||
+ column[j] = color;
|
||||
+ }
|
||||
+ data += stride;
|
||||
}
|
||||
- data += stride;
|
||||
}
|
||||
|
||||
pw_stream_queue_buffer(pw_stream_, buffer);
|
||||
diff --git a/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.h b/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.h
|
||||
index d893aa63ab..f63a2e647c 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.h
|
||||
+++ b/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.h
|
||||
@@ -35,6 +35,8 @@ class TestScreenCastStreamProvider {
|
||||
virtual ~Observer() = default;
|
||||
};
|
||||
|
||||
+ enum FrameDefect { None, EmptyData, CorruptedData, CorruptedMetadata };
|
||||
+
|
||||
explicit TestScreenCastStreamProvider(Observer* observer,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
@@ -42,7 +44,7 @@ class TestScreenCastStreamProvider {
|
||||
|
||||
uint32_t PipeWireNodeId();
|
||||
|
||||
- void RecordFrame(RgbaColor rgba_color);
|
||||
+ void RecordFrame(RgbaColor rgba_color, FrameDefect frame_defect = None);
|
||||
void StartStreaming();
|
||||
void StopStreaming();
|
||||
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/algorithm:container",
|
||||
"//third_party/abseil-cpp/absl/base:core_headers",
|
||||
|
|
|
@ -1,31 +1,48 @@
|
|||
From: Nico Grunbaum <na-g@nostrum.com>
|
||||
Date: Thu, 23 May 2024 17:28:00 +0000
|
||||
Subject: Bug 1897459 - P0 - for BSD do not build physical_socket_server in
|
||||
libwebrtc;r=mjf,webrtc-reviewers
|
||||
Subject: Bug 1897459 - P2 - for BSD reference null socket server
|
||||
instead;r=mjf,webrtc-reviewers
|
||||
|
||||
libwebrtc added the use of several non-portable socket options in this code.
|
||||
Firefox does not use any of the code in this file, but there is a header dependency chain leading from code that is used.
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D210858
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4e7b3c485e549e7e35b227b517acadbbad957004
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D211095
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0993ae41fb7db1624dedc5cf2278cd5a505f18f5
|
||||
---
|
||||
rtc_base/BUILD.gn | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
rtc_base/internal/default_socket_server.cc | 4 ++--
|
||||
rtc_base/virtual_socket_server.cc | 2 ++
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
|
||||
index af8726c77c..39348672f6 100644
|
||||
--- a/rtc_base/BUILD.gn
|
||||
+++ b/rtc_base/BUILD.gn
|
||||
@@ -1033,6 +1033,12 @@ rtc_library("threading") {
|
||||
"thread.cc",
|
||||
"thread.h",
|
||||
]
|
||||
+ if (is_bsd && build_with_mozilla) {
|
||||
+ sources -= [
|
||||
+ "physical_socket_server.cc",
|
||||
+ "physical_socket_server.h",
|
||||
+ ]
|
||||
+ }
|
||||
absl_deps = [
|
||||
"//third_party/abseil-cpp/absl/algorithm:container",
|
||||
"//third_party/abseil-cpp/absl/base:core_headers",
|
||||
diff --git a/rtc_base/internal/default_socket_server.cc b/rtc_base/internal/default_socket_server.cc
|
||||
index 5632b989fc..cb7b81978a 100644
|
||||
--- a/rtc_base/internal/default_socket_server.cc
|
||||
+++ b/rtc_base/internal/default_socket_server.cc
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "rtc_base/socket_server.h"
|
||||
|
||||
-#if defined(__native_client__)
|
||||
+#if defined(__native_client__) || defined(WEBRTC_BSD)
|
||||
#include "rtc_base/null_socket_server.h"
|
||||
#else
|
||||
#include "rtc_base/physical_socket_server.h"
|
||||
@@ -23,7 +23,7 @@
|
||||
namespace rtc {
|
||||
|
||||
std::unique_ptr<SocketServer> CreateDefaultSocketServer() {
|
||||
-#if defined(__native_client__)
|
||||
+#if defined(__native_client__) || defined(WEBRTC_BSD)
|
||||
return std::unique_ptr<SocketServer>(new rtc::NullSocketServer);
|
||||
#else
|
||||
return std::unique_ptr<SocketServer>(new rtc::PhysicalSocketServer);
|
||||
diff --git a/rtc_base/virtual_socket_server.cc b/rtc_base/virtual_socket_server.cc
|
||||
index bec7d9733f..b5488f5ff5 100644
|
||||
--- a/rtc_base/virtual_socket_server.cc
|
||||
+++ b/rtc_base/virtual_socket_server.cc
|
||||
@@ -24,7 +24,9 @@
|
||||
#include "rtc_base/event.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/logging.h"
|
||||
+#if !defined(WEBRTC_BSD)
|
||||
#include "rtc_base/physical_socket_server.h"
|
||||
+#endif
|
||||
#include "rtc_base/socket_address_pair.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
|
|
|
@ -1,48 +1,72 @@
|
|||
From: Nico Grunbaum <na-g@nostrum.com>
|
||||
Date: Thu, 23 May 2024 17:28:00 +0000
|
||||
Subject: Bug 1897459 - P2 - for BSD reference null socket server
|
||||
instead;r=mjf,webrtc-reviewers
|
||||
From: Jan Grulich <jgrulich@redhat.com>
|
||||
Date: Wed, 5 Jun 2024 08:18:00 +0000
|
||||
Subject: Bug 1900057 - WebRTC backport: Video capture PipeWire: always capture
|
||||
latest processed buffer r=pehrsons,webrtc-reviewers
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D211095
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0993ae41fb7db1624dedc5cf2278cd5a505f18f5
|
||||
This is a simple backport of an WebRTC upstream change.
|
||||
|
||||
Upstream commit: 848980198ebdc7fd9257ff64faace33eada44798
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D212281
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c49870c644509b14e9de0e0ab9bb0bbc8e01e93b
|
||||
---
|
||||
rtc_base/internal/default_socket_server.cc | 4 ++--
|
||||
rtc_base/virtual_socket_server.cc | 2 ++
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
.../linux/wayland/shared_screencast_stream.cc | 18 +++++++++++++++---
|
||||
1 file changed, 15 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/rtc_base/internal/default_socket_server.cc b/rtc_base/internal/default_socket_server.cc
|
||||
index 5632b989fc..cb7b81978a 100644
|
||||
--- a/rtc_base/internal/default_socket_server.cc
|
||||
+++ b/rtc_base/internal/default_socket_server.cc
|
||||
@@ -14,7 +14,7 @@
|
||||
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
index dbd0f83e64..e321956ef7 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
@@ -90,6 +90,9 @@ class SharedScreenCastStreamPrivate {
|
||||
webrtc::Mutex queue_lock_;
|
||||
ScreenCaptureFrameQueue<SharedDesktopFrame> queue_
|
||||
RTC_GUARDED_BY(&queue_lock_);
|
||||
+ webrtc::Mutex latest_frame_lock_;
|
||||
+ SharedDesktopFrame* latest_available_frame_
|
||||
+ RTC_GUARDED_BY(&latest_frame_lock_) = nullptr;
|
||||
std::unique_ptr<MouseCursor> mouse_cursor_;
|
||||
DesktopVector mouse_cursor_position_ = DesktopVector(-1, -1);
|
||||
|
||||
#include "rtc_base/socket_server.h"
|
||||
@@ -613,13 +616,13 @@ void SharedScreenCastStreamPrivate::StopAndCleanupStream() {
|
||||
|
||||
-#if defined(__native_client__)
|
||||
+#if defined(__native_client__) || defined(WEBRTC_BSD)
|
||||
#include "rtc_base/null_socket_server.h"
|
||||
#else
|
||||
#include "rtc_base/physical_socket_server.h"
|
||||
@@ -23,7 +23,7 @@
|
||||
namespace rtc {
|
||||
std::unique_ptr<SharedDesktopFrame>
|
||||
SharedScreenCastStreamPrivate::CaptureFrame() {
|
||||
- webrtc::MutexLock lock(&queue_lock_);
|
||||
+ webrtc::MutexLock latest_frame_lock(&latest_frame_lock_);
|
||||
|
||||
std::unique_ptr<SocketServer> CreateDefaultSocketServer() {
|
||||
-#if defined(__native_client__)
|
||||
+#if defined(__native_client__) || defined(WEBRTC_BSD)
|
||||
return std::unique_ptr<SocketServer>(new rtc::NullSocketServer);
|
||||
#else
|
||||
return std::unique_ptr<SocketServer>(new rtc::PhysicalSocketServer);
|
||||
diff --git a/rtc_base/virtual_socket_server.cc b/rtc_base/virtual_socket_server.cc
|
||||
index bec7d9733f..b5488f5ff5 100644
|
||||
--- a/rtc_base/virtual_socket_server.cc
|
||||
+++ b/rtc_base/virtual_socket_server.cc
|
||||
@@ -24,7 +24,9 @@
|
||||
#include "rtc_base/event.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/logging.h"
|
||||
+#if !defined(WEBRTC_BSD)
|
||||
#include "rtc_base/physical_socket_server.h"
|
||||
+#endif
|
||||
#include "rtc_base/socket_address_pair.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
- if (!pw_stream_ || !queue_.current_frame()) {
|
||||
+ if (!pw_stream_ || !latest_available_frame_) {
|
||||
return std::unique_ptr<SharedDesktopFrame>{};
|
||||
}
|
||||
|
||||
- std::unique_ptr<SharedDesktopFrame> frame = queue_.current_frame()->Share();
|
||||
+ std::unique_ptr<SharedDesktopFrame> frame = latest_available_frame_->Share();
|
||||
if (use_damage_region_) {
|
||||
frame->mutable_updated_region()->Swap(&damage_region_);
|
||||
damage_region_.Clear();
|
||||
@@ -852,6 +855,8 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
|
||||
if (observer_) {
|
||||
observer_->OnFailedToProcessBuffer();
|
||||
}
|
||||
+ webrtc::MutexLock latest_frame_lock(&latest_frame_lock_);
|
||||
+ latest_available_frame_ = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -870,9 +875,16 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
|
||||
observer_->OnDesktopFrameChanged();
|
||||
}
|
||||
|
||||
+ // We have to hold the lock over the latest_frame here already, since
|
||||
+ // we are going to update damage region, which corresponds to the latest
|
||||
+ // frame and is accessed in CaptureFrame()
|
||||
+ webrtc::MutexLock latest_frame_lock(&latest_frame_lock_);
|
||||
+
|
||||
UpdateFrameUpdatedRegions(spa_buffer, *queue_.current_frame());
|
||||
queue_.current_frame()->set_may_contain_cursor(is_cursor_embedded_);
|
||||
|
||||
+ latest_available_frame_ = queue_.current_frame();
|
||||
+
|
||||
if (callback_) {
|
||||
std::unique_ptr<SharedDesktopFrame> frame = queue_.current_frame()->Share();
|
||||
frame->set_capturer_id(DesktopCapturerId::kWaylandCapturerLinux);
|
||||
|
|
|
@ -1,72 +1,120 @@
|
|||
From: Jan Grulich <jgrulich@redhat.com>
|
||||
Date: Wed, 5 Jun 2024 08:18:00 +0000
|
||||
Subject: Bug 1900057 - WebRTC backport: Video capture PipeWire: always capture
|
||||
latest processed buffer r=pehrsons,webrtc-reviewers
|
||||
Subject: Bug 1900057 - WebRTC backport: PipeWire capturer: fix some possible
|
||||
threading issues r=pehrsons,webrtc-reviewers
|
||||
|
||||
This is a simple backport of an WebRTC upstream change.
|
||||
|
||||
Upstream commit: 848980198ebdc7fd9257ff64faace33eada44798
|
||||
Upstream commit: 06e88bbb5aabdbc2614e51739d79a756c9e4d34b
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D212281
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c49870c644509b14e9de0e0ab9bb0bbc8e01e93b
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D212651
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/57411c0016ff9a390391b8b1d88f04f64d76b6bd
|
||||
---
|
||||
.../linux/wayland/shared_screencast_stream.cc | 18 +++++++++++++++---
|
||||
1 file changed, 15 insertions(+), 3 deletions(-)
|
||||
.../linux/wayland/shared_screencast_stream.cc | 53 +++++++++----------
|
||||
1 file changed, 24 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
index dbd0f83e64..e321956ef7 100644
|
||||
index e321956ef7..ab9054f1a1 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
@@ -90,6 +90,9 @@ class SharedScreenCastStreamPrivate {
|
||||
@@ -80,7 +80,7 @@ class SharedScreenCastStreamPrivate {
|
||||
|
||||
// Track damage region updates that were reported since the last time
|
||||
// frame was captured
|
||||
- DesktopRegion damage_region_;
|
||||
+ DesktopRegion damage_region_ RTC_GUARDED_BY(&latest_frame_lock_);
|
||||
|
||||
uint32_t pw_stream_node_id_ = 0;
|
||||
|
||||
@@ -90,7 +90,7 @@ class SharedScreenCastStreamPrivate {
|
||||
webrtc::Mutex queue_lock_;
|
||||
ScreenCaptureFrameQueue<SharedDesktopFrame> queue_
|
||||
RTC_GUARDED_BY(&queue_lock_);
|
||||
+ webrtc::Mutex latest_frame_lock_;
|
||||
+ SharedDesktopFrame* latest_available_frame_
|
||||
+ RTC_GUARDED_BY(&latest_frame_lock_) = nullptr;
|
||||
- webrtc::Mutex latest_frame_lock_;
|
||||
+ webrtc::Mutex latest_frame_lock_ RTC_ACQUIRED_AFTER(queue_lock_);
|
||||
SharedDesktopFrame* latest_available_frame_
|
||||
RTC_GUARDED_BY(&latest_frame_lock_) = nullptr;
|
||||
std::unique_ptr<MouseCursor> mouse_cursor_;
|
||||
DesktopVector mouse_cursor_position_ = DesktopVector(-1, -1);
|
||||
@@ -147,7 +147,6 @@ class SharedScreenCastStreamPrivate {
|
||||
void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size);
|
||||
void UpdateFrameUpdatedRegions(const spa_buffer* spa_buffer,
|
||||
DesktopFrame& frame);
|
||||
- void NotifyCallbackOfNewFrame(std::unique_ptr<SharedDesktopFrame> frame);
|
||||
|
||||
@@ -613,13 +616,13 @@ void SharedScreenCastStreamPrivate::StopAndCleanupStream() {
|
||||
|
||||
std::unique_ptr<SharedDesktopFrame>
|
||||
SharedScreenCastStreamPrivate::CaptureFrame() {
|
||||
- webrtc::MutexLock lock(&queue_lock_);
|
||||
+ webrtc::MutexLock latest_frame_lock(&latest_frame_lock_);
|
||||
|
||||
- if (!pw_stream_ || !queue_.current_frame()) {
|
||||
+ if (!pw_stream_ || !latest_available_frame_) {
|
||||
return std::unique_ptr<SharedDesktopFrame>{};
|
||||
// PipeWire callbacks
|
||||
static void OnCoreError(void* data,
|
||||
@@ -646,6 +645,8 @@ DesktopVector SharedScreenCastStreamPrivate::CaptureCursorPosition() {
|
||||
void SharedScreenCastStreamPrivate::UpdateFrameUpdatedRegions(
|
||||
const spa_buffer* spa_buffer,
|
||||
DesktopFrame& frame) {
|
||||
+ latest_frame_lock_.AssertHeld();
|
||||
+
|
||||
if (!use_damage_region_) {
|
||||
frame.mutable_updated_region()->SetRect(
|
||||
DesktopRect::MakeSize(frame.size()));
|
||||
@@ -674,22 +675,6 @@ void SharedScreenCastStreamPrivate::UpdateFrameUpdatedRegions(
|
||||
}
|
||||
}
|
||||
|
||||
- std::unique_ptr<SharedDesktopFrame> frame = queue_.current_frame()->Share();
|
||||
+ std::unique_ptr<SharedDesktopFrame> frame = latest_available_frame_->Share();
|
||||
if (use_damage_region_) {
|
||||
frame->mutable_updated_region()->Swap(&damage_region_);
|
||||
damage_region_.Clear();
|
||||
@@ -852,6 +855,8 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
|
||||
if (observer_) {
|
||||
observer_->OnFailedToProcessBuffer();
|
||||
}
|
||||
+ webrtc::MutexLock latest_frame_lock(&latest_frame_lock_);
|
||||
+ latest_available_frame_ = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -870,9 +875,16 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
|
||||
-void SharedScreenCastStreamPrivate::NotifyCallbackOfNewFrame(
|
||||
- std::unique_ptr<SharedDesktopFrame> frame) {
|
||||
- if (!pw_stream_ || !frame->data()) {
|
||||
- callback_->OnCaptureResult(DesktopCapturer::Result::ERROR_TEMPORARY,
|
||||
- nullptr);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (use_damage_region_) {
|
||||
- frame->mutable_updated_region()->Swap(&damage_region_);
|
||||
- damage_region_.Clear();
|
||||
- }
|
||||
- callback_->OnCaptureResult(DesktopCapturer::Result::SUCCESS,
|
||||
- std::move(frame));
|
||||
-}
|
||||
-
|
||||
RTC_NO_SANITIZE("cfi-icall")
|
||||
void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
|
||||
int64_t capture_start_time_nanos = rtc::TimeNanos();
|
||||
@@ -875,22 +860,32 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
|
||||
observer_->OnDesktopFrameChanged();
|
||||
}
|
||||
|
||||
+ // We have to hold the lock over the latest_frame here already, since
|
||||
+ // we are going to update damage region, which corresponds to the latest
|
||||
+ // frame and is accessed in CaptureFrame()
|
||||
+ webrtc::MutexLock latest_frame_lock(&latest_frame_lock_);
|
||||
+
|
||||
UpdateFrameUpdatedRegions(spa_buffer, *queue_.current_frame());
|
||||
queue_.current_frame()->set_may_contain_cursor(is_cursor_embedded_);
|
||||
- // We have to hold the lock over the latest_frame here already, since
|
||||
- // we are going to update damage region, which corresponds to the latest
|
||||
- // frame and is accessed in CaptureFrame()
|
||||
- webrtc::MutexLock latest_frame_lock(&latest_frame_lock_);
|
||||
+ std::unique_ptr<SharedDesktopFrame> frame;
|
||||
+ {
|
||||
+ webrtc::MutexLock latest_frame_lock(&latest_frame_lock_);
|
||||
|
||||
+ latest_available_frame_ = queue_.current_frame();
|
||||
- UpdateFrameUpdatedRegions(spa_buffer, *queue_.current_frame());
|
||||
- queue_.current_frame()->set_may_contain_cursor(is_cursor_embedded_);
|
||||
+ UpdateFrameUpdatedRegions(spa_buffer, *queue_.current_frame());
|
||||
+ queue_.current_frame()->set_may_contain_cursor(is_cursor_embedded_);
|
||||
|
||||
- latest_available_frame_ = queue_.current_frame();
|
||||
+ latest_available_frame_ = queue_.current_frame();
|
||||
|
||||
- if (callback_) {
|
||||
- std::unique_ptr<SharedDesktopFrame> frame = queue_.current_frame()->Share();
|
||||
+ if (!callback_) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (callback_) {
|
||||
std::unique_ptr<SharedDesktopFrame> frame = queue_.current_frame()->Share();
|
||||
+ frame = latest_available_frame_->Share();
|
||||
frame->set_capturer_id(DesktopCapturerId::kWaylandCapturerLinux);
|
||||
frame->set_capture_time_ms((rtc::TimeNanos() - capture_start_time_nanos) /
|
||||
rtc::kNumNanosecsPerMillisec);
|
||||
- NotifyCallbackOfNewFrame(std::move(frame));
|
||||
+ if (use_damage_region_) {
|
||||
+ frame->mutable_updated_region()->Swap(&damage_region_);
|
||||
+ damage_region_.Clear();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (callback_) {
|
||||
+ callback_->OnCaptureResult(DesktopCapturer::Result::SUCCESS,
|
||||
+ std::move(frame));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,120 +1,50 @@
|
|||
From: Jan Grulich <jgrulich@redhat.com>
|
||||
Date: Wed, 5 Jun 2024 08:18:00 +0000
|
||||
Subject: Bug 1900057 - WebRTC backport: PipeWire capturer: fix some possible
|
||||
threading issues r=pehrsons,webrtc-reviewers
|
||||
Date: Sat, 15 Jun 2024 11:27:00 +0000
|
||||
Subject: Bug 1902615 - WebRTC backport: PipeWire camera - check for node
|
||||
existence before adding it to the list r=pehrsons,webrtc-reviewers
|
||||
|
||||
This is a simple backport of an WebRTC upstream change.
|
||||
|
||||
Upstream commit: 06e88bbb5aabdbc2614e51739d79a756c9e4d34b
|
||||
Upstream commit: 633a41ff8edec405cefa109ac3c8f9662a020cc1
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D212651
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/57411c0016ff9a390391b8b1d88f04f64d76b6bd
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D213749
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/dc5e463eb0f570b9b89aef8cddd47f6659bdd16e
|
||||
---
|
||||
.../linux/wayland/shared_screencast_stream.cc | 53 +++++++++----------
|
||||
1 file changed, 24 insertions(+), 29 deletions(-)
|
||||
modules/video_capture/linux/pipewire_session.cc | 17 +++++++++++------
|
||||
1 file changed, 11 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
index e321956ef7..ab9054f1a1 100644
|
||||
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
|
||||
@@ -80,7 +80,7 @@ class SharedScreenCastStreamPrivate {
|
||||
diff --git a/modules/video_capture/linux/pipewire_session.cc b/modules/video_capture/linux/pipewire_session.cc
|
||||
index 4d1b200aca..90ac4a3bdd 100644
|
||||
--- a/modules/video_capture/linux/pipewire_session.cc
|
||||
+++ b/modules/video_capture/linux/pipewire_session.cc
|
||||
@@ -354,6 +354,13 @@ void PipeWireSession::OnRegistryGlobal(void* data,
|
||||
const spa_dict* props) {
|
||||
PipeWireSession* that = static_cast<PipeWireSession*>(data);
|
||||
|
||||
// Track damage region updates that were reported since the last time
|
||||
// frame was captured
|
||||
- DesktopRegion damage_region_;
|
||||
+ DesktopRegion damage_region_ RTC_GUARDED_BY(&latest_frame_lock_);
|
||||
|
||||
uint32_t pw_stream_node_id_ = 0;
|
||||
|
||||
@@ -90,7 +90,7 @@ class SharedScreenCastStreamPrivate {
|
||||
webrtc::Mutex queue_lock_;
|
||||
ScreenCaptureFrameQueue<SharedDesktopFrame> queue_
|
||||
RTC_GUARDED_BY(&queue_lock_);
|
||||
- webrtc::Mutex latest_frame_lock_;
|
||||
+ webrtc::Mutex latest_frame_lock_ RTC_ACQUIRED_AFTER(queue_lock_);
|
||||
SharedDesktopFrame* latest_available_frame_
|
||||
RTC_GUARDED_BY(&latest_frame_lock_) = nullptr;
|
||||
std::unique_ptr<MouseCursor> mouse_cursor_;
|
||||
@@ -147,7 +147,6 @@ class SharedScreenCastStreamPrivate {
|
||||
void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size);
|
||||
void UpdateFrameUpdatedRegions(const spa_buffer* spa_buffer,
|
||||
DesktopFrame& frame);
|
||||
- void NotifyCallbackOfNewFrame(std::unique_ptr<SharedDesktopFrame> frame);
|
||||
|
||||
// PipeWire callbacks
|
||||
static void OnCoreError(void* data,
|
||||
@@ -646,6 +645,8 @@ DesktopVector SharedScreenCastStreamPrivate::CaptureCursorPosition() {
|
||||
void SharedScreenCastStreamPrivate::UpdateFrameUpdatedRegions(
|
||||
const spa_buffer* spa_buffer,
|
||||
DesktopFrame& frame) {
|
||||
+ latest_frame_lock_.AssertHeld();
|
||||
+ // Skip already added nodes to avoid duplicate camera entries
|
||||
+ if (std::find_if(that->nodes_.begin(), that->nodes_.end(),
|
||||
+ [id](const PipeWireNode& node) {
|
||||
+ return node.id() == id;
|
||||
+ }) != that->nodes_.end())
|
||||
+ return;
|
||||
+
|
||||
if (!use_damage_region_) {
|
||||
frame.mutable_updated_region()->SetRect(
|
||||
DesktopRect::MakeSize(frame.size()));
|
||||
@@ -674,22 +675,6 @@ void SharedScreenCastStreamPrivate::UpdateFrameUpdatedRegions(
|
||||
}
|
||||
}
|
||||
|
||||
-void SharedScreenCastStreamPrivate::NotifyCallbackOfNewFrame(
|
||||
- std::unique_ptr<SharedDesktopFrame> frame) {
|
||||
- if (!pw_stream_ || !frame->data()) {
|
||||
- callback_->OnCaptureResult(DesktopCapturer::Result::ERROR_TEMPORARY,
|
||||
- nullptr);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (use_damage_region_) {
|
||||
- frame->mutable_updated_region()->Swap(&damage_region_);
|
||||
- damage_region_.Clear();
|
||||
- }
|
||||
- callback_->OnCaptureResult(DesktopCapturer::Result::SUCCESS,
|
||||
- std::move(frame));
|
||||
-}
|
||||
-
|
||||
RTC_NO_SANITIZE("cfi-icall")
|
||||
void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
|
||||
int64_t capture_start_time_nanos = rtc::TimeNanos();
|
||||
@@ -875,22 +860,32 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
|
||||
observer_->OnDesktopFrameChanged();
|
||||
}
|
||||
|
||||
- // We have to hold the lock over the latest_frame here already, since
|
||||
- // we are going to update damage region, which corresponds to the latest
|
||||
- // frame and is accessed in CaptureFrame()
|
||||
- webrtc::MutexLock latest_frame_lock(&latest_frame_lock_);
|
||||
+ std::unique_ptr<SharedDesktopFrame> frame;
|
||||
+ {
|
||||
+ webrtc::MutexLock latest_frame_lock(&latest_frame_lock_);
|
||||
|
||||
- UpdateFrameUpdatedRegions(spa_buffer, *queue_.current_frame());
|
||||
- queue_.current_frame()->set_may_contain_cursor(is_cursor_embedded_);
|
||||
+ UpdateFrameUpdatedRegions(spa_buffer, *queue_.current_frame());
|
||||
+ queue_.current_frame()->set_may_contain_cursor(is_cursor_embedded_);
|
||||
|
||||
- latest_available_frame_ = queue_.current_frame();
|
||||
+ latest_available_frame_ = queue_.current_frame();
|
||||
|
||||
- if (callback_) {
|
||||
- std::unique_ptr<SharedDesktopFrame> frame = queue_.current_frame()->Share();
|
||||
+ if (!callback_) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ frame = latest_available_frame_->Share();
|
||||
frame->set_capturer_id(DesktopCapturerId::kWaylandCapturerLinux);
|
||||
frame->set_capture_time_ms((rtc::TimeNanos() - capture_start_time_nanos) /
|
||||
rtc::kNumNanosecsPerMillisec);
|
||||
- NotifyCallbackOfNewFrame(std::move(frame));
|
||||
+ if (use_damage_region_) {
|
||||
+ frame->mutable_updated_region()->Swap(&damage_region_);
|
||||
+ damage_region_.Clear();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (callback_) {
|
||||
+ callback_->OnCaptureResult(DesktopCapturer::Result::SUCCESS,
|
||||
+ std::move(frame));
|
||||
}
|
||||
if (type != absl::string_view(PW_TYPE_INTERFACE_Node))
|
||||
return;
|
||||
|
||||
@@ -372,12 +379,10 @@ void PipeWireSession::OnRegistryGlobal(void* data,
|
||||
void PipeWireSession::OnRegistryGlobalRemove(void* data, uint32_t id) {
|
||||
PipeWireSession* that = static_cast<PipeWireSession*>(data);
|
||||
|
||||
- for (auto it = that->nodes_.begin(); it != that->nodes().end(); ++it) {
|
||||
- if ((*it).id() == id) {
|
||||
- that->nodes_.erase(it);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
+ auto it = std::remove_if(
|
||||
+ that->nodes_.begin(), that->nodes_.end(),
|
||||
+ [id](const PipeWireNode& node) { return node.id() == id; });
|
||||
+ that->nodes_.erase(it, that->nodes_.end());
|
||||
}
|
||||
|
||||
void PipeWireSession::Finish(VideoCaptureOptions::Status status) {
|
||||
|
|
|
@ -1,50 +1,57 @@
|
|||
From: Jan Grulich <jgrulich@redhat.com>
|
||||
Date: Sat, 15 Jun 2024 11:27:00 +0000
|
||||
Subject: Bug 1902615 - WebRTC backport: PipeWire camera - check for node
|
||||
existence before adding it to the list r=pehrsons,webrtc-reviewers
|
||||
Subject: Bug 1901767 - WebRTC backport: PipeWire camera - add support for
|
||||
BGRA/RGBA formats r=pehrsons,webrtc-reviewers
|
||||
|
||||
This is a simple backport of an WebRTC upstream change.
|
||||
|
||||
Upstream commit: 633a41ff8edec405cefa109ac3c8f9662a020cc1
|
||||
Upstream commit: c3aeffd776a22050aff43c81e4a61da3492fa821.
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D213749
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/dc5e463eb0f570b9b89aef8cddd47f6659bdd16e
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D213750
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/07e9c5a3c7f97652c8a586986365bf626e605820
|
||||
---
|
||||
modules/video_capture/linux/pipewire_session.cc | 17 +++++++++++------
|
||||
1 file changed, 11 insertions(+), 6 deletions(-)
|
||||
modules/video_capture/linux/pipewire_session.cc | 4 ++++
|
||||
modules/video_capture/linux/video_capture_pipewire.cc | 8 ++++++++
|
||||
2 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/modules/video_capture/linux/pipewire_session.cc b/modules/video_capture/linux/pipewire_session.cc
|
||||
index 4d1b200aca..90ac4a3bdd 100644
|
||||
index 90ac4a3bdd..d52d6aacc8 100644
|
||||
--- a/modules/video_capture/linux/pipewire_session.cc
|
||||
+++ b/modules/video_capture/linux/pipewire_session.cc
|
||||
@@ -354,6 +354,13 @@ void PipeWireSession::OnRegistryGlobal(void* data,
|
||||
const spa_dict* props) {
|
||||
PipeWireSession* that = static_cast<PipeWireSession*>(data);
|
||||
@@ -37,6 +37,10 @@ VideoType PipeWireRawFormatToVideoType(uint32_t id) {
|
||||
return VideoType::kUYVY;
|
||||
case SPA_VIDEO_FORMAT_RGB:
|
||||
return VideoType::kRGB24;
|
||||
+ case SPA_VIDEO_FORMAT_BGRA:
|
||||
+ return VideoType::kARGB;
|
||||
+ case SPA_VIDEO_FORMAT_RGBA:
|
||||
+ return VideoType::kABGR;
|
||||
default:
|
||||
return VideoType::kUnknown;
|
||||
}
|
||||
diff --git a/modules/video_capture/linux/video_capture_pipewire.cc b/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
index 319824d3c5..21cb83a160 100644
|
||||
--- a/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
+++ b/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
@@ -33,6 +33,10 @@ struct {
|
||||
{SPA_VIDEO_FORMAT_NV12, VideoType::kNV12},
|
||||
{SPA_VIDEO_FORMAT_YUY2, VideoType::kYUY2},
|
||||
{SPA_VIDEO_FORMAT_UYVY, VideoType::kUYVY},
|
||||
+ // PipeWire is big-endian for the formats, while libyuv is little-endian
|
||||
+ // This means that BGRA == ARGB and RGBA == ABGR
|
||||
+ {SPA_VIDEO_FORMAT_BGRA, VideoType::kARGB},
|
||||
+ {SPA_VIDEO_FORMAT_RGBA, VideoType::kABGR},
|
||||
{SPA_VIDEO_FORMAT_RGB, VideoType::kRGB24},
|
||||
};
|
||||
|
||||
+ // Skip already added nodes to avoid duplicate camera entries
|
||||
+ if (std::find_if(that->nodes_.begin(), that->nodes_.end(),
|
||||
+ [id](const PipeWireNode& node) {
|
||||
+ return node.id() == id;
|
||||
+ }) != that->nodes_.end())
|
||||
+ return;
|
||||
+
|
||||
if (type != absl::string_view(PW_TYPE_INTERFACE_Node))
|
||||
return;
|
||||
|
||||
@@ -372,12 +379,10 @@ void PipeWireSession::OnRegistryGlobal(void* data,
|
||||
void PipeWireSession::OnRegistryGlobalRemove(void* data, uint32_t id) {
|
||||
PipeWireSession* that = static_cast<PipeWireSession*>(data);
|
||||
|
||||
- for (auto it = that->nodes_.begin(); it != that->nodes().end(); ++it) {
|
||||
- if ((*it).id() == id) {
|
||||
- that->nodes_.erase(it);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
+ auto it = std::remove_if(
|
||||
+ that->nodes_.begin(), that->nodes_.end(),
|
||||
+ [id](const PipeWireNode& node) { return node.id() == id; });
|
||||
+ that->nodes_.erase(it, that->nodes_.end());
|
||||
}
|
||||
|
||||
void PipeWireSession::Finish(VideoCaptureOptions::Status status) {
|
||||
@@ -303,6 +307,10 @@ void VideoCaptureModulePipeWire::OnFormatChanged(const struct spa_pod* format) {
|
||||
case VideoType::kRGB24:
|
||||
stride = configured_capability_.width * 3;
|
||||
break;
|
||||
+ case VideoType::kARGB:
|
||||
+ case VideoType::kABGR:
|
||||
+ stride = configured_capability_.width * 4;
|
||||
+ break;
|
||||
default:
|
||||
RTC_LOG(LS_ERROR) << "Unsupported video format.";
|
||||
return;
|
||||
|
|
|
@ -1,57 +1,35 @@
|
|||
From: Jan Grulich <jgrulich@redhat.com>
|
||||
Date: Sat, 15 Jun 2024 11:27:00 +0000
|
||||
Subject: Bug 1901767 - WebRTC backport: PipeWire camera - add support for
|
||||
BGRA/RGBA formats r=pehrsons,webrtc-reviewers
|
||||
Subject: Bug 1902618 - WebRTC backport: PipeWire capture: fix mmap arguments
|
||||
r=pehrsons,webrtc-reviewers
|
||||
|
||||
This is a simple backport of an WebRTC upstream change.
|
||||
|
||||
Upstream commit: c3aeffd776a22050aff43c81e4a61da3492fa821.
|
||||
Upstream commit: 3252f5d8e481b65571ebb95801754a10dc910632
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D213750
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/07e9c5a3c7f97652c8a586986365bf626e605820
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D213751
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/bfd83b29113903f4a4c7415fe6ec09609f5c6c9d
|
||||
---
|
||||
modules/video_capture/linux/pipewire_session.cc | 4 ++++
|
||||
modules/video_capture/linux/video_capture_pipewire.cc | 8 ++++++++
|
||||
2 files changed, 12 insertions(+)
|
||||
modules/video_capture/linux/video_capture_pipewire.cc | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/modules/video_capture/linux/pipewire_session.cc b/modules/video_capture/linux/pipewire_session.cc
|
||||
index 90ac4a3bdd..d52d6aacc8 100644
|
||||
--- a/modules/video_capture/linux/pipewire_session.cc
|
||||
+++ b/modules/video_capture/linux/pipewire_session.cc
|
||||
@@ -37,6 +37,10 @@ VideoType PipeWireRawFormatToVideoType(uint32_t id) {
|
||||
return VideoType::kUYVY;
|
||||
case SPA_VIDEO_FORMAT_RGB:
|
||||
return VideoType::kRGB24;
|
||||
+ case SPA_VIDEO_FORMAT_BGRA:
|
||||
+ return VideoType::kARGB;
|
||||
+ case SPA_VIDEO_FORMAT_RGBA:
|
||||
+ return VideoType::kABGR;
|
||||
default:
|
||||
return VideoType::kUnknown;
|
||||
}
|
||||
diff --git a/modules/video_capture/linux/video_capture_pipewire.cc b/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
index 319824d3c5..21cb83a160 100644
|
||||
index 21cb83a160..d7cd50df66 100644
|
||||
--- a/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
+++ b/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
@@ -33,6 +33,10 @@ struct {
|
||||
{SPA_VIDEO_FORMAT_NV12, VideoType::kNV12},
|
||||
{SPA_VIDEO_FORMAT_YUY2, VideoType::kYUY2},
|
||||
{SPA_VIDEO_FORMAT_UYVY, VideoType::kUYVY},
|
||||
+ // PipeWire is big-endian for the formats, while libyuv is little-endian
|
||||
+ // This means that BGRA == ARGB and RGBA == ABGR
|
||||
+ {SPA_VIDEO_FORMAT_BGRA, VideoType::kARGB},
|
||||
+ {SPA_VIDEO_FORMAT_RGBA, VideoType::kABGR},
|
||||
{SPA_VIDEO_FORMAT_RGB, VideoType::kRGB24},
|
||||
};
|
||||
@@ -418,11 +418,10 @@ void VideoCaptureModulePipeWire::ProcessBuffers() {
|
||||
ScopedBuf frame;
|
||||
frame.initialize(
|
||||
static_cast<uint8_t*>(
|
||||
- mmap(nullptr,
|
||||
- spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
|
||||
- PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0)),
|
||||
- spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
|
||||
- spaBuffer->datas[0].fd, spaBuffer->datas[0].type == SPA_DATA_DmaBuf);
|
||||
+ mmap(nullptr, spaBuffer->datas[0].maxsize, PROT_READ, MAP_PRIVATE,
|
||||
+ spaBuffer->datas[0].fd, spaBuffer->datas[0].mapoffset)),
|
||||
+ spaBuffer->datas[0].maxsize, spaBuffer->datas[0].fd,
|
||||
+ spaBuffer->datas[0].type == SPA_DATA_DmaBuf);
|
||||
|
||||
@@ -303,6 +307,10 @@ void VideoCaptureModulePipeWire::OnFormatChanged(const struct spa_pod* format) {
|
||||
case VideoType::kRGB24:
|
||||
stride = configured_capability_.width * 3;
|
||||
break;
|
||||
+ case VideoType::kARGB:
|
||||
+ case VideoType::kABGR:
|
||||
+ stride = configured_capability_.width * 4;
|
||||
+ break;
|
||||
default:
|
||||
RTC_LOG(LS_ERROR) << "Unsupported video format.";
|
||||
return;
|
||||
if (!frame) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to mmap the memory: "
|
||||
|
|
|
@ -1,35 +1,28 @@
|
|||
From: Jan Grulich <jgrulich@redhat.com>
|
||||
Date: Sat, 15 Jun 2024 11:27:00 +0000
|
||||
Subject: Bug 1902618 - WebRTC backport: PipeWire capture: fix mmap arguments
|
||||
r=pehrsons,webrtc-reviewers
|
||||
Subject: Bug 1902618 - WebRTC backport: PipeWire video capture: mmap()
|
||||
PipeWire buffers with MAP_SHARED r=pehrsons,webrtc-reviewers
|
||||
|
||||
This is a simple backport of an WebRTC upstream change.
|
||||
|
||||
Upstream commit: 3252f5d8e481b65571ebb95801754a10dc910632
|
||||
Upstream commit: 025d69b4d0df05f54d7bfcb3a4a2b35b48b83d82
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D213751
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/bfd83b29113903f4a4c7415fe6ec09609f5c6c9d
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D213752
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/09f0b8ff3d06a68baefa88ed598d2125dfe9d417
|
||||
---
|
||||
modules/video_capture/linux/video_capture_pipewire.cc | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
modules/video_capture/linux/video_capture_pipewire.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/modules/video_capture/linux/video_capture_pipewire.cc b/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
index 21cb83a160..d7cd50df66 100644
|
||||
index d7cd50df66..9ff4fdb9b1 100644
|
||||
--- a/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
+++ b/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
@@ -418,11 +418,10 @@ void VideoCaptureModulePipeWire::ProcessBuffers() {
|
||||
@@ -418,7 +418,7 @@ void VideoCaptureModulePipeWire::ProcessBuffers() {
|
||||
ScopedBuf frame;
|
||||
frame.initialize(
|
||||
static_cast<uint8_t*>(
|
||||
- mmap(nullptr,
|
||||
- spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
|
||||
- PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0)),
|
||||
- spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
|
||||
- spaBuffer->datas[0].fd, spaBuffer->datas[0].type == SPA_DATA_DmaBuf);
|
||||
+ mmap(nullptr, spaBuffer->datas[0].maxsize, PROT_READ, MAP_PRIVATE,
|
||||
+ spaBuffer->datas[0].fd, spaBuffer->datas[0].mapoffset)),
|
||||
+ spaBuffer->datas[0].maxsize, spaBuffer->datas[0].fd,
|
||||
+ spaBuffer->datas[0].type == SPA_DATA_DmaBuf);
|
||||
|
||||
if (!frame) {
|
||||
RTC_LOG(LS_ERROR) << "Failed to mmap the memory: "
|
||||
- mmap(nullptr, spaBuffer->datas[0].maxsize, PROT_READ, MAP_PRIVATE,
|
||||
+ mmap(nullptr, spaBuffer->datas[0].maxsize, PROT_READ, MAP_SHARED,
|
||||
spaBuffer->datas[0].fd, spaBuffer->datas[0].mapoffset)),
|
||||
spaBuffer->datas[0].maxsize, spaBuffer->datas[0].fd,
|
||||
spaBuffer->datas[0].type == SPA_DATA_DmaBuf);
|
||||
|
|
|
@ -1,28 +1,59 @@
|
|||
From: Jan Grulich <jgrulich@redhat.com>
|
||||
Date: Sat, 15 Jun 2024 11:27:00 +0000
|
||||
Subject: Bug 1902618 - WebRTC backport: PipeWire video capture: mmap()
|
||||
PipeWire buffers with MAP_SHARED r=pehrsons,webrtc-reviewers
|
||||
From: Michael Froman <mfroman@mozilla.com>
|
||||
Date: Fri, 21 Jun 2024 16:28:00 -0500
|
||||
Subject: Bug 1903098 - (fix-cd09858f4a) disable perfetto usage to avoid new
|
||||
third_party library.
|
||||
|
||||
This is a simple backport of an WebRTC upstream change.
|
||||
|
||||
Upstream commit: 025d69b4d0df05f54d7bfcb3a4a2b35b48b83d82
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D213752
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/09f0b8ff3d06a68baefa88ed598d2125dfe9d417
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b050c455caa1d24a0cfa4933ac8cd82c9cd3c347
|
||||
---
|
||||
modules/video_capture/linux/video_capture_pipewire.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
BUILD.gn | 2 ++
|
||||
modules/video_coding/generic_decoder.cc | 10 +++++-----
|
||||
2 files changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/modules/video_capture/linux/video_capture_pipewire.cc b/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
index d7cd50df66..9ff4fdb9b1 100644
|
||||
--- a/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
+++ b/modules/video_capture/linux/video_capture_pipewire.cc
|
||||
@@ -418,7 +418,7 @@ void VideoCaptureModulePipeWire::ProcessBuffers() {
|
||||
ScopedBuf frame;
|
||||
frame.initialize(
|
||||
static_cast<uint8_t*>(
|
||||
- mmap(nullptr, spaBuffer->datas[0].maxsize, PROT_READ, MAP_PRIVATE,
|
||||
+ mmap(nullptr, spaBuffer->datas[0].maxsize, PROT_READ, MAP_SHARED,
|
||||
spaBuffer->datas[0].fd, spaBuffer->datas[0].mapoffset)),
|
||||
spaBuffer->datas[0].maxsize, spaBuffer->datas[0].fd,
|
||||
spaBuffer->datas[0].type == SPA_DATA_DmaBuf);
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index 306bf453fc..ef99dfb402 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -279,6 +279,7 @@ config("rtc_prod_config") {
|
||||
}
|
||||
|
||||
group("tracing") {
|
||||
+if (!build_with_mozilla) {
|
||||
all_dependent_configs = [ "//third_party/perfetto/gn:public_config" ]
|
||||
if (rtc_use_perfetto) {
|
||||
if (build_with_chromium) {
|
||||
@@ -295,6 +296,7 @@ group("tracing") {
|
||||
[ "//third_party/perfetto/include/perfetto/tracing" ]
|
||||
}
|
||||
}
|
||||
+}
|
||||
|
||||
if (rtc_use_perfetto) {
|
||||
rtc_library("webrtc_libperfetto") {
|
||||
diff --git a/modules/video_coding/generic_decoder.cc b/modules/video_coding/generic_decoder.cc
|
||||
index 0bfc628d2c..0a9920a176 100644
|
||||
--- a/modules/video_coding/generic_decoder.cc
|
||||
+++ b/modules/video_coding/generic_decoder.cc
|
||||
@@ -103,9 +103,9 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) {
|
||||
RTC_DCHECK(_receiveCallback) << "Callback must not be null at this point";
|
||||
- TRACE_EVENT(
|
||||
- "webrtc", "VCMDecodedFrameCallback::Decoded",
|
||||
- perfetto::TerminatingFlow::ProcessScoped(decodedImage.rtp_timestamp()));
|
||||
+ TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded",
|
||||
+ TRACE_EVENT_SCOPE_GLOBAL, "timestamp",
|
||||
+ decodedImage.rtp_timestamp());
|
||||
// TODO(holmer): We should improve this so that we can handle multiple
|
||||
// callbacks from one call to Decode().
|
||||
absl::optional<FrameInfo> frame_info;
|
||||
@@ -293,8 +293,8 @@ int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, Timestamp now) {
|
||||
int32_t VCMGenericDecoder::Decode(const EncodedImage& frame,
|
||||
Timestamp now,
|
||||
int64_t render_time_ms) {
|
||||
- TRACE_EVENT("webrtc", "VCMGenericDecoder::Decode",
|
||||
- perfetto::Flow::ProcessScoped(frame.RtpTimestamp()));
|
||||
+ TRACE_EVENT1("webrtc", "VCMGenericDecoder::Decode", "timestamp",
|
||||
+ frame.RtpTimestamp());
|
||||
FrameInfo frame_info;
|
||||
frame_info.rtp_timestamp = frame.RtpTimestamp();
|
||||
frame_info.decode_start = now;
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
From: Michael Froman <mfroman@mozilla.com>
|
||||
Date: Fri, 21 Jun 2024 16:28:00 -0500
|
||||
Subject: Bug 1903098 - (fix-cd09858f4a) disable perfetto usage to avoid new
|
||||
third_party library.
|
||||
|
||||
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b050c455caa1d24a0cfa4933ac8cd82c9cd3c347
|
||||
---
|
||||
BUILD.gn | 2 ++
|
||||
modules/video_coding/generic_decoder.cc | 10 +++++-----
|
||||
2 files changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index 306bf453fc..ef99dfb402 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -279,6 +279,7 @@ config("rtc_prod_config") {
|
||||
}
|
||||
|
||||
group("tracing") {
|
||||
+if (!build_with_mozilla) {
|
||||
all_dependent_configs = [ "//third_party/perfetto/gn:public_config" ]
|
||||
if (rtc_use_perfetto) {
|
||||
if (build_with_chromium) {
|
||||
@@ -295,6 +296,7 @@ group("tracing") {
|
||||
[ "//third_party/perfetto/include/perfetto/tracing" ]
|
||||
}
|
||||
}
|
||||
+}
|
||||
|
||||
if (rtc_use_perfetto) {
|
||||
rtc_library("webrtc_libperfetto") {
|
||||
diff --git a/modules/video_coding/generic_decoder.cc b/modules/video_coding/generic_decoder.cc
|
||||
index 0bfc628d2c..0a9920a176 100644
|
||||
--- a/modules/video_coding/generic_decoder.cc
|
||||
+++ b/modules/video_coding/generic_decoder.cc
|
||||
@@ -103,9 +103,9 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) {
|
||||
RTC_DCHECK(_receiveCallback) << "Callback must not be null at this point";
|
||||
- TRACE_EVENT(
|
||||
- "webrtc", "VCMDecodedFrameCallback::Decoded",
|
||||
- perfetto::TerminatingFlow::ProcessScoped(decodedImage.rtp_timestamp()));
|
||||
+ TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded",
|
||||
+ TRACE_EVENT_SCOPE_GLOBAL, "timestamp",
|
||||
+ decodedImage.rtp_timestamp());
|
||||
// TODO(holmer): We should improve this so that we can handle multiple
|
||||
// callbacks from one call to Decode().
|
||||
absl::optional<FrameInfo> frame_info;
|
||||
@@ -293,8 +293,8 @@ int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, Timestamp now) {
|
||||
int32_t VCMGenericDecoder::Decode(const EncodedImage& frame,
|
||||
Timestamp now,
|
||||
int64_t render_time_ms) {
|
||||
- TRACE_EVENT("webrtc", "VCMGenericDecoder::Decode",
|
||||
- perfetto::Flow::ProcessScoped(frame.RtpTimestamp()));
|
||||
+ TRACE_EVENT1("webrtc", "VCMGenericDecoder::Decode", "timestamp",
|
||||
+ frame.RtpTimestamp());
|
||||
FrameInfo frame_info;
|
||||
frame_info.rtp_timestamp = frame.RtpTimestamp();
|
||||
frame_info.decode_start = now;
|
|
@ -1 +0,0 @@
|
|||
We cherry-picked this in bug 1896575
|
Загрузка…
Ссылка в новой задаче