Bug 1828517 - Vendor libwebrtc from 94d5f6af62

Upstream commit: https://webrtc.googlesource.com/src/+/94d5f6af62a70cb500d43730d0870ed860ac79b6
    Add missing include

    Bug: webrtc:14009
    Change-Id: I2d061266417b28d345e6bd88018380b01051952a
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291113
    Commit-Queue: Björn Terelius <terelius@webrtc.org>
    Reviewed-by: Alexander Cooper <alcooper@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#39204}
This commit is contained in:
Michael Froman 2023-04-24 17:59:11 -05:00
Родитель 6876677601
Коммит 35ba4c983d
28 изменённых файлов: 2539 добавлений и 2563 удалений

3
third_party/libwebrtc/README.moz-ff-commit поставляемый
Просмотреть файл

@ -21228,3 +21228,6 @@ cfbb247f6d
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
66efab2dd2
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
94d5f6af62

2
third_party/libwebrtc/README.mozilla поставляемый
Просмотреть файл

@ -14174,3 +14174,5 @@ libwebrtc updated from /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-l
libwebrtc updated from /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-04-24T22:47:43.571151.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-04-24T22:49:10.327954.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-04-24T22:58:59.449291.

Просмотреть файл

@ -11,9 +11,7 @@
#include "modules/desktop_capture/win/full_screen_win_application_handler.h"
#include <algorithm>
#if defined(WEBRTC_MOZILLA_BUILD)
#include <cwctype>
#endif
#include <memory>
#include <string>
#include <vector>

Просмотреть файл

@ -1,27 +1,52 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Wed, 28 Sep 2022 14:19:00 -0500
Subject: Bug 1790097 - (fix-e66b83f8ad) restore deleted include file for
std::towupper
Date: Mon, 24 Oct 2022 13:00:00 -0500
Subject: Bug 1797161 - pt1 - tweak BUILD.gn around task_queue_win usage. r?ng!
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2789837da50ca0d6bce9a06bd036bdd049128f20
Add assurance that we will not build task_queue_win.cc to avoid
possible win32k API usage.
Differential Revision: https://phabricator.services.mozilla.com/D160115
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/f097eb8cbd8b7686ce306a46a4db691194fd39c1
---
.../desktop_capture/win/full_screen_win_application_handler.cc | 3 +++
1 file changed, 3 insertions(+)
api/task_queue/BUILD.gn | 5 +++++
rtc_base/BUILD.gn | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/modules/desktop_capture/win/full_screen_win_application_handler.cc b/modules/desktop_capture/win/full_screen_win_application_handler.cc
index f7047dba06..c6143ef785 100644
--- a/modules/desktop_capture/win/full_screen_win_application_handler.cc
+++ b/modules/desktop_capture/win/full_screen_win_application_handler.cc
@@ -11,6 +11,9 @@
#include "modules/desktop_capture/win/full_screen_win_application_handler.h"
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index c9b4a5d0ec..1c342cb57e 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -30,6 +30,11 @@ rtc_library("task_queue") {
]
}
#include <algorithm>
+#if defined(WEBRTC_MOZILLA_BUILD)
+#include <cwctype>
+#endif
#include <memory>
#include <string>
#include <vector>
+# Mozilla - we want to ensure that rtc_include_tests is set to false
+# to guarantee that default_task_queue_factory is not used so we
+# know that remaining win32k code in task_queue_win.cc is not built.
+# See Bug 1797161 for more info.
+assert(!rtc_include_tests, "Mozilla - verify rtc_include_tests is off")
if (rtc_include_tests) {
rtc_library("task_queue_test") {
visibility = [ "*" ]
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 7e162cecbb..3cd0bfff06 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -686,10 +686,14 @@ if (is_mac || is_ios) {
if (is_win) {
rtc_library("rtc_task_queue_win") {
visibility = [ "../api/task_queue:default_task_queue_factory" ]
+# See Bug 1797161 for more info. Remove from build until win32k
+# usage is removed.
+if (!build_with_mozilla) {
sources = [
"task_queue_win.cc",
"task_queue_win.h",
]
+}
deps = [
":checks",
":logging",
--
2.34.1

Просмотреть файл

@ -1,52 +1,34 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Mon, 24 Oct 2022 13:00:00 -0500
Subject: Bug 1797161 - pt1 - tweak BUILD.gn around task_queue_win usage. r?ng!
Date: Mon, 24 Oct 2022 14:03:00 -0500
Subject: Bug 1797161 - pt3 - add static_assert to ensure we don't include
task_queue_win.cc in Mozilla builds. r?ng!
Add assurance that we will not build task_queue_win.cc to avoid
possible win32k API usage.
Differential Revision: https://phabricator.services.mozilla.com/D160115
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/f097eb8cbd8b7686ce306a46a4db691194fd39c1
Differential Revision: https://phabricator.services.mozilla.com/D160117
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/50b15e036924203147e34ec20e2689fe4a847645
---
api/task_queue/BUILD.gn | 5 +++++
rtc_base/BUILD.gn | 4 ++++
2 files changed, 9 insertions(+)
rtc_base/task_queue_win.cc | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index c9b4a5d0ec..1c342cb57e 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -30,6 +30,11 @@ rtc_library("task_queue") {
]
}
diff --git a/rtc_base/task_queue_win.cc b/rtc_base/task_queue_win.cc
index 9ea7fc60ae..6da3094548 100644
--- a/rtc_base/task_queue_win.cc
+++ b/rtc_base/task_queue_win.cc
@@ -8,6 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+# Mozilla - we want to ensure that rtc_include_tests is set to false
+# to guarantee that default_task_queue_factory is not used so we
+# know that remaining win32k code in task_queue_win.cc is not built.
+# See Bug 1797161 for more info.
+assert(!rtc_include_tests, "Mozilla - verify rtc_include_tests is off")
if (rtc_include_tests) {
rtc_library("task_queue_test") {
visibility = [ "*" ]
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 7e162cecbb..3cd0bfff06 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -686,10 +686,14 @@ if (is_mac || is_ios) {
if (is_win) {
rtc_library("rtc_task_queue_win") {
visibility = [ "../api/task_queue:default_task_queue_factory" ]
+# See Bug 1797161 for more info. Remove from build until win32k
+# usage is removed.
+if (!build_with_mozilla) {
sources = [
"task_queue_win.cc",
"task_queue_win.h",
]
+}
deps = [
":checks",
":logging",
+// Mozilla - this file should not be included in Mozilla builds until
+// win32k API usage is removed. This was once done in Bug 1395259, but
+// the upstreaming attempt stalled. Until win32k usage is officially
+// removed upstream, we have reverted to upstream's version of the file
+// (to reduce or elminate merge conflicts), and a static assert is
+// placed here to ensure this file isn't accidentally included in the
+// Mozilla build.
+static_assert(false, "This file should not be built, see Bug 1797161.");
+
#include "rtc_base/task_queue_win.h"
// clang-format off
--
2.34.1

Просмотреть файл

@ -1,34 +1,81 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Mon, 24 Oct 2022 14:03:00 -0500
Subject: Bug 1797161 - pt3 - add static_assert to ensure we don't include
task_queue_win.cc in Mozilla builds. r?ng!
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 12 Dec 2022 15:47:00 +0000
Subject: Bug 1451394 - Expose mac camera capture backend in .gn and switch it
to gecko libyuv. r=webrtc-reviewers,mjf
Differential Revision: https://phabricator.services.mozilla.com/D160117
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/50b15e036924203147e34ec20e2689fe4a847645
Differential Revision: https://phabricator.services.mozilla.com/D163682
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b0658888969395dca938597783c8a377b9bea209
---
rtc_base/task_queue_win.cc | 9 +++++++++
1 file changed, 9 insertions(+)
BUILD.gn | 4 ++++
sdk/BUILD.gn | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/rtc_base/task_queue_win.cc b/rtc_base/task_queue_win.cc
index 9ea7fc60ae..6da3094548 100644
--- a/rtc_base/task_queue_win.cc
+++ b/rtc_base/task_queue_win.cc
@@ -8,6 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
diff --git a/BUILD.gn b/BUILD.gn
index 0272f6a8fe..6515866c2d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -559,6 +559,10 @@ if (!build_with_chromium) {
]
}
+// Mozilla - this file should not be included in Mozilla builds until
+// win32k API usage is removed. This was once done in Bug 1395259, but
+// the upstreaming attempt stalled. Until win32k usage is officially
+// removed upstream, we have reverted to upstream's version of the file
+// (to reduce or elminate merge conflicts), and a static assert is
+// placed here to ensure this file isn't accidentally included in the
+// Mozilla build.
+static_assert(false, "This file should not be built, see Bug 1797161.");
+ if (build_with_mozilla && is_mac) {
+ deps += [ "sdk:videocapture_objc" ]
+ }
+
#include "rtc_base/task_queue_win.h"
if (rtc_enable_protobuf) {
deps += [ "logging:rtc_event_log_proto" ]
}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index a361656a59..65d1b10124 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -449,6 +449,7 @@ if (is_ios || is_mac) {
]
}
// clang-format off
+ if (!build_with_mozilla) {
rtc_library("videosource_objc") {
sources = [
"objc/api/peerconnection/RTCVideoSource+Private.h",
@@ -478,6 +479,7 @@ if (is_ios || is_mac) {
":used_from_extension",
]
}
+ }
rtc_library("videoframebuffer_objc") {
visibility = [ "*" ]
@@ -510,6 +512,7 @@ if (is_ios || is_mac) {
]
}
+ if (!build_with_mozilla) {
rtc_library("opengl_objc") {
sources = [
"objc/components/renderer/opengl/RTCDefaultShader.h",
@@ -662,6 +665,7 @@ if (is_ios || is_mac) {
":videoframebuffer_objc",
]
}
+ }
rtc_library("videocapture_objc") {
visibility = [ "*" ]
@@ -690,6 +694,7 @@ if (is_ios || is_mac) {
]
}
+ if (!build_with_mozilla) {
rtc_library("videocodec_objc") {
visibility = [ "*" ]
configs += [ "..:no_global_constructors" ]
@@ -1747,5 +1752,6 @@ if (is_ios || is_mac) {
"VideoToolbox.framework",
]
}
+ }
}
}
--
2.34.1

Просмотреть файл

@ -1,81 +1,31 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 12 Dec 2022 15:47:00 +0000
Subject: Bug 1451394 - Expose mac camera capture backend in .gn and switch it
to gecko libyuv. r=webrtc-reviewers,mjf
Subject: Bug 1451394 - Record video frame captures with PerformanceRecorder in
the new mac camera backend. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D163682
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b0658888969395dca938597783c8a377b9bea209
Also includes:
Bug 1806605 - Pass TrackingId instead of nsCString to CaptureStage.
Differential Revision: https://phabricator.services.mozilla.com/D163687
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a7362238c9e6fbe0d28200f6b41fc40a0c9a2158
---
BUILD.gn | 4 ++++
sdk/BUILD.gn | 6 ++++++
2 files changed, 10 insertions(+)
modules/video_capture/video_capture.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/BUILD.gn b/BUILD.gn
index 0272f6a8fe..6515866c2d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -559,6 +559,10 @@ if (!build_with_chromium) {
]
}
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index ad1b341b62..7e181c538e 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -158,6 +158,9 @@ class VideoCaptureModule : public rtc::RefCountInterface {
// Return whether the rotation is applied or left pending.
virtual bool GetApplyRotation() = 0;
+ if (build_with_mozilla && is_mac) {
+ deps += [ "sdk:videocapture_objc" ]
+ }
+ // Mozilla: TrackingId setter for use in profiler markers.
+ virtual void SetTrackingId(uint32_t aTrackingIdProcId) {}
+
if (rtc_enable_protobuf) {
deps += [ "logging:rtc_event_log_proto" ]
}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index a361656a59..65d1b10124 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -449,6 +449,7 @@ if (is_ios || is_mac) {
]
}
+ if (!build_with_mozilla) {
rtc_library("videosource_objc") {
sources = [
"objc/api/peerconnection/RTCVideoSource+Private.h",
@@ -478,6 +479,7 @@ if (is_ios || is_mac) {
":used_from_extension",
]
}
+ }
rtc_library("videoframebuffer_objc") {
visibility = [ "*" ]
@@ -510,6 +512,7 @@ if (is_ios || is_mac) {
]
}
+ if (!build_with_mozilla) {
rtc_library("opengl_objc") {
sources = [
"objc/components/renderer/opengl/RTCDefaultShader.h",
@@ -662,6 +665,7 @@ if (is_ios || is_mac) {
":videoframebuffer_objc",
]
}
+ }
rtc_library("videocapture_objc") {
visibility = [ "*" ]
@@ -690,6 +694,7 @@ if (is_ios || is_mac) {
]
}
+ if (!build_with_mozilla) {
rtc_library("videocodec_objc") {
visibility = [ "*" ]
configs += [ "..:no_global_constructors" ]
@@ -1747,5 +1752,6 @@ if (is_ios || is_mac) {
"VideoToolbox.framework",
]
}
+ }
}
}
protected:
~VideoCaptureModule() override {}
};
--
2.34.1

Просмотреть файл

@ -1,31 +1,346 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 12 Dec 2022 15:47:00 +0000
Subject: Bug 1451394 - Record video frame captures with PerformanceRecorder in
the new mac camera backend. r=padenot
Date: Tue, 23 Nov 2021 14:11:00 +0000
Subject: Bug 1742181 - libwebrtc: Implement packetsDiscarded bookkeeping for
received video. r=ng
Depends on D131707
Differential Revision: https://phabricator.services.mozilla.com/D131708
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d0196a45a1f449874fc2a759e85e403c45c25575
Also includes:
Bug 1806605 - Pass TrackingId instead of nsCString to CaptureStage.
Differential Revision: https://phabricator.services.mozilla.com/D163687
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a7362238c9e6fbe0d28200f6b41fc40a0c9a2158
Bug 1804288 - (fix-de7ae5755b) reimplement Bug 1742181 - libwebrtc: Implement packetsDiscarded bookkeeping for received video. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D163959
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ee566d1bfb654d36e5d58dce637fb0580b989ac1
---
modules/video_capture/video_capture.h | 3 +++
1 file changed, 3 insertions(+)
api/video/frame_buffer.cc | 25 ++++++++++++++++---
api/video/frame_buffer.h | 4 +++
call/video_receive_stream.h | 2 ++
.../include/video_coding_defines.h | 2 ++
modules/video_coding/packet_buffer.cc | 10 +++++---
modules/video_coding/packet_buffer.h | 5 +++-
video/receive_statistics_proxy2.cc | 5 ++++
video/receive_statistics_proxy2.h | 1 +
video/rtp_video_stream_receiver2.cc | 5 +++-
video/rtp_video_stream_receiver2.h | 2 ++
video/video_receive_stream2.cc | 1 +
video/video_stream_buffer_controller.cc | 12 +++++++++
video/video_stream_buffer_controller.h | 3 +++
13 files changed, 69 insertions(+), 8 deletions(-)
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index ad1b341b62..7e181c538e 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -158,6 +158,9 @@ class VideoCaptureModule : public rtc::RefCountInterface {
// Return whether the rotation is applied or left pending.
virtual bool GetApplyRotation() = 0;
diff --git a/api/video/frame_buffer.cc b/api/video/frame_buffer.cc
index 4cdf2212a6..8267b8e6cb 100644
--- a/api/video/frame_buffer.cc
+++ b/api/video/frame_buffer.cc
@@ -140,14 +140,29 @@ void FrameBuffer::DropNextDecodableTemporalUnit() {
}
+ // Mozilla: TrackingId setter for use in profiler markers.
+ virtual void SetTrackingId(uint32_t aTrackingIdProcId) {}
auto end_it = std::next(next_decodable_temporal_unit_->last_frame);
- num_dropped_frames_ += std::count_if(
- frames_.begin(), end_it,
- [](const auto& f) { return f.second.encoded_frame != nullptr; });
+
protected:
~VideoCaptureModule() override {}
+ UpdateDroppedFramesAndDiscardedPackets(frames_.begin(), end_it);
frames_.erase(frames_.begin(), end_it);
FindNextAndLastDecodableTemporalUnit();
}
+void FrameBuffer::UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
+ FrameIterator end_it) {
+ unsigned int num_discarded_packets = 0;
+ unsigned int num_dropped_frames =
+ std::count_if(begin_it, end_it, [&](const auto& f) {
+ if (f.second.encoded_frame) {
+ const auto& packetInfos = f.second.encoded_frame->PacketInfos();
+ num_discarded_packets += packetInfos.size();
+ }
+ return f.second.encoded_frame != nullptr;
+ });
+
+ num_dropped_frames_ += num_dropped_frames;
+ num_discarded_packets_ += num_discarded_packets;
+}
+
absl::optional<int64_t> FrameBuffer::LastContinuousFrameId() const {
return last_continuous_frame_id_;
}
@@ -167,6 +182,9 @@ int FrameBuffer::GetTotalNumberOfContinuousTemporalUnits() const {
int FrameBuffer::GetTotalNumberOfDroppedFrames() const {
return num_dropped_frames_;
}
+int FrameBuffer::GetTotalNumberOfDiscardedPackets() const {
+ return num_discarded_packets_;
+}
size_t FrameBuffer::CurrentSize() const {
return frames_.size();
@@ -269,6 +287,7 @@ void FrameBuffer::FindNextAndLastDecodableTemporalUnit() {
}
void FrameBuffer::Clear() {
+ UpdateDroppedFramesAndDiscardedPackets(frames_.begin(), frames_.end());
frames_.clear();
next_decodable_temporal_unit_.reset();
decodable_temporal_units_info_.reset();
diff --git a/api/video/frame_buffer.h b/api/video/frame_buffer.h
index 94edf64d5a..81fd12da58 100644
--- a/api/video/frame_buffer.h
+++ b/api/video/frame_buffer.h
@@ -66,6 +66,7 @@ class FrameBuffer {
int GetTotalNumberOfContinuousTemporalUnits() const;
int GetTotalNumberOfDroppedFrames() const;
+ int GetTotalNumberOfDiscardedPackets() const;
size_t CurrentSize() const;
private:
@@ -87,6 +88,8 @@ class FrameBuffer {
void PropagateContinuity(const FrameIterator& frame_it);
void FindNextAndLastDecodableTemporalUnit();
void Clear();
+ void UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
+ FrameIterator end_it);
const bool legacy_frame_id_jump_behavior_;
const size_t max_size_;
@@ -99,6 +102,7 @@ class FrameBuffer {
int num_continuous_temporal_units_ = 0;
int num_dropped_frames_ = 0;
+ int num_discarded_packets_ = 0;
};
} // namespace webrtc
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 25c294a2a6..1ab4a2a85b 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -106,6 +106,8 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
// https://www.w3.org/TR/webrtc-stats/#dom-rtcvideoreceiverstats-framesdropped
uint32_t frames_dropped = 0;
uint32_t frames_decoded = 0;
+ // https://w3c.github.io/webrtc-stats/#dom-rtcreceivedrtpstreamstats-packetsdiscarded
+ uint64_t packets_discarded = 0;
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totaldecodetime
TimeDelta total_decode_time = TimeDelta::Zero();
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totalprocessingdelay
diff --git a/modules/video_coding/include/video_coding_defines.h b/modules/video_coding/include/video_coding_defines.h
index 8f70e0298d..bf98d5e668 100644
--- a/modules/video_coding/include/video_coding_defines.h
+++ b/modules/video_coding/include/video_coding_defines.h
@@ -76,6 +76,8 @@ class VCMReceiveStatisticsCallback {
virtual void OnDroppedFrames(uint32_t frames_dropped) = 0;
+ virtual void OnDiscardedPackets(uint32_t packets_discarded) = 0;
+
virtual void OnFrameBufferTimingsUpdated(int max_decode_ms,
int current_delay_ms,
int target_delay_ms,
diff --git a/modules/video_coding/packet_buffer.cc b/modules/video_coding/packet_buffer.cc
index 3dcfc48213..04f02fce97 100644
--- a/modules/video_coding/packet_buffer.cc
+++ b/modules/video_coding/packet_buffer.cc
@@ -115,25 +115,27 @@ PacketBuffer::InsertResult PacketBuffer::InsertPacket(
return result;
}
-void PacketBuffer::ClearTo(uint16_t seq_num) {
+uint32_t PacketBuffer::ClearTo(uint16_t seq_num) {
// We have already cleared past this sequence number, no need to do anything.
if (is_cleared_to_first_seq_num_ &&
AheadOf<uint16_t>(first_seq_num_, seq_num)) {
- return;
+ return 0;
}
// If the packet buffer was cleared between a frame was created and returned.
if (!first_packet_received_)
- return;
+ return 0;
// Avoid iterating over the buffer more than once by capping the number of
// iterations to the `size_` of the buffer.
++seq_num;
+ uint32_t num_cleared_packets = 0;
size_t diff = ForwardDiff<uint16_t>(first_seq_num_, seq_num);
size_t iterations = std::min(diff, buffer_.size());
for (size_t i = 0; i < iterations; ++i) {
auto& stored = buffer_[first_seq_num_ % buffer_.size()];
if (stored != nullptr && AheadOf<uint16_t>(seq_num, stored->seq_num)) {
+ ++num_cleared_packets;
stored = nullptr;
}
++first_seq_num_;
@@ -149,6 +151,8 @@ void PacketBuffer::ClearTo(uint16_t seq_num) {
received_padding_.erase(received_padding_.begin(),
received_padding_.lower_bound(seq_num));
+
+ return num_cleared_packets;
}
void PacketBuffer::Clear() {
diff --git a/modules/video_coding/packet_buffer.h b/modules/video_coding/packet_buffer.h
index 53e08c95a1..47b2ffe199 100644
--- a/modules/video_coding/packet_buffer.h
+++ b/modules/video_coding/packet_buffer.h
@@ -78,7 +78,10 @@ class PacketBuffer {
ABSL_MUST_USE_RESULT InsertResult
InsertPacket(std::unique_ptr<Packet> packet);
ABSL_MUST_USE_RESULT InsertResult InsertPadding(uint16_t seq_num);
- void ClearTo(uint16_t seq_num);
+
+ // Clear all packets older than |seq_num|. Returns the number of packets
+ // cleared.
+ uint32_t ClearTo(uint16_t seq_num);
void Clear();
void ForceSpsPpsIdrIsH264Keyframe();
diff --git a/video/receive_statistics_proxy2.cc b/video/receive_statistics_proxy2.cc
index 4f208a1d5e..020e4bb0ae 100644
--- a/video/receive_statistics_proxy2.cc
+++ b/video/receive_statistics_proxy2.cc
@@ -959,6 +959,11 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
}));
}
+void ReceiveStatisticsProxy::OnDiscardedPackets(uint32_t packets_discarded) {
+ RTC_DCHECK_RUN_ON(&main_thread_);
+ stats_.packets_discarded += packets_discarded;
+}
+
void ReceiveStatisticsProxy::OnPreDecode(VideoCodecType codec_type, int qp) {
RTC_DCHECK_RUN_ON(&main_thread_);
last_codec_type_ = codec_type;
diff --git a/video/receive_statistics_proxy2.h b/video/receive_statistics_proxy2.h
index 1a2bb77fa6..20139b45e5 100644
--- a/video/receive_statistics_proxy2.h
+++ b/video/receive_statistics_proxy2.h
@@ -90,6 +90,7 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
size_t size_bytes,
VideoContentType content_type) override;
void OnDroppedFrames(uint32_t frames_dropped) override;
+ void OnDiscardedPackets(uint32_t packets_discarded) override;
void OnFrameBufferTimingsUpdated(int max_decode_ms,
int current_delay_ms,
int target_delay_ms,
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 094f8f4a54..46998b6d7c 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -244,6 +244,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer,
RtcpCnameCallback* rtcp_cname_callback,
NackPeriodicProcessor* nack_periodic_processor,
+ VCMReceiveStatisticsCallback* vcm_receive_statistics,
OnCompleteFrameCallback* complete_frame_callback,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
@@ -293,6 +294,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
&rtcp_feedback_buffer_,
&rtcp_feedback_buffer_,
field_trials_)),
+ vcm_receive_statistics_(vcm_receive_statistics),
packet_buffer_(kPacketBufferStartSize,
PacketBufferMaxSize(field_trials_)),
reference_finder_(std::make_unique<RtpFrameReferenceFinder>()),
@@ -1219,7 +1221,8 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
int64_t unwrapped_rtp_seq_num = rtp_seq_num_unwrapper_.Unwrap(seq_num);
packet_infos_.erase(packet_infos_.begin(),
packet_infos_.upper_bound(unwrapped_rtp_seq_num));
- packet_buffer_.ClearTo(seq_num);
+ uint32_t num_packets_cleared = packet_buffer_.ClearTo(seq_num);
+ vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
reference_finder_->ClearTo(seq_num);
}
}
diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h
index 6bf4bf8453..931525a054 100644
--- a/video/rtp_video_stream_receiver2.h
+++ b/video/rtp_video_stream_receiver2.h
@@ -91,6 +91,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer,
RtcpCnameCallback* rtcp_cname_callback,
NackPeriodicProcessor* nack_periodic_processor,
+ VCMReceiveStatisticsCallback* vcm_receive_statistics,
// The KeyFrameRequestSender is optional; if not provided, key frame
// requests are sent via the internal RtpRtcp module.
OnCompleteFrameCallback* complete_frame_callback,
@@ -368,6 +369,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
std::unique_ptr<LossNotificationController> loss_notification_controller_
RTC_GUARDED_BY(packet_sequence_checker_);
+ VCMReceiveStatisticsCallback* const vcm_receive_statistics_;
video_coding::PacketBuffer packet_buffer_
RTC_GUARDED_BY(packet_sequence_checker_);
UniqueTimestampCounter frame_counter_
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index 7cbd49d322..beb894e139 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -211,6 +211,7 @@ VideoReceiveStream2::VideoReceiveStream2(
&stats_proxy_,
&stats_proxy_,
nack_periodic_processor,
+ &stats_proxy_,
this, // OnCompleteFrameCallback
std::move(config_.frame_decryptor),
std::move(config_.frame_transformer),
diff --git a/video/video_stream_buffer_controller.cc b/video/video_stream_buffer_controller.cc
index f7d3acdaf6..7e44eff39a 100644
--- a/video/video_stream_buffer_controller.cc
+++ b/video/video_stream_buffer_controller.cc
@@ -247,6 +247,7 @@ void VideoStreamBufferController::OnFrameReady(
// Update stats.
UpdateDroppedFrames();
+ UpdateDiscardedPackets();
UpdateJitterDelay();
UpdateTimingFrameInfo();
@@ -312,6 +313,17 @@ void VideoStreamBufferController::UpdateDroppedFrames()
buffer_->GetTotalNumberOfDroppedFrames();
}
+void VideoStreamBufferController::UpdateDiscardedPackets()
+ RTC_RUN_ON(&worker_sequence_checker_) {
+ const int discarded_packets = buffer_->GetTotalNumberOfDiscardedPackets() -
+ packets_discarded_before_last_new_frame_;
+ if (discarded_packets > 0) {
+ stats_proxy_->OnDiscardedPackets(discarded_packets);
+ }
+ packets_discarded_before_last_new_frame_ =
+ buffer_->GetTotalNumberOfDiscardedPackets();
+}
+
void VideoStreamBufferController::UpdateJitterDelay() {
auto timings = timing_->GetTimings();
if (timings.num_decoded_frames) {
diff --git a/video/video_stream_buffer_controller.h b/video/video_stream_buffer_controller.h
index ed79b0fa1f..7638c91471 100644
--- a/video/video_stream_buffer_controller.h
+++ b/video/video_stream_buffer_controller.h
@@ -67,6 +67,7 @@ class VideoStreamBufferController {
void OnTimeout(TimeDelta delay);
void FrameReadyForDecode(uint32_t rtp_timestamp, Timestamp render_time);
void UpdateDroppedFrames() RTC_RUN_ON(&worker_sequence_checker_);
+ void UpdateDiscardedPackets() RTC_RUN_ON(&worker_sequence_checker_);
void UpdateJitterDelay();
void UpdateTimingFrameInfo();
bool IsTooManyFramesQueued() const RTC_RUN_ON(&worker_sequence_checker_);
@@ -94,6 +95,8 @@ class VideoStreamBufferController {
RTC_GUARDED_BY(&worker_sequence_checker_);
int frames_dropped_before_last_new_frame_
RTC_GUARDED_BY(&worker_sequence_checker_) = 0;
+ int packets_discarded_before_last_new_frame_
+ RTC_GUARDED_BY(&worker_sequence_checker_) = 0;
VCMVideoProtection protection_mode_
RTC_GUARDED_BY(&worker_sequence_checker_) = kProtectionNack;
--
2.34.1

Просмотреть файл

@ -1,346 +1,49 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Tue, 23 Nov 2021 14:11:00 +0000
Subject: Bug 1742181 - libwebrtc: Implement packetsDiscarded bookkeeping for
received video. r=ng
Date: Thu, 6 Jan 2022 00:16:00 +0000
Subject: Bug 1748478 - Propagate calculated discarded packets to stats. r=bwc
Depends on D131707
Differential Revision: https://phabricator.services.mozilla.com/D131708
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d0196a45a1f449874fc2a759e85e403c45c25575
Also includes:
Bug 1804288 - (fix-de7ae5755b) reimplement Bug 1742181 - libwebrtc: Implement packetsDiscarded bookkeeping for received video. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D163959
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ee566d1bfb654d36e5d58dce637fb0580b989ac1
Differential Revision: https://phabricator.services.mozilla.com/D135061
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/56fbf0469e25fa0d589c51ca112ce534a7c0ab91
---
api/video/frame_buffer.cc | 25 ++++++++++++++++---
api/video/frame_buffer.h | 4 +++
call/video_receive_stream.h | 2 ++
.../include/video_coding_defines.h | 2 ++
modules/video_coding/packet_buffer.cc | 10 +++++---
modules/video_coding/packet_buffer.h | 5 +++-
video/receive_statistics_proxy2.cc | 5 ++++
video/receive_statistics_proxy2.h | 1 +
video/rtp_video_stream_receiver2.cc | 5 +++-
video/rtp_video_stream_receiver2.h | 2 ++
video/video_receive_stream2.cc | 1 +
video/video_stream_buffer_controller.cc | 12 +++++++++
video/video_stream_buffer_controller.h | 3 +++
13 files changed, 69 insertions(+), 8 deletions(-)
video/receive_statistics_proxy2.cc | 9 +++++++--
video/rtp_video_stream_receiver2.cc | 4 +++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/api/video/frame_buffer.cc b/api/video/frame_buffer.cc
index 4cdf2212a6..8267b8e6cb 100644
--- a/api/video/frame_buffer.cc
+++ b/api/video/frame_buffer.cc
@@ -140,14 +140,29 @@ void FrameBuffer::DropNextDecodableTemporalUnit() {
}
auto end_it = std::next(next_decodable_temporal_unit_->last_frame);
- num_dropped_frames_ += std::count_if(
- frames_.begin(), end_it,
- [](const auto& f) { return f.second.encoded_frame != nullptr; });
+
+ UpdateDroppedFramesAndDiscardedPackets(frames_.begin(), end_it);
frames_.erase(frames_.begin(), end_it);
FindNextAndLastDecodableTemporalUnit();
}
+void FrameBuffer::UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
+ FrameIterator end_it) {
+ unsigned int num_discarded_packets = 0;
+ unsigned int num_dropped_frames =
+ std::count_if(begin_it, end_it, [&](const auto& f) {
+ if (f.second.encoded_frame) {
+ const auto& packetInfos = f.second.encoded_frame->PacketInfos();
+ num_discarded_packets += packetInfos.size();
+ }
+ return f.second.encoded_frame != nullptr;
+ });
+
+ num_dropped_frames_ += num_dropped_frames;
+ num_discarded_packets_ += num_discarded_packets;
+}
+
absl::optional<int64_t> FrameBuffer::LastContinuousFrameId() const {
return last_continuous_frame_id_;
}
@@ -167,6 +182,9 @@ int FrameBuffer::GetTotalNumberOfContinuousTemporalUnits() const {
int FrameBuffer::GetTotalNumberOfDroppedFrames() const {
return num_dropped_frames_;
}
+int FrameBuffer::GetTotalNumberOfDiscardedPackets() const {
+ return num_discarded_packets_;
+}
size_t FrameBuffer::CurrentSize() const {
return frames_.size();
@@ -269,6 +287,7 @@ void FrameBuffer::FindNextAndLastDecodableTemporalUnit() {
}
void FrameBuffer::Clear() {
+ UpdateDroppedFramesAndDiscardedPackets(frames_.begin(), frames_.end());
frames_.clear();
next_decodable_temporal_unit_.reset();
decodable_temporal_units_info_.reset();
diff --git a/api/video/frame_buffer.h b/api/video/frame_buffer.h
index 94edf64d5a..81fd12da58 100644
--- a/api/video/frame_buffer.h
+++ b/api/video/frame_buffer.h
@@ -66,6 +66,7 @@ class FrameBuffer {
int GetTotalNumberOfContinuousTemporalUnits() const;
int GetTotalNumberOfDroppedFrames() const;
+ int GetTotalNumberOfDiscardedPackets() const;
size_t CurrentSize() const;
private:
@@ -87,6 +88,8 @@ class FrameBuffer {
void PropagateContinuity(const FrameIterator& frame_it);
void FindNextAndLastDecodableTemporalUnit();
void Clear();
+ void UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
+ FrameIterator end_it);
const bool legacy_frame_id_jump_behavior_;
const size_t max_size_;
@@ -99,6 +102,7 @@ class FrameBuffer {
int num_continuous_temporal_units_ = 0;
int num_dropped_frames_ = 0;
+ int num_discarded_packets_ = 0;
};
} // namespace webrtc
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 25c294a2a6..1ab4a2a85b 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -106,6 +106,8 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
// https://www.w3.org/TR/webrtc-stats/#dom-rtcvideoreceiverstats-framesdropped
uint32_t frames_dropped = 0;
uint32_t frames_decoded = 0;
+ // https://w3c.github.io/webrtc-stats/#dom-rtcreceivedrtpstreamstats-packetsdiscarded
+ uint64_t packets_discarded = 0;
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totaldecodetime
TimeDelta total_decode_time = TimeDelta::Zero();
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-totalprocessingdelay
diff --git a/modules/video_coding/include/video_coding_defines.h b/modules/video_coding/include/video_coding_defines.h
index 8f70e0298d..bf98d5e668 100644
--- a/modules/video_coding/include/video_coding_defines.h
+++ b/modules/video_coding/include/video_coding_defines.h
@@ -76,6 +76,8 @@ class VCMReceiveStatisticsCallback {
virtual void OnDroppedFrames(uint32_t frames_dropped) = 0;
+ virtual void OnDiscardedPackets(uint32_t packets_discarded) = 0;
+
virtual void OnFrameBufferTimingsUpdated(int max_decode_ms,
int current_delay_ms,
int target_delay_ms,
diff --git a/modules/video_coding/packet_buffer.cc b/modules/video_coding/packet_buffer.cc
index 3dcfc48213..04f02fce97 100644
--- a/modules/video_coding/packet_buffer.cc
+++ b/modules/video_coding/packet_buffer.cc
@@ -115,25 +115,27 @@ PacketBuffer::InsertResult PacketBuffer::InsertPacket(
return result;
}
-void PacketBuffer::ClearTo(uint16_t seq_num) {
+uint32_t PacketBuffer::ClearTo(uint16_t seq_num) {
// We have already cleared past this sequence number, no need to do anything.
if (is_cleared_to_first_seq_num_ &&
AheadOf<uint16_t>(first_seq_num_, seq_num)) {
- return;
+ return 0;
}
// If the packet buffer was cleared between a frame was created and returned.
if (!first_packet_received_)
- return;
+ return 0;
// Avoid iterating over the buffer more than once by capping the number of
// iterations to the `size_` of the buffer.
++seq_num;
+ uint32_t num_cleared_packets = 0;
size_t diff = ForwardDiff<uint16_t>(first_seq_num_, seq_num);
size_t iterations = std::min(diff, buffer_.size());
for (size_t i = 0; i < iterations; ++i) {
auto& stored = buffer_[first_seq_num_ % buffer_.size()];
if (stored != nullptr && AheadOf<uint16_t>(seq_num, stored->seq_num)) {
+ ++num_cleared_packets;
stored = nullptr;
}
++first_seq_num_;
@@ -149,6 +151,8 @@ void PacketBuffer::ClearTo(uint16_t seq_num) {
received_padding_.erase(received_padding_.begin(),
received_padding_.lower_bound(seq_num));
+
+ return num_cleared_packets;
}
void PacketBuffer::Clear() {
diff --git a/modules/video_coding/packet_buffer.h b/modules/video_coding/packet_buffer.h
index 53e08c95a1..47b2ffe199 100644
--- a/modules/video_coding/packet_buffer.h
+++ b/modules/video_coding/packet_buffer.h
@@ -78,7 +78,10 @@ class PacketBuffer {
ABSL_MUST_USE_RESULT InsertResult
InsertPacket(std::unique_ptr<Packet> packet);
ABSL_MUST_USE_RESULT InsertResult InsertPadding(uint16_t seq_num);
- void ClearTo(uint16_t seq_num);
+
+ // Clear all packets older than |seq_num|. Returns the number of packets
+ // cleared.
+ uint32_t ClearTo(uint16_t seq_num);
void Clear();
void ForceSpsPpsIdrIsH264Keyframe();
diff --git a/video/receive_statistics_proxy2.cc b/video/receive_statistics_proxy2.cc
index 4f208a1d5e..020e4bb0ae 100644
index 020e4bb0ae..f5011c46ef 100644
--- a/video/receive_statistics_proxy2.cc
+++ b/video/receive_statistics_proxy2.cc
@@ -959,6 +959,11 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
}));
@@ -960,8 +960,13 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
}
+void ReceiveStatisticsProxy::OnDiscardedPackets(uint32_t packets_discarded) {
void ReceiveStatisticsProxy::OnDiscardedPackets(uint32_t packets_discarded) {
- RTC_DCHECK_RUN_ON(&main_thread_);
- stats_.packets_discarded += packets_discarded;
+ // Can be called on either the decode queue or the worker thread
+ // See FrameBuffer2 for more details.
+ worker_thread_->PostTask(
+ SafeTask(task_safety_.flag(), [packets_discarded, this]() {
+ RTC_DCHECK_RUN_ON(&main_thread_);
+ stats_.packets_discarded += packets_discarded;
+}
+
+ }));
}
void ReceiveStatisticsProxy::OnPreDecode(VideoCodecType codec_type, int qp) {
RTC_DCHECK_RUN_ON(&main_thread_);
last_codec_type_ = codec_type;
diff --git a/video/receive_statistics_proxy2.h b/video/receive_statistics_proxy2.h
index 1a2bb77fa6..20139b45e5 100644
--- a/video/receive_statistics_proxy2.h
+++ b/video/receive_statistics_proxy2.h
@@ -90,6 +90,7 @@ class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
size_t size_bytes,
VideoContentType content_type) override;
void OnDroppedFrames(uint32_t frames_dropped) override;
+ void OnDiscardedPackets(uint32_t packets_discarded) override;
void OnFrameBufferTimingsUpdated(int max_decode_ms,
int current_delay_ms,
int target_delay_ms,
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 094f8f4a54..46998b6d7c 100644
index 46998b6d7c..a5d5f637e5 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -244,6 +244,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer,
RtcpCnameCallback* rtcp_cname_callback,
NackPeriodicProcessor* nack_periodic_processor,
+ VCMReceiveStatisticsCallback* vcm_receive_statistics,
OnCompleteFrameCallback* complete_frame_callback,
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer,
@@ -293,6 +294,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2(
&rtcp_feedback_buffer_,
&rtcp_feedback_buffer_,
field_trials_)),
+ vcm_receive_statistics_(vcm_receive_statistics),
packet_buffer_(kPacketBufferStartSize,
PacketBufferMaxSize(field_trials_)),
reference_finder_(std::make_unique<RtpFrameReferenceFinder>()),
@@ -1219,7 +1221,8 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
int64_t unwrapped_rtp_seq_num = rtp_seq_num_unwrapper_.Unwrap(seq_num);
@@ -1222,7 +1222,9 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
packet_infos_.erase(packet_infos_.begin(),
packet_infos_.upper_bound(unwrapped_rtp_seq_num));
- packet_buffer_.ClearTo(seq_num);
+ uint32_t num_packets_cleared = packet_buffer_.ClearTo(seq_num);
uint32_t num_packets_cleared = packet_buffer_.ClearTo(seq_num);
- vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
+ if (num_packets_cleared > 0) {
+ vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
+ }
reference_finder_->ClearTo(seq_num);
}
}
diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h
index 6bf4bf8453..931525a054 100644
--- a/video/rtp_video_stream_receiver2.h
+++ b/video/rtp_video_stream_receiver2.h
@@ -91,6 +91,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer,
RtcpCnameCallback* rtcp_cname_callback,
NackPeriodicProcessor* nack_periodic_processor,
+ VCMReceiveStatisticsCallback* vcm_receive_statistics,
// The KeyFrameRequestSender is optional; if not provided, key frame
// requests are sent via the internal RtpRtcp module.
OnCompleteFrameCallback* complete_frame_callback,
@@ -368,6 +369,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
std::unique_ptr<LossNotificationController> loss_notification_controller_
RTC_GUARDED_BY(packet_sequence_checker_);
+ VCMReceiveStatisticsCallback* const vcm_receive_statistics_;
video_coding::PacketBuffer packet_buffer_
RTC_GUARDED_BY(packet_sequence_checker_);
UniqueTimestampCounter frame_counter_
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index 7cbd49d322..beb894e139 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -211,6 +211,7 @@ VideoReceiveStream2::VideoReceiveStream2(
&stats_proxy_,
&stats_proxy_,
nack_periodic_processor,
+ &stats_proxy_,
this, // OnCompleteFrameCallback
std::move(config_.frame_decryptor),
std::move(config_.frame_transformer),
diff --git a/video/video_stream_buffer_controller.cc b/video/video_stream_buffer_controller.cc
index f7d3acdaf6..7e44eff39a 100644
--- a/video/video_stream_buffer_controller.cc
+++ b/video/video_stream_buffer_controller.cc
@@ -247,6 +247,7 @@ void VideoStreamBufferController::OnFrameReady(
// Update stats.
UpdateDroppedFrames();
+ UpdateDiscardedPackets();
UpdateJitterDelay();
UpdateTimingFrameInfo();
@@ -312,6 +313,17 @@ void VideoStreamBufferController::UpdateDroppedFrames()
buffer_->GetTotalNumberOfDroppedFrames();
}
+void VideoStreamBufferController::UpdateDiscardedPackets()
+ RTC_RUN_ON(&worker_sequence_checker_) {
+ const int discarded_packets = buffer_->GetTotalNumberOfDiscardedPackets() -
+ packets_discarded_before_last_new_frame_;
+ if (discarded_packets > 0) {
+ stats_proxy_->OnDiscardedPackets(discarded_packets);
+ }
+ packets_discarded_before_last_new_frame_ =
+ buffer_->GetTotalNumberOfDiscardedPackets();
+}
+
void VideoStreamBufferController::UpdateJitterDelay() {
auto timings = timing_->GetTimings();
if (timings.num_decoded_frames) {
diff --git a/video/video_stream_buffer_controller.h b/video/video_stream_buffer_controller.h
index ed79b0fa1f..7638c91471 100644
--- a/video/video_stream_buffer_controller.h
+++ b/video/video_stream_buffer_controller.h
@@ -67,6 +67,7 @@ class VideoStreamBufferController {
void OnTimeout(TimeDelta delay);
void FrameReadyForDecode(uint32_t rtp_timestamp, Timestamp render_time);
void UpdateDroppedFrames() RTC_RUN_ON(&worker_sequence_checker_);
+ void UpdateDiscardedPackets() RTC_RUN_ON(&worker_sequence_checker_);
void UpdateJitterDelay();
void UpdateTimingFrameInfo();
bool IsTooManyFramesQueued() const RTC_RUN_ON(&worker_sequence_checker_);
@@ -94,6 +95,8 @@ class VideoStreamBufferController {
RTC_GUARDED_BY(&worker_sequence_checker_);
int frames_dropped_before_last_new_frame_
RTC_GUARDED_BY(&worker_sequence_checker_) = 0;
+ int packets_discarded_before_last_new_frame_
+ RTC_GUARDED_BY(&worker_sequence_checker_) = 0;
VCMVideoProtection protection_mode_
RTC_GUARDED_BY(&worker_sequence_checker_) = kProtectionNack;
--
2.34.1

Просмотреть файл

@ -1,49 +1,295 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Thu, 6 Jan 2022 00:16:00 +0000
Subject: Bug 1748478 - Propagate calculated discarded packets to stats. r=bwc
Subject: Bug 1748458 - Add TRACE_EVENTs for dropped frames and packets for
received video. r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D135061
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/56fbf0469e25fa0d589c51ca112ce534a7c0ab91
This lets us see in the profiler how many received frames and packets we decide
to drop and the reasons why.
Differential Revision: https://phabricator.services.mozilla.com/D135062
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/08e252da94c4752eccfd845eef13d8517953cc6a
Also includes:
Bug 1804288 - (fix-de7ae5755b) reimplement Bug 1748458 - Add TRACE_EVENTs for dropped frames and packets for received video. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D163960
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/8e9a326a99cd5eaa6e447ff57c01ad9d79a09744
---
video/receive_statistics_proxy2.cc | 9 +++++++--
video/rtp_video_stream_receiver2.cc | 4 +++-
2 files changed, 10 insertions(+), 3 deletions(-)
api/video/frame_buffer.cc | 33 +++++++++++++++++++++++++
modules/video_coding/frame_buffer2.cc | 25 +++++++++++++++++++
video/receive_statistics_proxy2.cc | 11 +++++++++
video/rtp_video_stream_receiver2.cc | 4 +++
video/video_stream_buffer_controller.cc | 7 ++++++
5 files changed, 80 insertions(+)
diff --git a/api/video/frame_buffer.cc b/api/video/frame_buffer.cc
index 8267b8e6cb..f5d93f5f76 100644
--- a/api/video/frame_buffer.cc
+++ b/api/video/frame_buffer.cc
@@ -16,6 +16,7 @@
#include "absl/container/inlined_vector.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/sequence_number_util.h"
+#include "rtc_base/trace_event.h"
namespace webrtc {
namespace {
@@ -68,7 +69,12 @@ FrameBuffer::FrameBuffer(int max_size,
decoded_frame_history_(max_decode_history) {}
bool FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
+ const uint32_t ssrc =
+ frame->PacketInfos().empty() ? 0 : frame->PacketInfos()[0].ssrc();
if (!ValidReferences(*frame)) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Invalid references)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING) << "Frame " << frame->Id()
<< " has invalid references, dropping frame.";
return false;
@@ -78,23 +84,35 @@ bool FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
if (legacy_frame_id_jump_behavior_ && frame->is_keyframe() &&
AheadOf(frame->Timestamp(),
*decoded_frame_history_.GetLastDecodedFrameTimestamp())) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (OOO + PicId jump)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING)
<< "Keyframe " << frame->Id()
<< " has newer timestamp but older picture id, clearing buffer.";
Clear();
} else {
// Already decoded past this frame.
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Out of order)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
return false;
}
}
if (frames_.size() == max_size_) {
if (frame->is_keyframe()) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (KF + Full buffer)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING) << "Keyframe " << frame->Id()
<< " inserted into full buffer, clearing buffer.";
Clear();
} else {
// No space for this frame.
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Full buffer)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
return false;
}
}
@@ -149,16 +167,31 @@ void FrameBuffer::DropNextDecodableTemporalUnit() {
void FrameBuffer::UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
FrameIterator end_it) {
+ uint32_t dropped_ssrc = 0;
+ int64_t dropped_frame_id = 0;
unsigned int num_discarded_packets = 0;
unsigned int num_dropped_frames =
std::count_if(begin_it, end_it, [&](const auto& f) {
if (f.second.encoded_frame) {
const auto& packetInfos = f.second.encoded_frame->PacketInfos();
+ dropped_frame_id = f.first;
+ if (!packetInfos.empty()) {
+ dropped_ssrc = packetInfos[0].ssrc();
+ }
num_discarded_packets += packetInfos.size();
}
return f.second.encoded_frame != nullptr;
});
+ if (num_dropped_frames > 0) {
+ TRACE_EVENT2("webrtc", "FrameBuffer Dropping Old Frames", "remote_ssrc",
+ dropped_ssrc, "frame_id", dropped_frame_id);
+ }
+ if (num_discarded_packets > 0) {
+ TRACE_EVENT2("webrtc", "FrameBuffer Discarding Old Packets", "remote_ssrc",
+ dropped_ssrc, "frame_id", dropped_frame_id);
+ }
+
num_dropped_frames_ += num_dropped_frames;
num_discarded_packets_ += num_discarded_packets;
}
diff --git a/modules/video_coding/frame_buffer2.cc b/modules/video_coding/frame_buffer2.cc
index b289663eec..a70b143a29 100644
--- a/modules/video_coding/frame_buffer2.cc
+++ b/modules/video_coding/frame_buffer2.cc
@@ -371,9 +371,14 @@ int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
MutexLock lock(&mutex_);
+ const auto& pis = frame->PacketInfos();
int64_t last_continuous_frame_id = last_continuous_frame_.value_or(-1);
if (!ValidReferences(*frame)) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Invalid references)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING) << "Frame " << frame->Id()
<< " has invalid frame references, dropping frame.";
return last_continuous_frame_id;
@@ -381,11 +386,19 @@ int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
if (frames_.size() >= kMaxFramesBuffered) {
if (frame->is_keyframe()) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (KF + Full buffer)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING) << "Inserting keyframe " << frame->Id()
<< " but buffer is full, clearing"
" buffer and inserting the frame.";
ClearFramesAndHistory();
} else {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Full buffer)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING) << "Frame " << frame->Id()
<< " could not be inserted due to the frame "
"buffer being full, dropping frame.";
@@ -404,11 +417,19 @@ int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
// reconfiguration or some other reason. Even though this is not according
// to spec we can still continue to decode from this frame if it is a
// keyframe.
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (OOO + PicId jump)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING)
<< "A jump in frame id was detected, clearing buffer.";
ClearFramesAndHistory();
last_continuous_frame_id = -1;
} else {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Out of order)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING) << "Frame " << frame->Id() << " inserted after frame "
<< *last_decoded_frame
<< " was handed off for decoding, dropping frame.";
@@ -421,6 +442,10 @@ int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
// when the frame id make large jumps mid stream.
if (!frames_.empty() && frame->Id() < frames_.begin()->first &&
frames_.rbegin()->first < frame->Id()) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (PicId big-jump)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING) << "A jump in frame id was detected, clearing buffer.";
ClearFramesAndHistory();
last_continuous_frame_id = -1;
diff --git a/video/receive_statistics_proxy2.cc b/video/receive_statistics_proxy2.cc
index 020e4bb0ae..f5011c46ef 100644
index f5011c46ef..508c36eaaf 100644
--- a/video/receive_statistics_proxy2.cc
+++ b/video/receive_statistics_proxy2.cc
@@ -960,8 +960,13 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
}
@@ -20,6 +20,7 @@
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/thread.h"
#include "rtc_base/time_utils.h"
+#include "rtc_base/trace_event.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/metrics.h"
#include "video/video_receive_stream2.h"
@@ -921,6 +922,9 @@ void ReceiveStatisticsProxy::OnCompleteFrame(bool is_keyframe,
VideoContentType content_type) {
RTC_DCHECK_RUN_ON(&main_thread_);
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnCompleteFrame",
+ "remote_ssrc", remote_ssrc_, "is_keyframe", is_keyframe);
+
if (is_keyframe) {
++stats_.frame_counts.key_frames;
} else {
@@ -952,6 +956,8 @@ void ReceiveStatisticsProxy::OnCompleteFrame(bool is_keyframe,
void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
// Can be called on either the decode queue or the worker thread
// See FrameBuffer2 for more details.
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnDroppedFrames",
+ "remote_ssrc", remote_ssrc_, "frames_dropped", frames_dropped);
worker_thread_->PostTask(
SafeTask(task_safety_.flag(), [frames_dropped, this]() {
RTC_DCHECK_RUN_ON(&main_thread_);
@@ -962,6 +968,9 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
void ReceiveStatisticsProxy::OnDiscardedPackets(uint32_t packets_discarded) {
- RTC_DCHECK_RUN_ON(&main_thread_);
- stats_.packets_discarded += packets_discarded;
+ // Can be called on either the decode queue or the worker thread
+ // See FrameBuffer2 for more details.
+ worker_thread_->PostTask(
+ SafeTask(task_safety_.flag(), [packets_discarded, this]() {
+ RTC_DCHECK_RUN_ON(&main_thread_);
+ stats_.packets_discarded += packets_discarded;
+ }));
// Can be called on either the decode queue or the worker thread
// See FrameBuffer2 for more details.
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnDiscardedPackets",
+ "remote_ssrc", remote_ssrc_, "packets_discarded",
+ packets_discarded);
worker_thread_->PostTask(
SafeTask(task_safety_.flag(), [packets_discarded, this]() {
RTC_DCHECK_RUN_ON(&main_thread_);
@@ -991,6 +1000,8 @@ void ReceiveStatisticsProxy::OnStreamInactive() {
void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms) {
RTC_DCHECK_RUN_ON(&main_thread_);
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnRttUpdate",
+ "remote_ssrc", remote_ssrc_, "avg_rtt_ms", avg_rtt_ms);
avg_rtt_ms_ = avg_rtt_ms;
}
void ReceiveStatisticsProxy::OnPreDecode(VideoCodecType codec_type, int qp) {
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 46998b6d7c..a5d5f637e5 100644
index a5d5f637e5..eb0a7787ac 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -1222,7 +1222,9 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
packet_infos_.erase(packet_infos_.begin(),
@@ -44,6 +44,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
+#include "rtc_base/trace_event.h"
#include "system_wrappers/include/metrics.h"
#include "system_wrappers/include/ntp_time.h"
@@ -1223,6 +1224,9 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
packet_infos_.upper_bound(unwrapped_rtp_seq_num));
uint32_t num_packets_cleared = packet_buffer_.ClearTo(seq_num);
- vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
+ if (num_packets_cleared > 0) {
+ vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
+ }
if (num_packets_cleared > 0) {
+ TRACE_EVENT2("webrtc",
+ "RtpVideoStreamReceiver2::FrameDecoded Cleared Old Packets",
+ "remote_ssrc", config_.rtp.remote_ssrc, "seq_num", seq_num);
vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
}
reference_finder_->ClearTo(seq_num);
diff --git a/video/video_stream_buffer_controller.cc b/video/video_stream_buffer_controller.cc
index 7e44eff39a..37724a8338 100644
--- a/video/video_stream_buffer_controller.cc
+++ b/video/video_stream_buffer_controller.cc
@@ -28,6 +28,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread_annotations.h"
+#include "rtc_base/trace_event.h"
#include "video/frame_decode_scheduler.h"
#include "video/frame_decode_timing.h"
#include "video/task_queue_frame_decode_scheduler.h"
@@ -139,6 +140,9 @@ absl::optional<int64_t> VideoStreamBufferController::InsertFrame(
std::unique_ptr<EncodedFrame> frame) {
RTC_DCHECK_RUN_ON(&worker_sequence_checker_);
FrameMetadata metadata(*frame);
+ const uint32_t ssrc =
+ frame->PacketInfos().empty() ? 0 : frame->PacketInfos()[0].ssrc();
+ const int64_t frameId = frame->Id();
int complete_units = buffer_->GetTotalNumberOfContinuousTemporalUnits();
if (buffer_->InsertFrame(std::move(frame))) {
RTC_DCHECK(metadata.receive_time) << "Frame receive time must be set!";
@@ -149,6 +153,9 @@ absl::optional<int64_t> VideoStreamBufferController::InsertFrame(
*metadata.receive_time);
}
}
if (complete_units < buffer_->GetTotalNumberOfContinuousTemporalUnits()) {
+ TRACE_EVENT2("webrtc",
+ "VideoStreamBufferController::InsertFrame Frame Complete",
+ "remote_ssrc", ssrc, "frame_id", frameId);
stats_proxy_->OnCompleteFrame(metadata.is_keyframe, metadata.size,
metadata.contentType);
MaybeScheduleFrameForRelease();
--
2.34.1

Просмотреть файл

@ -1,295 +1,30 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Thu, 6 Jan 2022 00:16:00 +0000
Subject: Bug 1748458 - Add TRACE_EVENTs for dropped frames and packets for
received video. r=bwc
Subject: Bug 1748458 - Add TRACE_EVENT for keyframe requests. r=bwc
This lets us see in the profiler how many received frames and packets we decide
to drop and the reasons why.
Differential Revision: https://phabricator.services.mozilla.com/D135062
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/08e252da94c4752eccfd845eef13d8517953cc6a
Also includes:
Bug 1804288 - (fix-de7ae5755b) reimplement Bug 1748458 - Add TRACE_EVENTs for dropped frames and packets for received video. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D163960
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/8e9a326a99cd5eaa6e447ff57c01ad9d79a09744
Differential Revision: https://phabricator.services.mozilla.com/D135113
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5b2a7894ef1cf096d0e8977754507c0820e757fc
---
api/video/frame_buffer.cc | 33 +++++++++++++++++++++++++
modules/video_coding/frame_buffer2.cc | 25 +++++++++++++++++++
video/receive_statistics_proxy2.cc | 11 +++++++++
video/rtp_video_stream_receiver2.cc | 4 +++
video/video_stream_buffer_controller.cc | 7 ++++++
5 files changed, 80 insertions(+)
diff --git a/api/video/frame_buffer.cc b/api/video/frame_buffer.cc
index 8267b8e6cb..f5d93f5f76 100644
--- a/api/video/frame_buffer.cc
+++ b/api/video/frame_buffer.cc
@@ -16,6 +16,7 @@
#include "absl/container/inlined_vector.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/sequence_number_util.h"
+#include "rtc_base/trace_event.h"
namespace webrtc {
namespace {
@@ -68,7 +69,12 @@ FrameBuffer::FrameBuffer(int max_size,
decoded_frame_history_(max_decode_history) {}
bool FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
+ const uint32_t ssrc =
+ frame->PacketInfos().empty() ? 0 : frame->PacketInfos()[0].ssrc();
if (!ValidReferences(*frame)) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Invalid references)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING) << "Frame " << frame->Id()
<< " has invalid references, dropping frame.";
return false;
@@ -78,23 +84,35 @@ bool FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
if (legacy_frame_id_jump_behavior_ && frame->is_keyframe() &&
AheadOf(frame->Timestamp(),
*decoded_frame_history_.GetLastDecodedFrameTimestamp())) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (OOO + PicId jump)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING)
<< "Keyframe " << frame->Id()
<< " has newer timestamp but older picture id, clearing buffer.";
Clear();
} else {
// Already decoded past this frame.
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Out of order)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
return false;
}
}
if (frames_.size() == max_size_) {
if (frame->is_keyframe()) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (KF + Full buffer)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
RTC_DLOG(LS_WARNING) << "Keyframe " << frame->Id()
<< " inserted into full buffer, clearing buffer.";
Clear();
} else {
// No space for this frame.
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Full buffer)",
+ "remote_ssrc", ssrc, "frame_id", frame->Id());
return false;
}
}
@@ -149,16 +167,31 @@ void FrameBuffer::DropNextDecodableTemporalUnit() {
void FrameBuffer::UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it,
FrameIterator end_it) {
+ uint32_t dropped_ssrc = 0;
+ int64_t dropped_frame_id = 0;
unsigned int num_discarded_packets = 0;
unsigned int num_dropped_frames =
std::count_if(begin_it, end_it, [&](const auto& f) {
if (f.second.encoded_frame) {
const auto& packetInfos = f.second.encoded_frame->PacketInfos();
+ dropped_frame_id = f.first;
+ if (!packetInfos.empty()) {
+ dropped_ssrc = packetInfos[0].ssrc();
+ }
num_discarded_packets += packetInfos.size();
}
return f.second.encoded_frame != nullptr;
});
+ if (num_dropped_frames > 0) {
+ TRACE_EVENT2("webrtc", "FrameBuffer Dropping Old Frames", "remote_ssrc",
+ dropped_ssrc, "frame_id", dropped_frame_id);
+ }
+ if (num_discarded_packets > 0) {
+ TRACE_EVENT2("webrtc", "FrameBuffer Discarding Old Packets", "remote_ssrc",
+ dropped_ssrc, "frame_id", dropped_frame_id);
+ }
+
num_dropped_frames_ += num_dropped_frames;
num_discarded_packets_ += num_discarded_packets;
}
diff --git a/modules/video_coding/frame_buffer2.cc b/modules/video_coding/frame_buffer2.cc
index b289663eec..a70b143a29 100644
--- a/modules/video_coding/frame_buffer2.cc
+++ b/modules/video_coding/frame_buffer2.cc
@@ -371,9 +371,14 @@ int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
MutexLock lock(&mutex_);
+ const auto& pis = frame->PacketInfos();
int64_t last_continuous_frame_id = last_continuous_frame_.value_or(-1);
if (!ValidReferences(*frame)) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Invalid references)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING) << "Frame " << frame->Id()
<< " has invalid frame references, dropping frame.";
return last_continuous_frame_id;
@@ -381,11 +386,19 @@ int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
if (frames_.size() >= kMaxFramesBuffered) {
if (frame->is_keyframe()) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (KF + Full buffer)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING) << "Inserting keyframe " << frame->Id()
<< " but buffer is full, clearing"
" buffer and inserting the frame.";
ClearFramesAndHistory();
} else {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Full buffer)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING) << "Frame " << frame->Id()
<< " could not be inserted due to the frame "
"buffer being full, dropping frame.";
@@ -404,11 +417,19 @@ int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
// reconfiguration or some other reason. Even though this is not according
// to spec we can still continue to decode from this frame if it is a
// keyframe.
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (OOO + PicId jump)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING)
<< "A jump in frame id was detected, clearing buffer.";
ClearFramesAndHistory();
last_continuous_frame_id = -1;
} else {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frame dropped (Out of order)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING) << "Frame " << frame->Id() << " inserted after frame "
<< *last_decoded_frame
<< " was handed off for decoding, dropping frame.";
@@ -421,6 +442,10 @@ int64_t FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) {
// when the frame id make large jumps mid stream.
if (!frames_.empty() && frame->Id() < frames_.begin()->first &&
frames_.rbegin()->first < frame->Id()) {
+ TRACE_EVENT2("webrtc",
+ "FrameBuffer::InsertFrame Frames dropped (PicId big-jump)",
+ "remote_ssrc", pis.empty() ? 0 : pis[0].ssrc(), "picture_id",
+ frame->Id());
RTC_LOG(LS_WARNING) << "A jump in frame id was detected, clearing buffer.";
ClearFramesAndHistory();
last_continuous_frame_id = -1;
diff --git a/video/receive_statistics_proxy2.cc b/video/receive_statistics_proxy2.cc
index f5011c46ef..508c36eaaf 100644
--- a/video/receive_statistics_proxy2.cc
+++ b/video/receive_statistics_proxy2.cc
@@ -20,6 +20,7 @@
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/thread.h"
#include "rtc_base/time_utils.h"
+#include "rtc_base/trace_event.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/metrics.h"
#include "video/video_receive_stream2.h"
@@ -921,6 +922,9 @@ void ReceiveStatisticsProxy::OnCompleteFrame(bool is_keyframe,
VideoContentType content_type) {
RTC_DCHECK_RUN_ON(&main_thread_);
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnCompleteFrame",
+ "remote_ssrc", remote_ssrc_, "is_keyframe", is_keyframe);
+
if (is_keyframe) {
++stats_.frame_counts.key_frames;
} else {
@@ -952,6 +956,8 @@ void ReceiveStatisticsProxy::OnCompleteFrame(bool is_keyframe,
void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
// Can be called on either the decode queue or the worker thread
// See FrameBuffer2 for more details.
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnDroppedFrames",
+ "remote_ssrc", remote_ssrc_, "frames_dropped", frames_dropped);
worker_thread_->PostTask(
SafeTask(task_safety_.flag(), [frames_dropped, this]() {
RTC_DCHECK_RUN_ON(&main_thread_);
@@ -962,6 +968,9 @@ void ReceiveStatisticsProxy::OnDroppedFrames(uint32_t frames_dropped) {
void ReceiveStatisticsProxy::OnDiscardedPackets(uint32_t packets_discarded) {
// Can be called on either the decode queue or the worker thread
// See FrameBuffer2 for more details.
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnDiscardedPackets",
+ "remote_ssrc", remote_ssrc_, "packets_discarded",
+ packets_discarded);
worker_thread_->PostTask(
SafeTask(task_safety_.flag(), [packets_discarded, this]() {
RTC_DCHECK_RUN_ON(&main_thread_);
@@ -991,6 +1000,8 @@ void ReceiveStatisticsProxy::OnStreamInactive() {
void ReceiveStatisticsProxy::OnRttUpdate(int64_t avg_rtt_ms) {
RTC_DCHECK_RUN_ON(&main_thread_);
+ TRACE_EVENT2("webrtc", "ReceiveStatisticsProxy::OnRttUpdate",
+ "remote_ssrc", remote_ssrc_, "avg_rtt_ms", avg_rtt_ms);
avg_rtt_ms_ = avg_rtt_ms;
}
video/rtp_video_stream_receiver2.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index a5d5f637e5..eb0a7787ac 100644
index eb0a7787ac..8055ac0e0f 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -44,6 +44,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
+#include "rtc_base/trace_event.h"
#include "system_wrappers/include/metrics.h"
#include "system_wrappers/include/ntp_time.h"
@@ -735,6 +735,12 @@ void RtpVideoStreamReceiver2::OnRtpPacket(const RtpPacketReceived& packet) {
@@ -1223,6 +1224,9 @@ void RtpVideoStreamReceiver2::FrameDecoded(int64_t picture_id) {
packet_infos_.upper_bound(unwrapped_rtp_seq_num));
uint32_t num_packets_cleared = packet_buffer_.ClearTo(seq_num);
if (num_packets_cleared > 0) {
+ TRACE_EVENT2("webrtc",
+ "RtpVideoStreamReceiver2::FrameDecoded Cleared Old Packets",
+ "remote_ssrc", config_.rtp.remote_ssrc, "seq_num", seq_num);
vcm_receive_statistics_->OnDiscardedPackets(num_packets_cleared);
}
reference_finder_->ClearTo(seq_num);
diff --git a/video/video_stream_buffer_controller.cc b/video/video_stream_buffer_controller.cc
index 7e44eff39a..37724a8338 100644
--- a/video/video_stream_buffer_controller.cc
+++ b/video/video_stream_buffer_controller.cc
@@ -28,6 +28,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread_annotations.h"
+#include "rtc_base/trace_event.h"
#include "video/frame_decode_scheduler.h"
#include "video/frame_decode_timing.h"
#include "video/task_queue_frame_decode_scheduler.h"
@@ -139,6 +140,9 @@ absl::optional<int64_t> VideoStreamBufferController::InsertFrame(
std::unique_ptr<EncodedFrame> frame) {
RTC_DCHECK_RUN_ON(&worker_sequence_checker_);
FrameMetadata metadata(*frame);
+ const uint32_t ssrc =
+ frame->PacketInfos().empty() ? 0 : frame->PacketInfos()[0].ssrc();
+ const int64_t frameId = frame->Id();
int complete_units = buffer_->GetTotalNumberOfContinuousTemporalUnits();
if (buffer_->InsertFrame(std::move(frame))) {
RTC_DCHECK(metadata.receive_time) << "Frame receive time must be set!";
@@ -149,6 +153,9 @@ absl::optional<int64_t> VideoStreamBufferController::InsertFrame(
*metadata.receive_time);
}
if (complete_units < buffer_->GetTotalNumberOfContinuousTemporalUnits()) {
+ TRACE_EVENT2("webrtc",
+ "VideoStreamBufferController::InsertFrame Frame Complete",
+ "remote_ssrc", ssrc, "frame_id", frameId);
stats_proxy_->OnCompleteFrame(metadata.is_keyframe, metadata.size,
metadata.contentType);
MaybeScheduleFrameForRelease();
void RtpVideoStreamReceiver2::RequestKeyFrame() {
RTC_DCHECK_RUN_ON(&worker_task_checker_);
+ TRACE_EVENT2("webrtc", "RtpVideoStreamReceiver2::RequestKeyFrame",
+ "remote_ssrc", config_.rtp.remote_ssrc, "method",
+ keyframe_request_method_ == KeyFrameReqMethod::kPliRtcp ? "PLI"
+ : keyframe_request_method_ == KeyFrameReqMethod::kFirRtcp ? "FIR"
+ : keyframe_request_method_ == KeyFrameReqMethod::kNone ? "None"
+ : "Other");
// TODO(bugs.webrtc.org/10336): Allow the sender to ignore key frame requests
// issued by anything other than the LossNotificationController if it (the
// sender) is relying on LNTF alone.
--
2.34.1

Просмотреть файл

@ -1,30 +1,45 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Thu, 6 Jan 2022 00:16:00 +0000
Subject: Bug 1748458 - Add TRACE_EVENT for keyframe requests. r=bwc
Date: Wed, 11 Jan 2023 22:42:00 +0000
Subject: Bug 1800942 - Add DCHECKs to
TimestampExtrapolator::ExtrapolateLocalTime. r=mjf
Differential Revision: https://phabricator.services.mozilla.com/D135113
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5b2a7894ef1cf096d0e8977754507c0820e757fc
Differential Revision: https://phabricator.services.mozilla.com/D166536
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c5df7f40392464ffc63f44a53ddcaab2091741e0
---
video/rtp_video_stream_receiver2.cc | 6 ++++++
1 file changed, 6 insertions(+)
modules/video_coding/timing/timestamp_extrapolator.cc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index eb0a7787ac..8055ac0e0f 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -735,6 +735,12 @@ void RtpVideoStreamReceiver2::OnRtpPacket(const RtpPacketReceived& packet) {
diff --git a/modules/video_coding/timing/timestamp_extrapolator.cc b/modules/video_coding/timing/timestamp_extrapolator.cc
index c91aa1a362..dc62ac674a 100644
--- a/modules/video_coding/timing/timestamp_extrapolator.cc
+++ b/modules/video_coding/timing/timestamp_extrapolator.cc
@@ -125,6 +125,7 @@ void TimestampExtrapolator::Update(Timestamp now, uint32_t ts90khz) {
absl::optional<Timestamp> TimestampExtrapolator::ExtrapolateLocalTime(
uint32_t timestamp90khz) const {
int64_t unwrapped_ts90khz = unwrapper_.PeekUnwrap(timestamp90khz);
+ RTC_DCHECK_GE(unwrapped_ts90khz, 0);
void RtpVideoStreamReceiver2::RequestKeyFrame() {
RTC_DCHECK_RUN_ON(&worker_task_checker_);
+ TRACE_EVENT2("webrtc", "RtpVideoStreamReceiver2::RequestKeyFrame",
+ "remote_ssrc", config_.rtp.remote_ssrc, "method",
+ keyframe_request_method_ == KeyFrameReqMethod::kPliRtcp ? "PLI"
+ : keyframe_request_method_ == KeyFrameReqMethod::kFirRtcp ? "FIR"
+ : keyframe_request_method_ == KeyFrameReqMethod::kNone ? "None"
+ : "Other");
// TODO(bugs.webrtc.org/10336): Allow the sender to ignore key frame requests
// issued by anything other than the LossNotificationController if it (the
// sender) is relying on LNTF alone.
if (!first_unwrapped_timestamp_) {
return absl::nullopt;
@@ -132,12 +133,18 @@ absl::optional<Timestamp> TimestampExtrapolator::ExtrapolateLocalTime(
constexpr double kRtpTicksPerMs = 90;
TimeDelta diff = TimeDelta::Millis(
(unwrapped_ts90khz - *prev_unwrapped_timestamp_) / kRtpTicksPerMs);
+ if (diff.ms() < 0) {
+ RTC_DCHECK_GE(prev_.ms(), -diff.ms());
+ }
return prev_ + diff;
} else if (w_[0] < 1e-3) {
return start_;
} else {
double timestampDiff = unwrapped_ts90khz - *first_unwrapped_timestamp_;
auto diff_ms = static_cast<int64_t>((timestampDiff - w_[1]) / w_[0] + 0.5);
+ if (diff_ms < 0) {
+ RTC_DCHECK_GE(start_.ms(), -diff_ms);
+ }
return start_ + TimeDelta::Millis(diff_ms);
}
}
--
2.34.1

Просмотреть файл

@ -1,45 +1,28 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Wed, 11 Jan 2023 22:42:00 +0000
Subject: Bug 1800942 - Add DCHECKs to
TimestampExtrapolator::ExtrapolateLocalTime. r=mjf
Date: Wed, 8 Feb 2023 08:01:00 +0000
Subject: Bug 1814692 - Don't attempt realtime scheduling rtc::PlatformThreads.
r=webrtc-reviewers,bwc
Differential Revision: https://phabricator.services.mozilla.com/D166536
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c5df7f40392464ffc63f44a53ddcaab2091741e0
Differential Revision: https://phabricator.services.mozilla.com/D169036
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/9e64a965e26c8379261466e5273c3b383164b2c7
---
modules/video_coding/timing/timestamp_extrapolator.cc | 7 +++++++
1 file changed, 7 insertions(+)
rtc_base/platform_thread.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/modules/video_coding/timing/timestamp_extrapolator.cc b/modules/video_coding/timing/timestamp_extrapolator.cc
index c91aa1a362..dc62ac674a 100644
--- a/modules/video_coding/timing/timestamp_extrapolator.cc
+++ b/modules/video_coding/timing/timestamp_extrapolator.cc
@@ -125,6 +125,7 @@ void TimestampExtrapolator::Update(Timestamp now, uint32_t ts90khz) {
absl::optional<Timestamp> TimestampExtrapolator::ExtrapolateLocalTime(
uint32_t timestamp90khz) const {
int64_t unwrapped_ts90khz = unwrapper_.PeekUnwrap(timestamp90khz);
+ RTC_DCHECK_GE(unwrapped_ts90khz, 0);
if (!first_unwrapped_timestamp_) {
return absl::nullopt;
@@ -132,12 +133,18 @@ absl::optional<Timestamp> TimestampExtrapolator::ExtrapolateLocalTime(
constexpr double kRtpTicksPerMs = 90;
TimeDelta diff = TimeDelta::Millis(
(unwrapped_ts90khz - *prev_unwrapped_timestamp_) / kRtpTicksPerMs);
+ if (diff.ms() < 0) {
+ RTC_DCHECK_GE(prev_.ms(), -diff.ms());
+ }
return prev_ + diff;
} else if (w_[0] < 1e-3) {
return start_;
} else {
double timestampDiff = unwrapped_ts90khz - *first_unwrapped_timestamp_;
auto diff_ms = static_cast<int64_t>((timestampDiff - w_[1]) / w_[0] + 0.5);
+ if (diff_ms < 0) {
+ RTC_DCHECK_GE(start_.ms(), -diff_ms);
+ }
return start_ + TimeDelta::Millis(diff_ms);
}
}
diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc
index 71a9f1b224..bcbb784b97 100644
--- a/rtc_base/platform_thread.cc
+++ b/rtc_base/platform_thread.cc
@@ -50,6 +50,9 @@ bool SetPriority(ThreadPriority priority) {
// TODO(tommi): Switch to the same mechanism as Chromium uses for changing
// thread priorities.
return true;
+#elif defined(WEBRTC_MOZILLA_BUILD) && defined(WEBRTC_LINUX)
+ // Only realtime audio uses realtime scheduling in Firefox.
+ return true;
#else
const int policy = SCHED_FIFO;
const int min_prio = sched_get_priority_min(policy);
--
2.34.1

Просмотреть файл

@ -1,28 +1,34 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Wed, 8 Feb 2023 08:01:00 +0000
Subject: Bug 1814692 - Don't attempt realtime scheduling rtc::PlatformThreads.
r=webrtc-reviewers,bwc
Date: Fri, 24 Feb 2023 15:01:00 +0100
Subject: Bug 1817024 - (fix-0e2cf6cc01) Skip library
create_peer_connection_quality_test_frame_generator. r?mjf!
Differential Revision: https://phabricator.services.mozilla.com/D169036
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/9e64a965e26c8379261466e5273c3b383164b2c7
Differential Revision: https://phabricator.services.mozilla.com/D170887
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/fbbc1bf963fda30bca26ae6aac0c3459b8ebea6f
---
rtc_base/platform_thread.cc | 3 +++
1 file changed, 3 insertions(+)
api/BUILD.gn | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc
index 71a9f1b224..bcbb784b97 100644
--- a/rtc_base/platform_thread.cc
+++ b/rtc_base/platform_thread.cc
@@ -50,6 +50,9 @@ bool SetPriority(ThreadPriority priority) {
// TODO(tommi): Switch to the same mechanism as Chromium uses for changing
// thread priorities.
return true;
+#elif defined(WEBRTC_MOZILLA_BUILD) && defined(WEBRTC_LINUX)
+ // Only realtime audio uses realtime scheduling in Firefox.
+ return true;
#else
const int policy = SCHED_FIFO;
const int min_prio = sched_get_priority_min(policy);
diff --git a/api/BUILD.gn b/api/BUILD.gn
index ab5d6c91ce..3f313e2743 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -702,6 +702,7 @@ rtc_library("create_frame_generator") {
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+if (!build_with_mozilla) {
rtc_library("create_peer_connection_quality_test_frame_generator") {
visibility = [ "*" ]
testonly = true
@@ -718,6 +719,7 @@ rtc_library("create_peer_connection_quality_test_frame_generator") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+}
rtc_source_set("libjingle_logging_api") {
visibility = [ "*" ]
--
2.34.1

Просмотреть файл

@ -1,34 +1,189 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Fri, 24 Feb 2023 15:01:00 +0100
Subject: Bug 1817024 - (fix-0e2cf6cc01) Skip library
create_peer_connection_quality_test_frame_generator. r?mjf!
From: Michael Froman <mfroman@mozilla.com>
Date: Wed, 8 Mar 2023 00:26:00 +0000
Subject: Bug 1820869 - avoid building unreachable files. r=ng,webrtc-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D170887
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/fbbc1bf963fda30bca26ae6aac0c3459b8ebea6f
Differential Revision: https://phabricator.services.mozilla.com/D171922
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/88b3cc6bbece7c53d00e124713330f3d34d2789d
---
api/BUILD.gn | 2 ++
1 file changed, 2 insertions(+)
BUILD.gn | 9 +++++++++
call/BUILD.gn | 10 ++++++++++
media/BUILD.gn | 7 ++++++-
modules/audio_device/BUILD.gn | 11 ++++++++++-
rtc_base/BUILD.gn | 2 ++
webrtc.gni | 2 +-
6 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/api/BUILD.gn b/api/BUILD.gn
index ab5d6c91ce..3f313e2743 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -702,6 +702,7 @@ rtc_library("create_frame_generator") {
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
diff --git a/BUILD.gn b/BUILD.gn
index 6515866c2d..465c4d9bfd 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -549,6 +549,15 @@ if (!build_with_chromium) {
"api/video:video_rtp_headers",
"test:rtp_test_utils",
]
+ # Added when we removed deps in other places to avoid building
+ # unreachable sources. See Bug 1820869.
+ deps += [
+ "api/video_codecs:video_codecs_api",
+ "api/video_codecs:rtc_software_fallback_wrappers",
+ "media:rtc_encoder_simulcast_proxy",
+ "modules/video_coding:webrtc_vp8",
+ "modules/video_coding:webrtc_vp9",
+ ]
} else {
deps += [
"api",
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 26618aee80..fb23b7ef39 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -352,6 +352,16 @@ rtc_library("call") {
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
+ if (build_with_mozilla) { # See Bug 1820869.
+ sources -= [
+ "call_factory.cc",
+ "degraded_call.cc",
+ ]
+ deps -= [
+ ":fake_network",
+ ":simulated_network",
+ ]
+ }
}
+if (!build_with_mozilla) {
rtc_library("create_peer_connection_quality_test_frame_generator") {
visibility = [ "*" ]
testonly = true
@@ -718,6 +719,7 @@ rtc_library("create_peer_connection_quality_test_frame_generator") {
rtc_source_set("receive_stream_interface") {
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 4ddc8349a8..daca67e033 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -442,7 +442,10 @@ rtc_library("rtc_internal_video_codecs") {
"../test:fake_video_codecs",
]
if (build_with_mozilla) {
- deps -= [ "../test:fake_video_codecs" ]
+ deps -= [
+ "../modules/video_coding:webrtc_multiplex", # See Bug 1820869.
+ "../test:fake_video_codecs",
+ ]
}
if (enable_libaom) {
@@ -477,6 +480,8 @@ rtc_library("rtc_internal_video_codecs") {
sources -= [
"engine/fake_video_codec_factory.cc",
"engine/fake_video_codec_factory.h",
+ "engine/internal_encoder_factory.cc", # See Bug 1820869.
+ "engine/multiplex_codec_factory.cc", # See Bug 1820869.
]
}
}
diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn
index e35a442025..61cd531edd 100644
--- a/modules/audio_device/BUILD.gn
+++ b/modules/audio_device/BUILD.gn
@@ -30,6 +30,7 @@ rtc_source_set("audio_device_default") {
}
rtc_source_set("audio_device") {
+if (!build_with_mozilla) { # See Bug 1820869.
visibility = [ "*" ]
public_deps = [
":audio_device_api",
@@ -40,6 +41,7 @@ rtc_source_set("audio_device") {
":audio_device_impl",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+}
rtc_source_set("libjingle_logging_api") {
rtc_source_set("audio_device_api") {
visibility = [ "*" ]
@@ -58,6 +60,7 @@ rtc_source_set("audio_device_api") {
}
rtc_library("audio_device_buffer") {
+if (!build_with_mozilla) { # See Bug 1820869.
sources = [
"audio_device_buffer.cc",
"audio_device_buffer.h",
@@ -85,6 +88,7 @@ rtc_library("audio_device_buffer") {
"../../system_wrappers:metrics",
]
}
+}
rtc_library("audio_device_generic") {
sources = [
@@ -180,6 +184,7 @@ rtc_source_set("audio_device_module_from_input_and_output") {
# Contains default implementations of webrtc::AudioDeviceModule for Windows,
# Linux, Mac, iOS and Android.
rtc_library("audio_device_impl") {
+if (!build_with_mozilla) { # See Bug 1820869.
visibility = [ "*" ]
deps = [
":audio_device_api",
@@ -373,6 +378,7 @@ rtc_library("audio_device_impl") {
]
}
}
+}
if (is_mac) {
rtc_source_set("audio_device_impl_frameworks") {
@@ -390,6 +396,7 @@ if (is_mac) {
}
}
+if (!build_with_mozilla) { # See Bug 1820869.
rtc_source_set("mock_audio_device") {
visibility = [ "*" ]
testonly = true
@@ -406,8 +413,10 @@ rtc_source_set("mock_audio_device") {
"../../test:test_support",
]
}
+}
-if (rtc_include_tests && !build_with_chromium) {
+# See Bug 1820869 for !build_with_mozilla.
+if (rtc_include_tests && !build_with_chromium && !build_with_mozilla) {
rtc_library("audio_device_unittests") {
testonly = true
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 3cd0bfff06..0b1e2a6208 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -283,6 +283,7 @@ rtc_library("sample_counter") {
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+if (!build_with_mozilla) { # See Bug 1820869.
rtc_library("timestamp_aligner") {
visibility = [ "*" ]
sources = [
@@ -296,6 +297,7 @@ rtc_library("timestamp_aligner") {
"system:rtc_export",
]
}
+}
rtc_library("zero_memory") {
visibility = [ "*" ]
diff --git a/webrtc.gni b/webrtc.gni
index 1b21d329b2..46a9433141 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -221,7 +221,7 @@ declare_args() {
# video codecs they depends on will not be included in libwebrtc.{a|lib}
# (they will still be included in libjingle_peerconnection_so.so and
# WebRTC.framework)
- rtc_include_builtin_video_codecs = true
+ rtc_include_builtin_video_codecs = !build_with_mozilla # See Bug 1820869.
# When set to true and in a standalone build, it will undefine UNICODE and
# _UNICODE (which are always defined globally by the Chromium Windows
--
2.34.1

Просмотреть файл

@ -1,189 +1,34 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Wed, 8 Mar 2023 00:26:00 +0000
Subject: Bug 1820869 - avoid building unreachable files. r=ng,webrtc-reviewers
Date: Wed, 12 Apr 2023 16:03:00 +0000
Subject: Bug 1826428 - remove libwebrtc's jvm_android.cc from build
r=ng,webrtc-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D171922
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/88b3cc6bbece7c53d00e124713330f3d34d2789d
Based on info from John Lin and previous try runs, we're almost
certainly not using this. Let's try removing it from the build
and landing it. If no problems emerge, we'll be able to remove
our custom changes to upstream code in jvm_android.cc.
Differential Revision: https://phabricator.services.mozilla.com/D174793
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/dca1b97525487ae57d43ced1ebdb4a2d9c9dae89
---
BUILD.gn | 9 +++++++++
call/BUILD.gn | 10 ++++++++++
media/BUILD.gn | 7 ++++++-
modules/audio_device/BUILD.gn | 11 ++++++++++-
rtc_base/BUILD.gn | 2 ++
webrtc.gni | 2 +-
6 files changed, 38 insertions(+), 3 deletions(-)
modules/utility/BUILD.gn | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/BUILD.gn b/BUILD.gn
index 6515866c2d..465c4d9bfd 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -549,6 +549,15 @@ if (!build_with_chromium) {
"api/video:video_rtp_headers",
"test:rtp_test_utils",
diff --git a/modules/utility/BUILD.gn b/modules/utility/BUILD.gn
index 3fe4ca8c92..46bca17f02 100644
--- a/modules/utility/BUILD.gn
+++ b/modules/utility/BUILD.gn
@@ -47,6 +47,10 @@ rtc_source_set("utility") {
"../../rtc_base:platform_thread",
"../../rtc_base/system:arch",
]
+ # Added when we removed deps in other places to avoid building
+ # unreachable sources. See Bug 1820869.
+ deps += [
+ "api/video_codecs:video_codecs_api",
+ "api/video_codecs:rtc_software_fallback_wrappers",
+ "media:rtc_encoder_simulcast_proxy",
+ "modules/video_coding:webrtc_vp8",
+ "modules/video_coding:webrtc_vp9",
+ ]
} else {
deps += [
"api",
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 26618aee80..fb23b7ef39 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -352,6 +352,16 @@ rtc_library("call") {
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
+ if (build_with_mozilla) { # See Bug 1820869.
+ sources -= [
+ "call_factory.cc",
+ "degraded_call.cc",
+ ]
+ deps -= [
+ ":fake_network",
+ ":simulated_network",
+ ]
+
+ if (build_with_mozilla) {
+ sources -= [ "source/jvm_android.cc" ]
+ }
}
rtc_source_set("receive_stream_interface") {
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 4ddc8349a8..daca67e033 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -442,7 +442,10 @@ rtc_library("rtc_internal_video_codecs") {
"../test:fake_video_codecs",
]
if (build_with_mozilla) {
- deps -= [ "../test:fake_video_codecs" ]
+ deps -= [
+ "../modules/video_coding:webrtc_multiplex", # See Bug 1820869.
+ "../test:fake_video_codecs",
+ ]
}
if (enable_libaom) {
@@ -477,6 +480,8 @@ rtc_library("rtc_internal_video_codecs") {
sources -= [
"engine/fake_video_codec_factory.cc",
"engine/fake_video_codec_factory.h",
+ "engine/internal_encoder_factory.cc", # See Bug 1820869.
+ "engine/multiplex_codec_factory.cc", # See Bug 1820869.
]
}
}
diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn
index e35a442025..61cd531edd 100644
--- a/modules/audio_device/BUILD.gn
+++ b/modules/audio_device/BUILD.gn
@@ -30,6 +30,7 @@ rtc_source_set("audio_device_default") {
}
rtc_source_set("audio_device") {
+if (!build_with_mozilla) { # See Bug 1820869.
visibility = [ "*" ]
public_deps = [
":audio_device_api",
@@ -40,6 +41,7 @@ rtc_source_set("audio_device") {
":audio_device_impl",
]
}
+}
rtc_source_set("audio_device_api") {
visibility = [ "*" ]
@@ -58,6 +60,7 @@ rtc_source_set("audio_device_api") {
}
rtc_library("audio_device_buffer") {
+if (!build_with_mozilla) { # See Bug 1820869.
sources = [
"audio_device_buffer.cc",
"audio_device_buffer.h",
@@ -85,6 +88,7 @@ rtc_library("audio_device_buffer") {
"../../system_wrappers:metrics",
]
}
+}
rtc_library("audio_device_generic") {
sources = [
@@ -180,6 +184,7 @@ rtc_source_set("audio_device_module_from_input_and_output") {
# Contains default implementations of webrtc::AudioDeviceModule for Windows,
# Linux, Mac, iOS and Android.
rtc_library("audio_device_impl") {
+if (!build_with_mozilla) { # See Bug 1820869.
visibility = [ "*" ]
deps = [
":audio_device_api",
@@ -373,6 +378,7 @@ rtc_library("audio_device_impl") {
]
}
}
+}
if (is_mac) {
rtc_source_set("audio_device_impl_frameworks") {
@@ -390,6 +396,7 @@ if (is_mac) {
}
}
+if (!build_with_mozilla) { # See Bug 1820869.
rtc_source_set("mock_audio_device") {
visibility = [ "*" ]
testonly = true
@@ -406,8 +413,10 @@ rtc_source_set("mock_audio_device") {
"../../test:test_support",
]
}
+}
-if (rtc_include_tests && !build_with_chromium) {
+# See Bug 1820869 for !build_with_mozilla.
+if (rtc_include_tests && !build_with_chromium && !build_with_mozilla) {
rtc_library("audio_device_unittests") {
testonly = true
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 3cd0bfff06..0b1e2a6208 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -283,6 +283,7 @@ rtc_library("sample_counter") {
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+if (!build_with_mozilla) { # See Bug 1820869.
rtc_library("timestamp_aligner") {
visibility = [ "*" ]
sources = [
@@ -296,6 +297,7 @@ rtc_library("timestamp_aligner") {
"system:rtc_export",
]
}
+}
rtc_library("zero_memory") {
visibility = [ "*" ]
diff --git a/webrtc.gni b/webrtc.gni
index 1b21d329b2..46a9433141 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -221,7 +221,7 @@ declare_args() {
# video codecs they depends on will not be included in libwebrtc.{a|lib}
# (they will still be included in libjingle_peerconnection_so.so and
# WebRTC.framework)
- rtc_include_builtin_video_codecs = true
+ rtc_include_builtin_video_codecs = !build_with_mozilla # See Bug 1820869.
# When set to true and in a standalone build, it will undefine UNICODE and
# _UNICODE (which are always defined globally by the Chromium Windows
--
2.34.1

Просмотреть файл

@ -1,31 +1,166 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Wed, 12 Apr 2023 16:03:00 +0000
Subject: Bug 1826428 - remove libwebrtc's jvm_android.cc from build
r=ng,webrtc-reviewers
From: Jan Grulich <jgrulich@redhat.com>
Date: Mon, 20 Feb 2023 21:25:00 +0000
Subject: Bug 1817263 - fix OS picker behavior under Wayland r=ng,jib,stransky
Based on info from John Lin and previous try runs, we're almost
certainly not using this. Let's try removing it from the build
and landing it. If no problems emerge, we'll be able to remove
our custom changes to upstream code in jvm_android.cc.
Recent WebRTC backports and changes that are about to be backported from
upstream to Firefox breaks and will break how we work with PipWire based
desktop capturer. Currently when constructing device list, a fallback to
ScreenCapturerX11 is used, as we don't call set_allow_pipewire(), which
wouldn't make a difference anyway. In such case the only thing we need
is a placeholder for a screen that will request OS level prompt. We also
need a way to request both screens and windows in one xdg-desktop-portal
call as recent WebRTC made each type be called separately, therefore the
introduction of GenericCapturer. Lastly we need to make sure when there
is a MediaDevice requesting the OS prompt, that it will be checked as
first.
Differential Revision: https://phabricator.services.mozilla.com/D174793
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/dca1b97525487ae57d43ced1ebdb4a2d9c9dae89
In order to use unmodified libwebrtc, Firefox would need to rework the
OS picker to request each type (screens and windows) separately so we
can just use regular ScreenCapturer and WindowCapturer. This should be
done ideally the way Chromium does it, where users can actually see
even the preview of what they picked over xdg-desktop-portal before it
is actually shared with requesting web page and they also have option
to make the request again in case they picked a wrong window or screen.
Differential Revision: https://phabricator.services.mozilla.com/D169627
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/acd6266642951aacf8915a56777c780cae9e9af3
---
modules/utility/BUILD.gn | 4 ++++
1 file changed, 4 insertions(+)
.../desktop_capture/desktop_capture_types.h | 2 +-
modules/desktop_capture/desktop_capturer.cc | 28 +++++++++++++++++++
modules/desktop_capture/desktop_capturer.h | 13 +++++++++
.../linux/wayland/base_capturer_pipewire.cc | 11 +-------
.../linux/wayland/screencast_portal.cc | 2 ++
5 files changed, 45 insertions(+), 11 deletions(-)
diff --git a/modules/utility/BUILD.gn b/modules/utility/BUILD.gn
index 3fe4ca8c92..46bca17f02 100644
--- a/modules/utility/BUILD.gn
+++ b/modules/utility/BUILD.gn
@@ -47,6 +47,10 @@ rtc_source_set("utility") {
"../../rtc_base:platform_thread",
"../../rtc_base/system:arch",
]
diff --git a/modules/desktop_capture/desktop_capture_types.h b/modules/desktop_capture/desktop_capture_types.h
index 381d1021c4..e777a45f92 100644
--- a/modules/desktop_capture/desktop_capture_types.h
+++ b/modules/desktop_capture/desktop_capture_types.h
@@ -19,7 +19,7 @@ typedef int pid_t; // matching what used to be in
namespace webrtc {
-enum class CaptureType { kWindow, kScreen };
+enum class CaptureType { kWindow, kScreen, kAnyScreenContent };
// Type used to identify windows on the desktop. Values are platform-specific:
// - On Windows: HWND cast to intptr_t.
diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc
index 4debc75394..65a4045f8c 100644
--- a/modules/desktop_capture/desktop_capturer.cc
+++ b/modules/desktop_capture/desktop_capturer.cc
@@ -25,6 +25,10 @@
#include "rtc_base/win/windows_version.h"
#endif // defined(RTC_ENABLE_WIN_WGC)
+#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+#include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h"
+#endif
+
+ if (build_with_mozilla) {
+ sources -= [ "source/jvm_android.cc" ]
namespace webrtc {
DesktopCapturer::~DesktopCapturer() = default;
@@ -78,6 +82,30 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateWindowCapturer(
return capturer;
}
+#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+// static
+std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateGenericCapturer(
+ const DesktopCaptureOptions& options) {
+ std::unique_ptr<DesktopCapturer> capturer = CreateRawGenericCapturer(options);
+ if (capturer && options.detect_updated_region()) {
+ capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer)));
+ }
+
+ return capturer;
+}
+
+// static
+std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawGenericCapturer(
+ const DesktopCaptureOptions& options) {
+ if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
+ return std::make_unique<BaseCapturerPipeWire>(options,
+ CaptureType::kAnyScreenContent);
+ }
+
+ return nullptr;
+}
+#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+
// static
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateScreenCapturer(
const DesktopCaptureOptions& options) {
diff --git a/modules/desktop_capture/desktop_capturer.h b/modules/desktop_capture/desktop_capturer.h
index 3fdcd2c5d0..2713c0e603 100644
--- a/modules/desktop_capture/desktop_capturer.h
+++ b/modules/desktop_capture/desktop_capturer.h
@@ -168,6 +168,12 @@ class RTC_EXPORT DesktopCapturer {
// The return value if `pos` is out of the scope of the source is undefined.
virtual bool IsOccluded(const DesktopVector& pos);
+#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+ // Creates a DesktopCapturer instance which targets to capture windows and screens.
+ static std::unique_ptr<DesktopCapturer> CreateGenericCapturer(
+ const DesktopCaptureOptions& options);
+#endif
+
// Creates a DesktopCapturer instance which targets to capture windows.
static std::unique_ptr<DesktopCapturer> CreateWindowCapturer(
const DesktopCaptureOptions& options);
@@ -196,6 +202,13 @@ class RTC_EXPORT DesktopCapturer {
// CroppingWindowCapturer needs to create raw capturers without wrappers, so
// the following two functions are protected.
+#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+ // Creates a platform specific DesktopCapturer instance which targets to
+ // capture windows and screens.
+ static std::unique_ptr<DesktopCapturer> CreateRawGenericCapturer(
+ const DesktopCaptureOptions& options);
+#endif
+
// Creates a platform specific DesktopCapturer instance which targets to
// capture windows.
static std::unique_ptr<DesktopCapturer> CreateRawWindowCapturer(
diff --git a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
index dae2b70510..cf4f7dc9aa 100644
--- a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
+++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
@@ -165,15 +165,6 @@ void BaseCapturerPipeWire::CaptureFrame() {
callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
}
-// Keep in sync with defines at browser/actors/WebRTCParent.jsm
-// With PipeWire we can't select which system resource is shared so
-// we don't create a window/screen list. Instead we place these constants
-// as window name/id so frontend code can identify PipeWire backend
-// and does not try to create screen/window preview.
-
-#define PIPEWIRE_ID 0xaffffff
-#define PIPEWIRE_NAME "####_PIPEWIRE_PORTAL_####"
-
bool BaseCapturerPipeWire::GetSourceList(SourceList* sources) {
RTC_DCHECK(sources->size() == 0);
// List of available screens is already presented by the xdg-desktop-portal,
@@ -190,7 +181,7 @@ bool BaseCapturerPipeWire::GetSourceList(SourceList* sources) {
bool BaseCapturerPipeWire::SelectSource(SourceId id) {
// Screen selection is handled by the xdg-desktop-portal.
selected_source_id_ = id;
- return id == PIPEWIRE_ID;
+ return true;
}
DelegatedSourceListController*
diff --git a/modules/desktop_capture/linux/wayland/screencast_portal.cc b/modules/desktop_capture/linux/wayland/screencast_portal.cc
index abfade56e7..e7aaee001b 100644
--- a/modules/desktop_capture/linux/wayland/screencast_portal.cc
+++ b/modules/desktop_capture/linux/wayland/screencast_portal.cc
@@ -41,6 +41,8 @@ ScreenCastPortal::CaptureSourceType ScreenCastPortal::ToCaptureSourceType(
return ScreenCastPortal::CaptureSourceType::kScreen;
case CaptureType::kWindow:
return ScreenCastPortal::CaptureSourceType::kWindow;
+ case CaptureType::kAnyScreenContent:
+ return ScreenCastPortal::CaptureSourceType::kAnyScreenContent;
}
}

Просмотреть файл

@ -1,169 +1,100 @@
From: Jan Grulich <jgrulich@redhat.com>
Date: Mon, 20 Feb 2023 21:25:00 +0000
Subject: Bug 1817263 - fix OS picker behavior under Wayland r=ng,jib,stransky
Date: Mon, 27 Feb 2023 13:57:00 +0000
Subject: Bug 1819044 - fix build non-pipewire builds
r=webrtc-reviewers,pehrsons
Recent WebRTC backports and changes that are about to be backported from
upstream to Firefox breaks and will break how we work with PipWire based
desktop capturer. Currently when constructing device list, a fallback to
ScreenCapturerX11 is used, as we don't call set_allow_pipewire(), which
wouldn't make a difference anyway. In such case the only thing we need
is a placeholder for a screen that will request OS level prompt. We also
need a way to request both screens and windows in one xdg-desktop-portal
call as recent WebRTC made each type be called separately, therefore the
introduction of GenericCapturer. Lastly we need to make sure when there
is a MediaDevice requesting the OS prompt, that it will be checked as
first.
We should check only for PipeWire presence when building code specific
to PipeWire.
In order to use unmodified libwebrtc, Firefox would need to rework the
OS picker to request each type (screens and windows) separately so we
can just use regular ScreenCapturer and WindowCapturer. This should be
done ideally the way Chromium does it, where users can actually see
even the preview of what they picked over xdg-desktop-portal before it
is actually shared with requesting web page and they also have option
to make the request again in case they picked a wrong window or screen.
Differential Revision: https://phabricator.services.mozilla.com/D171071
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/7a879ad084a6e9768479c73cc5c3f4e9d95a2ab9
Differential Revision: https://phabricator.services.mozilla.com/D169627
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/acd6266642951aacf8915a56777c780cae9e9af3
Also includes:
Bug 1819044 - fix build non-pipewire builds (attempt #2) r=webrtc-reviewers,pehrsons
Make the new API available to everyone and just return an empty capturer
in case when building without PipeWire. It will not make any difference
because using X11 based capturers on Wayland is useless anyway so if we
fail for missing PipeWire on Wayland, it will have the same outcome.
Differential Revision: https://phabricator.services.mozilla.com/D171192
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ad247b0aac896d884eba5e40f0ec8a9f50d8b85b
---
.../desktop_capture/desktop_capture_types.h | 2 +-
modules/desktop_capture/desktop_capturer.cc | 28 +++++++++++++++++++
modules/desktop_capture/desktop_capturer.h | 13 +++++++++
.../linux/wayland/base_capturer_pipewire.cc | 11 +-------
.../linux/wayland/screencast_portal.cc | 2 ++
5 files changed, 45 insertions(+), 11 deletions(-)
modules/desktop_capture/desktop_capturer.cc | 7 +++----
modules/desktop_capture/desktop_capturer.h | 4 ----
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/modules/desktop_capture/desktop_capture_types.h b/modules/desktop_capture/desktop_capture_types.h
index 381d1021c4..e777a45f92 100644
--- a/modules/desktop_capture/desktop_capture_types.h
+++ b/modules/desktop_capture/desktop_capture_types.h
@@ -19,7 +19,7 @@ typedef int pid_t; // matching what used to be in
namespace webrtc {
-enum class CaptureType { kWindow, kScreen };
+enum class CaptureType { kWindow, kScreen, kAnyScreenContent };
// Type used to identify windows on the desktop. Values are platform-specific:
// - On Windows: HWND cast to intptr_t.
diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc
index 4debc75394..65a4045f8c 100644
index 65a4045f8c..042d9f7633 100644
--- a/modules/desktop_capture/desktop_capturer.cc
+++ b/modules/desktop_capture/desktop_capturer.cc
@@ -25,6 +25,10 @@
@@ -25,7 +25,7 @@
#include "rtc_base/win/windows_version.h"
#endif // defined(RTC_ENABLE_WIN_WGC)
+#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+#include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h"
+#endif
+
namespace webrtc {
-#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+#if defined(WEBRTC_USE_PIPEWIRE)
#include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h"
#endif
DesktopCapturer::~DesktopCapturer() = default;
@@ -78,6 +82,30 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateWindowCapturer(
@@ -82,7 +82,6 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateWindowCapturer(
return capturer;
}
+#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+// static
+std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateGenericCapturer(
+ const DesktopCaptureOptions& options) {
+ std::unique_ptr<DesktopCapturer> capturer = CreateRawGenericCapturer(options);
+ if (capturer && options.detect_updated_region()) {
+ capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer)));
+ }
+
+ return capturer;
+}
+
+// static
+std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawGenericCapturer(
+ const DesktopCaptureOptions& options) {
+ if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
+ return std::make_unique<BaseCapturerPipeWire>(options,
+ CaptureType::kAnyScreenContent);
+ }
+
+ return nullptr;
+}
+#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+
-#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
// static
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateGenericCapturer(
const DesktopCaptureOptions& options) {
@@ -94,17 +93,17 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateGenericCapturer(
return capturer;
}
-// static
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawGenericCapturer(
const DesktopCaptureOptions& options) {
+#if defined(WEBRTC_USE_PIPEWIRE)
if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
return std::make_unique<BaseCapturerPipeWire>(options,
CaptureType::kAnyScreenContent);
}
+#endif // defined(WEBRTC_USE_PIPEWIRE)
return nullptr;
}
-#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
// static
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateScreenCapturer(
const DesktopCaptureOptions& options) {
diff --git a/modules/desktop_capture/desktop_capturer.h b/modules/desktop_capture/desktop_capturer.h
index 3fdcd2c5d0..2713c0e603 100644
index 2713c0e603..99a3606a05 100644
--- a/modules/desktop_capture/desktop_capturer.h
+++ b/modules/desktop_capture/desktop_capturer.h
@@ -168,6 +168,12 @@ class RTC_EXPORT DesktopCapturer {
@@ -168,11 +168,9 @@ class RTC_EXPORT DesktopCapturer {
// The return value if `pos` is out of the scope of the source is undefined.
virtual bool IsOccluded(const DesktopVector& pos);
+#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+ // Creates a DesktopCapturer instance which targets to capture windows and screens.
+ static std::unique_ptr<DesktopCapturer> CreateGenericCapturer(
+ const DesktopCaptureOptions& options);
+#endif
+
-#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
// Creates a DesktopCapturer instance which targets to capture windows and screens.
static std::unique_ptr<DesktopCapturer> CreateGenericCapturer(
const DesktopCaptureOptions& options);
-#endif
// Creates a DesktopCapturer instance which targets to capture windows.
static std::unique_ptr<DesktopCapturer> CreateWindowCapturer(
const DesktopCaptureOptions& options);
@@ -196,6 +202,13 @@ class RTC_EXPORT DesktopCapturer {
@@ -202,12 +200,10 @@ class RTC_EXPORT DesktopCapturer {
// CroppingWindowCapturer needs to create raw capturers without wrappers, so
// the following two functions are protected.
+#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+ // Creates a platform specific DesktopCapturer instance which targets to
+ // capture windows and screens.
+ static std::unique_ptr<DesktopCapturer> CreateRawGenericCapturer(
+ const DesktopCaptureOptions& options);
+#endif
+
-#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
// Creates a platform specific DesktopCapturer instance which targets to
// capture windows and screens.
static std::unique_ptr<DesktopCapturer> CreateRawGenericCapturer(
const DesktopCaptureOptions& options);
-#endif
// Creates a platform specific DesktopCapturer instance which targets to
// capture windows.
static std::unique_ptr<DesktopCapturer> CreateRawWindowCapturer(
diff --git a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
index dae2b70510..cf4f7dc9aa 100644
--- a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
+++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
@@ -165,15 +165,6 @@ void BaseCapturerPipeWire::CaptureFrame() {
callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
}
-// Keep in sync with defines at browser/actors/WebRTCParent.jsm
-// With PipeWire we can't select which system resource is shared so
-// we don't create a window/screen list. Instead we place these constants
-// as window name/id so frontend code can identify PipeWire backend
-// and does not try to create screen/window preview.
-
-#define PIPEWIRE_ID 0xaffffff
-#define PIPEWIRE_NAME "####_PIPEWIRE_PORTAL_####"
-
bool BaseCapturerPipeWire::GetSourceList(SourceList* sources) {
RTC_DCHECK(sources->size() == 0);
// List of available screens is already presented by the xdg-desktop-portal,
@@ -190,7 +181,7 @@ bool BaseCapturerPipeWire::GetSourceList(SourceList* sources) {
bool BaseCapturerPipeWire::SelectSource(SourceId id) {
// Screen selection is handled by the xdg-desktop-portal.
selected_source_id_ = id;
- return id == PIPEWIRE_ID;
+ return true;
}
DelegatedSourceListController*
diff --git a/modules/desktop_capture/linux/wayland/screencast_portal.cc b/modules/desktop_capture/linux/wayland/screencast_portal.cc
index abfade56e7..e7aaee001b 100644
--- a/modules/desktop_capture/linux/wayland/screencast_portal.cc
+++ b/modules/desktop_capture/linux/wayland/screencast_portal.cc
@@ -41,6 +41,8 @@ ScreenCastPortal::CaptureSourceType ScreenCastPortal::ToCaptureSourceType(
return ScreenCastPortal::CaptureSourceType::kScreen;
case CaptureType::kWindow:
return ScreenCastPortal::CaptureSourceType::kWindow;
+ case CaptureType::kAnyScreenContent:
+ return ScreenCastPortal::CaptureSourceType::kAnyScreenContent;
}
}
--
2.34.1

Просмотреть файл

@ -1,100 +1,32 @@
From: Jan Grulich <jgrulich@redhat.com>
Date: Mon, 27 Feb 2023 13:57:00 +0000
Subject: Bug 1819044 - fix build non-pipewire builds
r=webrtc-reviewers,pehrsons
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 6 Mar 2023 07:41:00 +0000
Subject: Bug 1817724 - Crash in case VideoCaptureAVFoundation is destroyed
unexpectedly. r=karlt,webrtc-reviewers,ng
We should check only for PipeWire presence when building code specific
to PipeWire.
Differential Revision: https://phabricator.services.mozilla.com/D171071
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/7a879ad084a6e9768479c73cc5c3f4e9d95a2ab9
Also includes:
Bug 1819044 - fix build non-pipewire builds (attempt #2) r=webrtc-reviewers,pehrsons
Make the new API available to everyone and just return an empty capturer
in case when building without PipeWire. It will not make any difference
because using X11 based capturers on Wayland is useless anyway so if we
fail for missing PipeWire on Wayland, it will have the same outcome.
Differential Revision: https://phabricator.services.mozilla.com/D171192
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ad247b0aac896d884eba5e40f0ec8a9f50d8b85b
Differential Revision: https://phabricator.services.mozilla.com/D171470
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/30340541c9a17e21f1c8f7e65850afaa5e3355db
---
modules/desktop_capture/desktop_capturer.cc | 7 +++----
modules/desktop_capture/desktop_capturer.h | 4 ----
2 files changed, 3 insertions(+), 8 deletions(-)
modules/video_capture/video_capture.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc
index 65a4045f8c..042d9f7633 100644
--- a/modules/desktop_capture/desktop_capturer.cc
+++ b/modules/desktop_capture/desktop_capturer.cc
@@ -25,7 +25,7 @@
#include "rtc_base/win/windows_version.h"
#endif // defined(RTC_ENABLE_WIN_WGC)
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index 7e181c538e..4c800ccb6a 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -161,8 +161,13 @@ class VideoCaptureModule : public rtc::RefCountInterface {
// Mozilla: TrackingId setter for use in profiler markers.
virtual void SetTrackingId(uint32_t aTrackingIdProcId) {}
-#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
+#if defined(WEBRTC_USE_PIPEWIRE)
#include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h"
#endif
+ // Mozilla: Diagnostic
+ void NotifyReleasing() { mOkToDestroy = true; }
+
protected:
~VideoCaptureModule() override {}
+
+ std::atomic<bool> mOkToDestroy = {false};
};
@@ -82,7 +82,6 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateWindowCapturer(
return capturer;
}
-#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
// static
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateGenericCapturer(
const DesktopCaptureOptions& options) {
@@ -94,17 +93,17 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateGenericCapturer(
return capturer;
}
-// static
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawGenericCapturer(
const DesktopCaptureOptions& options) {
+#if defined(WEBRTC_USE_PIPEWIRE)
if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
return std::make_unique<BaseCapturerPipeWire>(options,
CaptureType::kAnyScreenContent);
}
+#endif // defined(WEBRTC_USE_PIPEWIRE)
return nullptr;
}
-#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
// static
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateScreenCapturer(
diff --git a/modules/desktop_capture/desktop_capturer.h b/modules/desktop_capture/desktop_capturer.h
index 2713c0e603..99a3606a05 100644
--- a/modules/desktop_capture/desktop_capturer.h
+++ b/modules/desktop_capture/desktop_capturer.h
@@ -168,11 +168,9 @@ class RTC_EXPORT DesktopCapturer {
// The return value if `pos` is out of the scope of the source is undefined.
virtual bool IsOccluded(const DesktopVector& pos);
-#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
// Creates a DesktopCapturer instance which targets to capture windows and screens.
static std::unique_ptr<DesktopCapturer> CreateGenericCapturer(
const DesktopCaptureOptions& options);
-#endif
// Creates a DesktopCapturer instance which targets to capture windows.
static std::unique_ptr<DesktopCapturer> CreateWindowCapturer(
@@ -202,12 +200,10 @@ class RTC_EXPORT DesktopCapturer {
// CroppingWindowCapturer needs to create raw capturers without wrappers, so
// the following two functions are protected.
-#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
// Creates a platform specific DesktopCapturer instance which targets to
// capture windows and screens.
static std::unique_ptr<DesktopCapturer> CreateRawGenericCapturer(
const DesktopCaptureOptions& options);
-#endif
// Creates a platform specific DesktopCapturer instance which targets to
// capture windows.
} // namespace webrtc
--
2.34.1

Просмотреть файл

@ -1,32 +1,77 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 6 Mar 2023 07:41:00 +0000
Subject: Bug 1817724 - Crash in case VideoCaptureAVFoundation is destroyed
unexpectedly. r=karlt,webrtc-reviewers,ng
From: Jan Grulich <jgrulich@redhat.com>
Date: Fri, 10 Mar 2023 09:21:00 +0000
Subject: Bug 1819035 - get EGL display based on the used platform in the
browser r=webrtc-reviewers,ng
Differential Revision: https://phabricator.services.mozilla.com/D171470
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/30340541c9a17e21f1c8f7e65850afaa5e3355db
Because of a possible misconfiguration or a possible driver issue it
might happen that the browser will use a different driver on X11 and
end up using yet another one for wayland/gbm, which might lead to not
working screen sharing in the better case, but also to a crash in the
other driver (Nvidia). This adds a check for platform the browser runs
on, if it's XWayland or Wayland and based on that query EGL display for
that specific platform, rather than going for the Wayland one only.
Differential Revision: https://phabricator.services.mozilla.com/D171858
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c8606497de1f461a6352456e0e511c2ae498d526
---
modules/video_capture/video_capture.h | 5 +++++
1 file changed, 5 insertions(+)
.../linux/wayland/egl_dmabuf.cc | 30 +++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index 7e181c538e..4c800ccb6a 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -161,8 +161,13 @@ class VideoCaptureModule : public rtc::RefCountInterface {
// Mozilla: TrackingId setter for use in profiler markers.
virtual void SetTrackingId(uint32_t aTrackingIdProcId) {}
diff --git a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
index 5bbd5d7aba..80da597e29 100644
--- a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
@@ -13,6 +13,7 @@
#include <asm/ioctl.h>
#include <dlfcn.h>
#include <fcntl.h>
+#include <gdk/gdk.h>
#include <libdrm/drm_fourcc.h>
#include <linux/types.h>
#include <spa/param/video/format-utils.h>
@@ -200,6 +201,26 @@ static void CloseLibrary(void* library) {
}
}
+ // Mozilla: Diagnostic
+ void NotifyReleasing() { mOkToDestroy = true; }
+static bool IsWaylandDisplay() {
+ static auto sGdkWaylandDisplayGetType =
+ (GType (*)(void))dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_type");
+ if (!sGdkWaylandDisplayGetType) {
+ return false;
+ }
+ return (G_TYPE_CHECK_INSTANCE_TYPE ((gdk_display_get_default()),
+ sGdkWaylandDisplayGetType()));
+}
+
protected:
~VideoCaptureModule() override {}
+static bool IsX11Display() {
+ static auto sGdkX11DisplayGetType =
+ (GType (*)(void))dlsym(RTLD_DEFAULT, "gdk_x11_display_get_type");
+ if (!sGdkX11DisplayGetType) {
+ return false;
+ }
+ return (G_TYPE_CHECK_INSTANCE_TYPE ((gdk_display_get_default()),
+ sGdkX11DisplayGetType()));
+}
+
+ std::atomic<bool> mOkToDestroy = {false};
};
static void* g_lib_egl = nullptr;
} // namespace webrtc
RTC_NO_SANITIZE("cfi-icall")
@@ -331,8 +352,13 @@ EglDmaBuf::EglDmaBuf() {
return;
}
- egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
- (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ if (IsWaylandDisplay()) {
+ egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
+ (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ } else if (IsX11Display()) {
+ egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_X11_KHR,
+ (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ }
if (egl_.display == EGL_NO_DISPLAY) {
RTC_LOG(LS_ERROR) << "Failed to obtain default EGL display: "
--
2.34.1

Просмотреть файл

@ -1,77 +1,34 @@
From: Jan Grulich <jgrulich@redhat.com>
Date: Fri, 10 Mar 2023 09:21:00 +0000
Subject: Bug 1819035 - get EGL display based on the used platform in the
browser r=webrtc-reviewers,ng
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 27 Feb 2023 16:22:00 +0000
Subject: Bug 1817024 - (fix-fdcfefa708) In PhysicalSocket avoid a non-trivial
designated initializer. r=mjf,webrtc-reviewers
Because of a possible misconfiguration or a possible driver issue it
might happen that the browser will use a different driver on X11 and
end up using yet another one for wayland/gbm, which might lead to not
working screen sharing in the better case, but also to a crash in the
other driver (Nvidia). This adds a check for platform the browser runs
on, if it's XWayland or Wayland and based on that query EGL display for
that specific platform, rather than going for the Wayland one only.
This fixes a build failure in the base-toolchain job with GCC 7.5.0:
In file included from Unified_cpp_threading_gn0.cpp:38:0:
.../third_party/libwebrtc/rtc_base/physical_socket_server.cc: In member function 'int rtc::PhysicalSocket::DoReadFromSocket(void*, size_t, rtc::SocketAddress*, int64_t*)':
.../third_party/libwebrtc/rtc_base/physical_socket_server.cc:463:51: sorry, unimplemented: non-trivial designated initializers not supported
msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
^
Differential Revision: https://phabricator.services.mozilla.com/D171858
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/c8606497de1f461a6352456e0e511c2ae498d526
Differential Revision: https://phabricator.services.mozilla.com/D171057
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a3447f709befd84a282ca40f29b7a5ea76d5b68d
---
.../linux/wayland/egl_dmabuf.cc | 30 +++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
rtc_base/physical_socket_server.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
index 5bbd5d7aba..80da597e29 100644
--- a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
@@ -13,6 +13,7 @@
#include <asm/ioctl.h>
#include <dlfcn.h>
#include <fcntl.h>
+#include <gdk/gdk.h>
#include <libdrm/drm_fourcc.h>
#include <linux/types.h>
#include <spa/param/video/format-utils.h>
@@ -200,6 +201,26 @@ static void CloseLibrary(void* library) {
}
}
+static bool IsWaylandDisplay() {
+ static auto sGdkWaylandDisplayGetType =
+ (GType (*)(void))dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_type");
+ if (!sGdkWaylandDisplayGetType) {
+ return false;
+ }
+ return (G_TYPE_CHECK_INSTANCE_TYPE ((gdk_display_get_default()),
+ sGdkWaylandDisplayGetType()));
+}
+
+static bool IsX11Display() {
+ static auto sGdkX11DisplayGetType =
+ (GType (*)(void))dlsym(RTLD_DEFAULT, "gdk_x11_display_get_type");
+ if (!sGdkX11DisplayGetType) {
+ return false;
+ }
+ return (G_TYPE_CHECK_INSTANCE_TYPE ((gdk_display_get_default()),
+ sGdkX11DisplayGetType()));
+}
+
static void* g_lib_egl = nullptr;
RTC_NO_SANITIZE("cfi-icall")
@@ -331,8 +352,13 @@ EglDmaBuf::EglDmaBuf() {
return;
}
- egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
- (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ if (IsWaylandDisplay()) {
+ egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
+ (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ } else if (IsX11Display()) {
+ egl_.display = EglGetPlatformDisplay(EGL_PLATFORM_X11_KHR,
+ (void*)EGL_DEFAULT_DISPLAY, nullptr);
+ }
if (egl_.display == EGL_NO_DISPLAY) {
RTC_LOG(LS_ERROR) << "Failed to obtain default EGL display: "
diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc
index 60d024c769..3b112e6188 100644
--- a/rtc_base/physical_socket_server.cc
+++ b/rtc_base/physical_socket_server.cc
@@ -460,7 +460,7 @@ int PhysicalSocket::DoReadFromSocket(void* buffer,
int received = 0;
if (read_scm_timestamp_experiment_) {
iovec iov = {.iov_base = buffer, .iov_len = length};
- msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
+ msghdr msg = {.msg_name = nullptr, .msg_namelen = 0, .msg_iov = &iov, .msg_iovlen = 1};
if (out_addr) {
out_addr->Clear();
msg.msg_name = addr;
--
2.34.1

Просмотреть файл

@ -1,34 +1,526 @@
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Mon, 27 Feb 2023 16:22:00 +0000
Subject: Bug 1817024 - (fix-fdcfefa708) In PhysicalSocket avoid a non-trivial
designated initializer. r=mjf,webrtc-reviewers
From: Jan Grulich <jgrulich@redhat.com>
Date: Tue, 28 Mar 2023 14:41:00 +0000
Subject: Bug 1823404 - PipeWire capturer: import DMABufs directly into desktop
frame r=webrtc-reviewers,stransky,bwc
This fixes a build failure in the base-toolchain job with GCC 7.5.0:
In file included from Unified_cpp_threading_gn0.cpp:38:0:
.../third_party/libwebrtc/rtc_base/physical_socket_server.cc: In member function 'int rtc::PhysicalSocket::DoReadFromSocket(void*, size_t, rtc::SocketAddress*, int64_t*)':
.../third_party/libwebrtc/rtc_base/physical_socket_server.cc:463:51: sorry, unimplemented: non-trivial designated initializers not supported
msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
^
Originally DMABufs were imported into a temporary buffer followed by a
copy operation into the desktop frame itself. This is not needed as we
can import them directly into desktop frames and avoid this overhead.
Differential Revision: https://phabricator.services.mozilla.com/D171057
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/a3447f709befd84a282ca40f29b7a5ea76d5b68d
Also drop support for MemPtr buffers as both Mutter and KWin don't seem
to support them and they are going to be too slow anyway.
Testing with latest Chromium, I could see two processes with usage
around 20% and 40% without this change going down to 10% and 20% with
this change applied.
Also drop old DmaBuf support.
Differential Revision: https://phabricator.services.mozilla.com/D173021
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/581fe5ce66f9f3c725f5345b3e57407d1ec1e312
---
rtc_base/physical_socket_server.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
.../linux/wayland/egl_dmabuf.cc | 114 +++++++---
.../linux/wayland/egl_dmabuf.h | 16 +-
.../linux/wayland/shared_screencast_stream.cc | 209 +++++++++---------
3 files changed, 201 insertions(+), 138 deletions(-)
diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc
index 60d024c769..3b112e6188 100644
--- a/rtc_base/physical_socket_server.cc
+++ b/rtc_base/physical_socket_server.cc
@@ -460,7 +460,7 @@ int PhysicalSocket::DoReadFromSocket(void* buffer,
int received = 0;
if (read_scm_timestamp_experiment_) {
iovec iov = {.iov_base = buffer, .iov_len = length};
- msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
+ msghdr msg = {.msg_name = nullptr, .msg_namelen = 0, .msg_iov = &iov, .msg_iovlen = 1};
if (out_addr) {
out_addr->Clear();
msg.msg_name = addr;
diff --git a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
index 80da597e29..6a019c64b4 100644
--- a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
@@ -102,11 +102,23 @@ typedef void (*glDeleteTextures_func)(GLsizei n, const GLuint* textures);
typedef void (*glGenTextures_func)(GLsizei n, GLuint* textures);
typedef GLenum (*glGetError_func)(void);
typedef const GLubyte* (*glGetString_func)(GLenum name);
-typedef void (*glGetTexImage_func)(GLenum target,
- GLint level,
- GLenum format,
- GLenum type,
- void* pixels);
+typedef void (*glReadPixels_func)(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void* data);
+typedef void (*glGenFramebuffers_func)(GLsizei n, GLuint* ids);
+typedef void (*glDeleteFramebuffers_func)(GLsizei n,
+ const GLuint* framebuffers);
+typedef void (*glBindFramebuffer_func)(GLenum target, GLuint framebuffer);
+typedef void (*glFramebufferTexture2D_func)(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level);
+typedef GLenum (*glCheckFramebufferStatus_func)(GLenum target);
typedef void (*glTexParameteri_func)(GLenum target, GLenum pname, GLint param);
typedef void* (*glXGetProcAddressARB_func)(const char*);
@@ -119,7 +131,12 @@ glDeleteTextures_func GlDeleteTextures = nullptr;
glGenTextures_func GlGenTextures = nullptr;
glGetError_func GlGetError = nullptr;
glGetString_func GlGetString = nullptr;
-glGetTexImage_func GlGetTexImage = nullptr;
+glReadPixels_func GlReadPixels = nullptr;
+glGenFramebuffers_func GlGenFramebuffers = nullptr;
+glDeleteFramebuffers_func GlDeleteFramebuffers = nullptr;
+glBindFramebuffer_func GlBindFramebuffer = nullptr;
+glFramebufferTexture2D_func GlFramebufferTexture2D = nullptr;
+glCheckFramebufferStatus_func GlCheckFramebufferStatus = nullptr;
glTexParameteri_func GlTexParameteri = nullptr;
glXGetProcAddressARB_func GlXGetProcAddressARB = nullptr;
@@ -300,12 +317,26 @@ static bool LoadGL() {
(glDeleteTextures_func)GlXGetProcAddressARB("glDeleteTextures");
GlGenTextures = (glGenTextures_func)GlXGetProcAddressARB("glGenTextures");
GlGetError = (glGetError_func)GlXGetProcAddressARB("glGetError");
- GlGetTexImage = (glGetTexImage_func)GlXGetProcAddressARB("glGetTexImage");
+ GlReadPixels = (glReadPixels_func)GlXGetProcAddressARB("glReadPixels");
+ GlGenFramebuffers =
+ (glGenFramebuffers_func)GlXGetProcAddressARB("glGenFramebuffers");
+ GlDeleteFramebuffers =
+ (glDeleteFramebuffers_func)GlXGetProcAddressARB("glDeleteFramebuffers");
+ GlBindFramebuffer =
+ (glBindFramebuffer_func)GlXGetProcAddressARB("glBindFramebuffer");
+ GlFramebufferTexture2D = (glFramebufferTexture2D_func)GlXGetProcAddressARB(
+ "glFramebufferTexture2D");
+ GlCheckFramebufferStatus =
+ (glCheckFramebufferStatus_func)GlXGetProcAddressARB(
+ "glCheckFramebufferStatus");
+
GlTexParameteri =
(glTexParameteri_func)GlXGetProcAddressARB("glTexParameteri");
return GlBindTexture && GlDeleteTextures && GlGenTextures && GlGetError &&
- GlGetTexImage && GlTexParameteri;
+ GlReadPixels && GlGenFramebuffers && GlDeleteFramebuffers &&
+ GlBindFramebuffer && GlFramebufferTexture2D &&
+ GlCheckFramebufferStatus && GlTexParameteri;
}
return false;
@@ -461,6 +492,14 @@ EglDmaBuf::~EglDmaBuf() {
EglTerminate(egl_.display);
}
+ if (fbo_) {
+ GlDeleteFramebuffers(1, &fbo_);
+ }
+
+ if (texture_) {
+ GlDeleteTextures(1, &texture_);
+ }
+
// BUG: crbug.com/1290566
// Closing libEGL.so.1 when using NVidia drivers causes a crash
// when EglGetPlatformDisplayEXT() is used, at least this one is enough
@@ -492,20 +531,20 @@ bool EglDmaBuf::GetClientExtensions(EGLDisplay dpy, EGLint name) {
}
RTC_NO_SANITIZE("cfi-icall")
-std::unique_ptr<uint8_t[]> EglDmaBuf::ImageFromDmaBuf(
- const DesktopSize& size,
- uint32_t format,
- const std::vector<PlaneData>& plane_datas,
- uint64_t modifier) {
- std::unique_ptr<uint8_t[]> src;
-
+bool EglDmaBuf::ImageFromDmaBuf(const DesktopSize& size,
+ uint32_t format,
+ const std::vector<PlaneData>& plane_datas,
+ uint64_t modifier,
+ const DesktopVector& offset,
+ const DesktopSize& buffer_size,
+ uint8_t* data) {
if (!egl_initialized_) {
- return src;
+ return false;
}
if (plane_datas.size() <= 0) {
RTC_LOG(LS_ERROR) << "Failed to process buffer: invalid number of planes";
- return src;
+ return false;
}
EGLint attribs[47];
@@ -594,20 +633,32 @@ std::unique_ptr<uint8_t[]> EglDmaBuf::ImageFromDmaBuf(
if (image == EGL_NO_IMAGE) {
RTC_LOG(LS_ERROR) << "Failed to record frame: Error creating EGLImage - "
<< FormatEGLError(EglGetError());
- return src;
+ return false;
}
// create GL 2D texture for framebuffer
- GLuint texture;
- GlGenTextures(1, &texture);
- GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- GlBindTexture(GL_TEXTURE_2D, texture);
+ if (!texture_) {
+ GlGenTextures(1, &texture_);
+ GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ }
+ GlBindTexture(GL_TEXTURE_2D, texture_);
GlEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
- src = std::make_unique<uint8_t[]>(plane_datas[0].stride * size.height());
+ if (!fbo_) {
+ GlGenFramebuffers(1, &fbo_);
+ }
+
+ GlBindFramebuffer(GL_FRAMEBUFFER, fbo_);
+ GlFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ texture_, 0);
+ if (GlCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
+ RTC_LOG(LS_ERROR) << "Failed to bind DMA buf framebuffer";
+ EglDestroyImageKHR(egl_.display, image);
+ return false;
+ }
GLenum gl_format = GL_BGRA;
switch (format) {
@@ -624,17 +675,18 @@ std::unique_ptr<uint8_t[]> EglDmaBuf::ImageFromDmaBuf(
gl_format = GL_BGRA;
break;
}
- GlGetTexImage(GL_TEXTURE_2D, 0, gl_format, GL_UNSIGNED_BYTE, src.get());
- if (GlGetError()) {
+ GlReadPixels(offset.x(), offset.y(), buffer_size.width(),
+ buffer_size.height(), gl_format, GL_UNSIGNED_BYTE, data);
+
+ const GLenum error = GlGetError();
+ if (error) {
RTC_LOG(LS_ERROR) << "Failed to get image from DMA buffer.";
- return src;
}
- GlDeleteTextures(1, &texture);
EglDestroyImageKHR(egl_.display, image);
- return src;
+ return !error;
}
RTC_NO_SANITIZE("cfi-icall")
diff --git a/modules/desktop_capture/linux/wayland/egl_dmabuf.h b/modules/desktop_capture/linux/wayland/egl_dmabuf.h
index f1d96b2f80..22a8f5ab52 100644
--- a/modules/desktop_capture/linux/wayland/egl_dmabuf.h
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.h
@@ -41,11 +41,15 @@ class EglDmaBuf {
EglDmaBuf();
~EglDmaBuf();
- std::unique_ptr<uint8_t[]> ImageFromDmaBuf(
- const DesktopSize& size,
- uint32_t format,
- const std::vector<PlaneData>& plane_datas,
- uint64_t modifiers);
+ // Returns whether the image was successfully imported from
+ // given DmaBuf and its parameters
+ bool ImageFromDmaBuf(const DesktopSize& size,
+ uint32_t format,
+ const std::vector<PlaneData>& plane_datas,
+ uint64_t modifiers,
+ const DesktopVector& offset,
+ const DesktopSize& buffer_size,
+ uint8_t* data);
std::vector<uint64_t> QueryDmaBufModifiers(uint32_t format);
bool IsEglInitialized() const { return egl_initialized_; }
@@ -58,6 +62,8 @@ class EglDmaBuf {
int32_t drm_fd_ = -1; // for GBM buffer mmap
gbm_device* gbm_device_ = nullptr; // for passed GBM buffer retrieval
+ GLuint fbo_ = 0;
+ GLuint texture_ = 0;
EGLStruct egl_;
absl::optional<std::string> GetRenderNode();
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
index 71bde9b212..bcd7e3a33c 100644
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
@@ -38,7 +38,6 @@ constexpr int CursorMetaSize(int w, int h) {
w * h * kCursorBpp);
}
-constexpr PipeWireVersion kDmaBufMinVersion = {0, 3, 24};
constexpr PipeWireVersion kDmaBufModifierMinVersion = {0, 3, 33};
constexpr PipeWireVersion kDropSingleModifierMinVersion = {0, 3, 40};
@@ -155,6 +154,12 @@ class SharedScreenCastStreamPrivate {
struct spa_video_info_raw spa_video_format_;
void ProcessBuffer(pw_buffer* buffer);
+ bool ProcessMemFDBuffer(pw_buffer* buffer,
+ DesktopFrame& frame,
+ const DesktopVector& offset);
+ bool ProcessDMABuffer(pw_buffer* buffer,
+ DesktopFrame& frame,
+ const DesktopVector& offset);
void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size);
// PipeWire callbacks
@@ -277,10 +282,9 @@ void SharedScreenCastStreamPrivate::OnStreamParamChanged(
has_modifier ? that->spa_video_format_.modifier : DRM_FORMAT_MOD_INVALID;
std::vector<const spa_pod*> params;
const int buffer_types =
- has_modifier || (that->pw_server_version_ >= kDmaBufMinVersion)
- ? (1 << SPA_DATA_DmaBuf) | (1 << SPA_DATA_MemFd) |
- (1 << SPA_DATA_MemPtr)
- : (1 << SPA_DATA_MemFd) | (1 << SPA_DATA_MemPtr);
+ has_modifier
+ ? (1 << SPA_DATA_DmaBuf) | (1 << SPA_DATA_MemFd)
+ : (1 << SPA_DATA_MemFd);
params.push_back(reinterpret_cast<spa_pod*>(spa_pod_builder_add_object(
&builder, SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
@@ -613,9 +617,6 @@ DesktopVector SharedScreenCastStreamPrivate::CaptureCursorPosition() {
RTC_NO_SANITIZE("cfi-icall")
void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
spa_buffer* spa_buffer = buffer->buffer;
- ScopedBuf map;
- std::unique_ptr<uint8_t[]> src_unique_ptr;
- uint8_t* src = nullptr;
// Try to update the mouse cursor first, because it can be the only
// information carried by the buffer
@@ -657,79 +658,6 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
return;
}
- if (spa_buffer->datas[0].type == SPA_DATA_MemFd) {
- map.initialize(
- static_cast<uint8_t*>(
- mmap(nullptr,
- spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
- PROT_READ, MAP_PRIVATE, spa_buffer->datas[0].fd, 0)),
- spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
- spa_buffer->datas[0].fd);
-
- if (!map) {
- RTC_LOG(LS_ERROR) << "Failed to mmap the memory: "
- << std::strerror(errno);
- return;
- }
-
- src = SPA_MEMBER(map.get(), spa_buffer->datas[0].mapoffset, uint8_t);
- } else if (spa_buffer->datas[0].type == SPA_DATA_DmaBuf) {
- const uint n_planes = spa_buffer->n_datas;
-
- if (!n_planes) {
- return;
- }
-
- std::vector<EglDmaBuf::PlaneData> plane_datas;
- for (uint32_t i = 0; i < n_planes; ++i) {
- EglDmaBuf::PlaneData data = {
- static_cast<int32_t>(spa_buffer->datas[i].fd),
- static_cast<uint32_t>(spa_buffer->datas[i].chunk->stride),
- static_cast<uint32_t>(spa_buffer->datas[i].chunk->offset)};
- plane_datas.push_back(data);
- }
-
- // When importing DMA-BUFs, we use the stride (number of bytes from one row
- // of pixels in the buffer) provided by PipeWire. The stride from PipeWire
- // is given by the graphics driver and some drivers might add some
- // additional padding for memory layout optimizations so not everytime the
- // stride is equal to BYTES_PER_PIXEL x WIDTH. This is fine, because during
- // the import we will use OpenGL and same graphics driver so it will be able
- // to work with the stride it provided, but later on when we work with
- // images we get from DMA-BUFs we will need to update the stride to be equal
- // to BYTES_PER_PIXEL x WIDTH as that's the size of the DesktopFrame we
- // allocate for each captured frame.
- src_unique_ptr = egl_dmabuf_->ImageFromDmaBuf(
- stream_size_, spa_video_format_.format, plane_datas, modifier_);
- if (src_unique_ptr) {
- src = src_unique_ptr.get();
- } else {
- RTC_LOG(LS_ERROR) << "Dropping DMA-BUF modifier: " << modifier_
- << " and trying to renegotiate stream parameters";
-
- if (pw_server_version_ >= kDropSingleModifierMinVersion) {
- modifiers_.erase(
- std::remove(modifiers_.begin(), modifiers_.end(), modifier_),
- modifiers_.end());
- } else {
- modifiers_.clear();
- }
-
- pw_loop_signal_event(pw_thread_loop_get_loop(pw_main_loop_),
- renegotiate_);
- return;
- }
- } else if (spa_buffer->datas[0].type == SPA_DATA_MemPtr) {
- src = static_cast<uint8_t*>(spa_buffer->datas[0].data);
- }
-
- if (!src) {
- if (observer_) {
- observer_->OnFailedToProcessBuffer();
- }
- return;
- }
-
// Use SPA_META_VideoCrop metadata to get the frame size. KDE and GNOME do
// handle screen/window sharing differently. KDE/KWin doesn't use
// SPA_META_VideoCrop metadata and when sharing a window, it always sets
@@ -787,8 +715,8 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
}
// Get the position of the video crop within the stream. Just double-check
- // that the position doesn't exceed the size of the stream itself. NOTE:
- // Currently it looks there is no implementation using this.
+ // that the position doesn't exceed the size of the stream itself.
+ // NOTE: Currently it looks there is no implementation using this.
uint32_t y_offset =
videocrop_metadata_use &&
(videocrop_metadata->region.position.y + frame_size_.height() <=
@@ -801,22 +729,7 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
stream_size_.width())
? videocrop_metadata->region.position.x
: 0;
-
- const uint32_t stream_stride = kBytesPerPixel * stream_size_.width();
- uint32_t buffer_stride = spa_buffer->datas[0].chunk->stride;
- uint32_t src_stride = buffer_stride;
-
- if (spa_buffer->datas[0].type == SPA_DATA_DmaBuf &&
- buffer_stride > stream_stride) {
- // When DMA-BUFs are used, sometimes spa_buffer->stride we get might
- // contain additional padding, but after we import the buffer, the stride
- // we used is no longer relevant and we should just calculate it based on
- // the stream width. For more context see https://crbug.com/1333304.
- src_stride = stream_stride;
- }
-
- uint8_t* updated_src =
- src + (src_stride * y_offset) + (kBytesPerPixel * x_offset);
+ DesktopVector offset = DesktopVector(x_offset, y_offset);
webrtc::MutexLock lock(&queue_lock_);
@@ -836,9 +749,20 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
queue_.ReplaceCurrentFrame(SharedDesktopFrame::Wrap(std::move(frame)));
}
- queue_.current_frame()->CopyPixelsFrom(
- updated_src, (src_stride - (kBytesPerPixel * x_offset)),
- DesktopRect::MakeWH(frame_size_.width(), frame_size_.height()));
+ bool bufferProcessed = false;
+ if (spa_buffer->datas[0].type == SPA_DATA_MemFd) {
+ bufferProcessed =
+ ProcessMemFDBuffer(buffer, *queue_.current_frame(), offset);
+ } else if (spa_buffer->datas[0].type == SPA_DATA_DmaBuf) {
+ bufferProcessed = ProcessDMABuffer(buffer, *queue_.current_frame(), offset);
+ }
+
+ if (!bufferProcessed) {
+ if (observer_) {
+ observer_->OnFailedToProcessBuffer();
+ }
+ return;
+ }
if (spa_video_format_.format == SPA_VIDEO_FORMAT_RGBx ||
spa_video_format_.format == SPA_VIDEO_FORMAT_RGBA) {
@@ -885,6 +809,87 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
queue_.current_frame()->set_may_contain_cursor(is_cursor_embedded_);
}
+RTC_NO_SANITIZE("cfi-icall")
+bool SharedScreenCastStreamPrivate::ProcessMemFDBuffer(
+ pw_buffer* buffer,
+ DesktopFrame& frame,
+ const DesktopVector& offset) {
+ spa_buffer* spa_buffer = buffer->buffer;
+ ScopedBuf map;
+ uint8_t* src = nullptr;
+
+ map.initialize(
+ static_cast<uint8_t*>(
+ mmap(nullptr,
+ spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
+ PROT_READ, MAP_PRIVATE, spa_buffer->datas[0].fd, 0)),
+ spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
+ spa_buffer->datas[0].fd);
+
+ if (!map) {
+ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno);
+ return false;
+ }
+
+ src = SPA_MEMBER(map.get(), spa_buffer->datas[0].mapoffset, uint8_t);
+
+ uint32_t buffer_stride = spa_buffer->datas[0].chunk->stride;
+ uint32_t src_stride = buffer_stride;
+
+ uint8_t* updated_src =
+ src + (src_stride * offset.y()) + (kBytesPerPixel * offset.x());
+
+ frame.CopyPixelsFrom(
+ updated_src, (src_stride - (kBytesPerPixel * offset.x())),
+ DesktopRect::MakeWH(frame.size().width(), frame.size().height()));
+
+ return true;
+}
+
+RTC_NO_SANITIZE("cfi-icall")
+bool SharedScreenCastStreamPrivate::ProcessDMABuffer(
+ pw_buffer* buffer,
+ DesktopFrame& frame,
+ const DesktopVector& offset) {
+ spa_buffer* spa_buffer = buffer->buffer;
+
+ const uint n_planes = spa_buffer->n_datas;
+
+ if (!n_planes) {
+ return false;
+ }
+
+ std::vector<EglDmaBuf::PlaneData> plane_datas;
+ for (uint32_t i = 0; i < n_planes; ++i) {
+ EglDmaBuf::PlaneData data = {
+ static_cast<int32_t>(spa_buffer->datas[i].fd),
+ static_cast<uint32_t>(spa_buffer->datas[i].chunk->stride),
+ static_cast<uint32_t>(spa_buffer->datas[i].chunk->offset)};
+ plane_datas.push_back(data);
+ }
+
+ const bool imported = egl_dmabuf_->ImageFromDmaBuf(
+ stream_size_, spa_video_format_.format, plane_datas, modifier_, offset,
+ frame.size(), frame.data());
+ if (!imported) {
+ RTC_LOG(LS_ERROR) << "Dropping DMA-BUF modifier: " << modifier_
+ << " and trying to renegotiate stream parameters";
+
+ if (pw_server_version_ >= kDropSingleModifierMinVersion) {
+ modifiers_.erase(
+ std::remove(modifiers_.begin(), modifiers_.end(), modifier_),
+ modifiers_.end());
+ } else {
+ modifiers_.clear();
+ }
+
+ pw_loop_signal_event(pw_thread_loop_get_loop(pw_main_loop_), renegotiate_);
+ return false;
+ }
+
+ return true;
+}
+
void SharedScreenCastStreamPrivate::ConvertRGBxToBGRx(uint8_t* frame,
uint32_t size) {
for (uint32_t i = 0; i < size; i += 4) {
--
2.34.1

Просмотреть файл

@ -1,526 +1,269 @@
From: Jan Grulich <jgrulich@redhat.com>
Date: Tue, 28 Mar 2023 14:41:00 +0000
Subject: Bug 1823404 - PipeWire capturer: import DMABufs directly into desktop
frame r=webrtc-reviewers,stransky,bwc
From: Byron Campen <docfaraday@gmail.com>
Date: Fri, 31 Mar 2023 16:21:00 -0500
Subject: Bug 1822194 - (fix-acabb3641b) Break the new SetParametersCallback
stuff into stand-alone files.
Originally DMABufs were imported into a temporary buffer followed by a
copy operation into the desktop frame itself. This is not needed as we
can import them directly into desktop frames and avoid this overhead.
Also drop support for MemPtr buffers as both Mutter and KWin don't seem
to support them and they are going to be too slow anyway.
Testing with latest Chromium, I could see two processes with usage
around 20% and 40% without this change going down to 10% and 20% with
this change applied.
Also drop old DmaBuf support.
Differential Revision: https://phabricator.services.mozilla.com/D173021
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/581fe5ce66f9f3c725f5345b3e57407d1ec1e312
acabb3641b from upstream added a callback mechanism to allow failures to be
propagated back to RTCRtpSender.setParameters. Unfortunately, this callback
mechanism was (needlessly) tightly coupled to libwebrtc's implementation of
RTCRtpSender, and also their media channel code. This introduced a lot of
unnecessary dependencies throughout libwebrtc, that spilled into our code as
well.
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/59232687efa00e5f7b7bd3d6befca129149e2bf5
---
.../linux/wayland/egl_dmabuf.cc | 114 +++++++---
.../linux/wayland/egl_dmabuf.h | 16 +-
.../linux/wayland/shared_screencast_stream.cc | 209 +++++++++---------
3 files changed, 201 insertions(+), 138 deletions(-)
api/BUILD.gn | 14 +++++++++++-
api/rtp_sender_interface.h | 4 ++--
api/rtp_sender_setparameters_callback.cc | 27 +++++++++++++++++++++++
api/rtp_sender_setparameters_callback.h | 28 ++++++++++++++++++++++++
call/BUILD.gn | 4 ++--
call/audio_send_stream.h | 2 +-
call/video_send_stream.h | 2 +-
media/BUILD.gn | 2 +-
media/base/media_channel.h | 4 ----
media/base/media_channel_impl.cc | 13 -----------
video/BUILD.gn | 4 ++--
11 files changed, 77 insertions(+), 27 deletions(-)
create mode 100644 api/rtp_sender_setparameters_callback.cc
create mode 100644 api/rtp_sender_setparameters_callback.h
diff --git a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
index 80da597e29..6a019c64b4 100644
--- a/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
@@ -102,11 +102,23 @@ typedef void (*glDeleteTextures_func)(GLsizei n, const GLuint* textures);
typedef void (*glGenTextures_func)(GLsizei n, GLuint* textures);
typedef GLenum (*glGetError_func)(void);
typedef const GLubyte* (*glGetString_func)(GLenum name);
-typedef void (*glGetTexImage_func)(GLenum target,
- GLint level,
- GLenum format,
- GLenum type,
- void* pixels);
+typedef void (*glReadPixels_func)(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void* data);
+typedef void (*glGenFramebuffers_func)(GLsizei n, GLuint* ids);
+typedef void (*glDeleteFramebuffers_func)(GLsizei n,
+ const GLuint* framebuffers);
+typedef void (*glBindFramebuffer_func)(GLenum target, GLuint framebuffer);
+typedef void (*glFramebufferTexture2D_func)(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level);
+typedef GLenum (*glCheckFramebufferStatus_func)(GLenum target);
typedef void (*glTexParameteri_func)(GLenum target, GLenum pname, GLint param);
typedef void* (*glXGetProcAddressARB_func)(const char*);
@@ -119,7 +131,12 @@ glDeleteTextures_func GlDeleteTextures = nullptr;
glGenTextures_func GlGenTextures = nullptr;
glGetError_func GlGetError = nullptr;
glGetString_func GlGetString = nullptr;
-glGetTexImage_func GlGetTexImage = nullptr;
+glReadPixels_func GlReadPixels = nullptr;
+glGenFramebuffers_func GlGenFramebuffers = nullptr;
+glDeleteFramebuffers_func GlDeleteFramebuffers = nullptr;
+glBindFramebuffer_func GlBindFramebuffer = nullptr;
+glFramebufferTexture2D_func GlFramebufferTexture2D = nullptr;
+glCheckFramebufferStatus_func GlCheckFramebufferStatus = nullptr;
glTexParameteri_func GlTexParameteri = nullptr;
glXGetProcAddressARB_func GlXGetProcAddressARB = nullptr;
@@ -300,12 +317,26 @@ static bool LoadGL() {
(glDeleteTextures_func)GlXGetProcAddressARB("glDeleteTextures");
GlGenTextures = (glGenTextures_func)GlXGetProcAddressARB("glGenTextures");
GlGetError = (glGetError_func)GlXGetProcAddressARB("glGetError");
- GlGetTexImage = (glGetTexImage_func)GlXGetProcAddressARB("glGetTexImage");
+ GlReadPixels = (glReadPixels_func)GlXGetProcAddressARB("glReadPixels");
+ GlGenFramebuffers =
+ (glGenFramebuffers_func)GlXGetProcAddressARB("glGenFramebuffers");
+ GlDeleteFramebuffers =
+ (glDeleteFramebuffers_func)GlXGetProcAddressARB("glDeleteFramebuffers");
+ GlBindFramebuffer =
+ (glBindFramebuffer_func)GlXGetProcAddressARB("glBindFramebuffer");
+ GlFramebufferTexture2D = (glFramebufferTexture2D_func)GlXGetProcAddressARB(
+ "glFramebufferTexture2D");
+ GlCheckFramebufferStatus =
+ (glCheckFramebufferStatus_func)GlXGetProcAddressARB(
+ "glCheckFramebufferStatus");
+
GlTexParameteri =
(glTexParameteri_func)GlXGetProcAddressARB("glTexParameteri");
return GlBindTexture && GlDeleteTextures && GlGenTextures && GlGetError &&
- GlGetTexImage && GlTexParameteri;
+ GlReadPixels && GlGenFramebuffers && GlDeleteFramebuffers &&
+ GlBindFramebuffer && GlFramebufferTexture2D &&
+ GlCheckFramebufferStatus && GlTexParameteri;
}
return false;
@@ -461,6 +492,14 @@ EglDmaBuf::~EglDmaBuf() {
EglTerminate(egl_.display);
}
+ if (fbo_) {
+ GlDeleteFramebuffers(1, &fbo_);
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 3f313e2743..56afc5efce 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -214,8 +214,8 @@ rtc_library("rtp_sender_interface") {
":dtmf_sender_interface",
":frame_transformer_interface",
":media_stream_interface",
- ":rtc_error",
":rtp_parameters",
+ ":rtp_sender_setparameters_callback",
":scoped_refptr",
"../rtc_base:checks",
"../rtc_base:refcount",
@@ -223,6 +223,18 @@ rtc_library("rtp_sender_interface") {
"crypto:frame_encryptor_interface",
"video_codecs:video_codecs_api",
]
+}
+
+ if (texture_) {
+ GlDeleteTextures(1, &texture_);
+ }
+rtc_library("rtp_sender_setparameters_callback") {
+ visibility = [ "*" ]
+
// BUG: crbug.com/1290566
// Closing libEGL.so.1 when using NVidia drivers causes a crash
// when EglGetPlatformDisplayEXT() is used, at least this one is enough
@@ -492,20 +531,20 @@ bool EglDmaBuf::GetClientExtensions(EGLDisplay dpy, EGLint name) {
+ sources = [
+ "rtp_sender_setparameters_callback.cc",
+ "rtp_sender_setparameters_callback.h",
+ ]
+ deps = [
+ ":rtc_error",
+ ]
absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
}
RTC_NO_SANITIZE("cfi-icall")
-std::unique_ptr<uint8_t[]> EglDmaBuf::ImageFromDmaBuf(
- const DesktopSize& size,
- uint32_t format,
- const std::vector<PlaneData>& plane_datas,
- uint64_t modifier) {
- std::unique_ptr<uint8_t[]> src;
diff --git a/api/rtp_sender_interface.h b/api/rtp_sender_interface.h
index 2786a2ac19..98ee91b1cc 100644
--- a/api/rtp_sender_interface.h
+++ b/api/rtp_sender_interface.h
@@ -32,9 +32,9 @@
#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
-namespace webrtc {
+#include "api/rtp_sender_setparameters_callback.h"
-using SetParametersCallback = absl::AnyInvocable<void(RTCError) &&>;
+namespace webrtc {
class RTC_EXPORT RtpSenderInterface : public rtc::RefCountInterface {
public:
diff --git a/api/rtp_sender_setparameters_callback.cc b/api/rtp_sender_setparameters_callback.cc
new file mode 100644
index 0000000000..99728ef95e
--- /dev/null
+++ b/api/rtp_sender_setparameters_callback.cc
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// File added by mozilla, to decouple this from libwebrtc's implementation of
+// RTCRtpSender.
+
+#include "api/rtp_sender_setparameters_callback.h"
+
+namespace webrtc {
+
+webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
+ RTCError error) {
+ if (callback) {
+ std::move(callback)(error);
+ callback = nullptr;
+ }
+ return error;
+}
+
+} // namespace webrtc
diff --git a/api/rtp_sender_setparameters_callback.h b/api/rtp_sender_setparameters_callback.h
new file mode 100644
index 0000000000..45194f5ace
--- /dev/null
+++ b/api/rtp_sender_setparameters_callback.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// File added by mozilla, to decouple this from libwebrtc's implementation of
+// RTCRtpSender.
+
+#ifndef API_RTP_SENDER_SETPARAMETERS_CALLBACK_H_
+#define API_RTP_SENDER_SETPARAMETERS_CALLBACK_H_
+
+#include "api/rtc_error.h"
+#include "absl/functional/any_invocable.h"
+
+namespace webrtc {
+
+using SetParametersCallback = absl::AnyInvocable<void(RTCError) &&>;
+
+webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
+ RTCError error);
+} // namespace webrtc
+
+#endif // API_RTP_SENDER_SETPARAMETERS_CALLBACK_H_
diff --git a/call/BUILD.gn b/call/BUILD.gn
index fb23b7ef39..2bc7aaec92 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -52,7 +52,7 @@ rtc_library("call_interfaces") {
"../api:rtc_error",
"../api:rtp_headers",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api:transport_api",
"../api/adaptation:resource_adaptation_api",
@@ -389,7 +389,7 @@ rtc_library("video_stream_api") {
"../api:frame_transformer_interface",
"../api:rtp_headers",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api:transport_api",
"../api/adaptation:resource_adaptation_api",
diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h
index bafa22d312..187ec65ed8 100644
--- a/call/audio_send_stream.h
+++ b/call/audio_send_stream.h
@@ -25,7 +25,7 @@
#include "api/crypto/frame_encryptor_interface.h"
#include "api/frame_transformer_interface.h"
#include "api/rtp_parameters.h"
-#include "api/rtp_sender_interface.h"
+#include "api/rtp_sender_setparameters_callback.h"
#include "api/scoped_refptr.h"
#include "call/audio_sender.h"
#include "call/rtp_config.h"
diff --git a/call/video_send_stream.h b/call/video_send_stream.h
index 431c267e1e..de18fc7b92 100644
--- a/call/video_send_stream.h
+++ b/call/video_send_stream.h
@@ -23,7 +23,7 @@
#include "api/crypto/crypto_options.h"
#include "api/frame_transformer_interface.h"
#include "api/rtp_parameters.h"
-#include "api/rtp_sender_interface.h"
+#include "api/rtp_sender_setparameters_callback.h"
#include "api/scoped_refptr.h"
#include "api/video/video_content_type.h"
#include "api/video/video_frame.h"
diff --git a/media/BUILD.gn b/media/BUILD.gn
index daca67e033..80662563b0 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -64,7 +64,7 @@ rtc_library("rtc_media_base") {
"../api:media_stream_interface",
"../api:rtc_error",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api:sequence_checker",
"../api:transport_api",
diff --git a/media/base/media_channel.h b/media/base/media_channel.h
index 43e09290bd..138d28ae4c 100644
--- a/media/base/media_channel.h
+++ b/media/base/media_channel.h
@@ -64,10 +64,6 @@ class Timing;
namespace webrtc {
class VideoFrame;
-
+bool EglDmaBuf::ImageFromDmaBuf(const DesktopSize& size,
+ uint32_t format,
+ const std::vector<PlaneData>& plane_datas,
+ uint64_t modifier,
+ const DesktopVector& offset,
+ const DesktopSize& buffer_size,
+ uint8_t* data) {
if (!egl_initialized_) {
- return src;
+ return false;
}
if (plane_datas.size() <= 0) {
RTC_LOG(LS_ERROR) << "Failed to process buffer: invalid number of planes";
- return src;
+ return false;
}
EGLint attribs[47];
@@ -594,20 +633,32 @@ std::unique_ptr<uint8_t[]> EglDmaBuf::ImageFromDmaBuf(
if (image == EGL_NO_IMAGE) {
RTC_LOG(LS_ERROR) << "Failed to record frame: Error creating EGLImage - "
<< FormatEGLError(EglGetError());
- return src;
+ return false;
}
// create GL 2D texture for framebuffer
- GLuint texture;
- GlGenTextures(1, &texture);
- GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- GlBindTexture(GL_TEXTURE_2D, texture);
+ if (!texture_) {
+ GlGenTextures(1, &texture_);
+ GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ GlTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ }
+ GlBindTexture(GL_TEXTURE_2D, texture_);
GlEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
- src = std::make_unique<uint8_t[]>(plane_datas[0].stride * size.height());
+ if (!fbo_) {
+ GlGenFramebuffers(1, &fbo_);
+ }
+
+ GlBindFramebuffer(GL_FRAMEBUFFER, fbo_);
+ GlFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ texture_, 0);
+ if (GlCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
+ RTC_LOG(LS_ERROR) << "Failed to bind DMA buf framebuffer";
+ EglDestroyImageKHR(egl_.display, image);
+ return false;
+ }
GLenum gl_format = GL_BGRA;
switch (format) {
@@ -624,17 +675,18 @@ std::unique_ptr<uint8_t[]> EglDmaBuf::ImageFromDmaBuf(
gl_format = GL_BGRA;
break;
}
- GlGetTexImage(GL_TEXTURE_2D, 0, gl_format, GL_UNSIGNED_BYTE, src.get());
- if (GlGetError()) {
+ GlReadPixels(offset.x(), offset.y(), buffer_size.width(),
+ buffer_size.height(), gl_format, GL_UNSIGNED_BYTE, data);
+
+ const GLenum error = GlGetError();
+ if (error) {
RTC_LOG(LS_ERROR) << "Failed to get image from DMA buffer.";
- return src;
}
- GlDeleteTextures(1, &texture);
EglDestroyImageKHR(egl_.display, image);
- return src;
+ return !error;
}
RTC_NO_SANITIZE("cfi-icall")
diff --git a/modules/desktop_capture/linux/wayland/egl_dmabuf.h b/modules/desktop_capture/linux/wayland/egl_dmabuf.h
index f1d96b2f80..22a8f5ab52 100644
--- a/modules/desktop_capture/linux/wayland/egl_dmabuf.h
+++ b/modules/desktop_capture/linux/wayland/egl_dmabuf.h
@@ -41,11 +41,15 @@ class EglDmaBuf {
EglDmaBuf();
~EglDmaBuf();
- std::unique_ptr<uint8_t[]> ImageFromDmaBuf(
- const DesktopSize& size,
- uint32_t format,
- const std::vector<PlaneData>& plane_datas,
- uint64_t modifiers);
+ // Returns whether the image was successfully imported from
+ // given DmaBuf and its parameters
+ bool ImageFromDmaBuf(const DesktopSize& size,
+ uint32_t format,
+ const std::vector<PlaneData>& plane_datas,
+ uint64_t modifiers,
+ const DesktopVector& offset,
+ const DesktopSize& buffer_size,
+ uint8_t* data);
std::vector<uint64_t> QueryDmaBufModifiers(uint32_t format);
bool IsEglInitialized() const { return egl_initialized_; }
@@ -58,6 +62,8 @@ class EglDmaBuf {
int32_t drm_fd_ = -1; // for GBM buffer mmap
gbm_device* gbm_device_ = nullptr; // for passed GBM buffer retrieval
+ GLuint fbo_ = 0;
+ GLuint texture_ = 0;
EGLStruct egl_;
absl::optional<std::string> GetRenderNode();
diff --git a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
index 71bde9b212..bcd7e3a33c 100644
--- a/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
+++ b/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
@@ -38,7 +38,6 @@ constexpr int CursorMetaSize(int w, int h) {
w * h * kCursorBpp);
}
-constexpr PipeWireVersion kDmaBufMinVersion = {0, 3, 24};
constexpr PipeWireVersion kDmaBufModifierMinVersion = {0, 3, 33};
constexpr PipeWireVersion kDropSingleModifierMinVersion = {0, 3, 40};
@@ -155,6 +154,12 @@ class SharedScreenCastStreamPrivate {
struct spa_video_info_raw spa_video_format_;
void ProcessBuffer(pw_buffer* buffer);
+ bool ProcessMemFDBuffer(pw_buffer* buffer,
+ DesktopFrame& frame,
+ const DesktopVector& offset);
+ bool ProcessDMABuffer(pw_buffer* buffer,
+ DesktopFrame& frame,
+ const DesktopVector& offset);
void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size);
// PipeWire callbacks
@@ -277,10 +282,9 @@ void SharedScreenCastStreamPrivate::OnStreamParamChanged(
has_modifier ? that->spa_video_format_.modifier : DRM_FORMAT_MOD_INVALID;
std::vector<const spa_pod*> params;
const int buffer_types =
- has_modifier || (that->pw_server_version_ >= kDmaBufMinVersion)
- ? (1 << SPA_DATA_DmaBuf) | (1 << SPA_DATA_MemFd) |
- (1 << SPA_DATA_MemPtr)
- : (1 << SPA_DATA_MemFd) | (1 << SPA_DATA_MemPtr);
+ has_modifier
+ ? (1 << SPA_DATA_DmaBuf) | (1 << SPA_DATA_MemFd)
+ : (1 << SPA_DATA_MemFd);
params.push_back(reinterpret_cast<spa_pod*>(spa_pod_builder_add_object(
&builder, SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
@@ -613,9 +617,6 @@ DesktopVector SharedScreenCastStreamPrivate::CaptureCursorPosition() {
RTC_NO_SANITIZE("cfi-icall")
void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
spa_buffer* spa_buffer = buffer->buffer;
- ScopedBuf map;
- std::unique_ptr<uint8_t[]> src_unique_ptr;
- uint8_t* src = nullptr;
// Try to update the mouse cursor first, because it can be the only
// information carried by the buffer
@@ -657,79 +658,6 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
return;
}
- if (spa_buffer->datas[0].type == SPA_DATA_MemFd) {
- map.initialize(
- static_cast<uint8_t*>(
- mmap(nullptr,
- spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
- PROT_READ, MAP_PRIVATE, spa_buffer->datas[0].fd, 0)),
- spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
- spa_buffer->datas[0].fd);
-webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
- RTCError error);
-
- if (!map) {
- RTC_LOG(LS_ERROR) << "Failed to mmap the memory: "
- << std::strerror(errno);
- return;
} // namespace webrtc
namespace cricket {
diff --git a/media/base/media_channel_impl.cc b/media/base/media_channel_impl.cc
index a72b97413d..0e72f47d6d 100644
--- a/media/base/media_channel_impl.cc
+++ b/media/base/media_channel_impl.cc
@@ -31,19 +31,6 @@
#include "modules/rtp_rtcp/include/report_block_data.h"
#include "rtc_base/checks.h"
-namespace webrtc {
-
-webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
- RTCError error) {
- if (callback) {
- std::move(callback)(error);
- callback = nullptr;
- }
- return error;
-}
-
- src = SPA_MEMBER(map.get(), spa_buffer->datas[0].mapoffset, uint8_t);
- } else if (spa_buffer->datas[0].type == SPA_DATA_DmaBuf) {
- const uint n_planes = spa_buffer->n_datas;
-} // namespace webrtc
-
- if (!n_planes) {
- return;
- }
-
- std::vector<EglDmaBuf::PlaneData> plane_datas;
- for (uint32_t i = 0; i < n_planes; ++i) {
- EglDmaBuf::PlaneData data = {
- static_cast<int32_t>(spa_buffer->datas[i].fd),
- static_cast<uint32_t>(spa_buffer->datas[i].chunk->stride),
- static_cast<uint32_t>(spa_buffer->datas[i].chunk->offset)};
- plane_datas.push_back(data);
- }
-
- // When importing DMA-BUFs, we use the stride (number of bytes from one row
- // of pixels in the buffer) provided by PipeWire. The stride from PipeWire
- // is given by the graphics driver and some drivers might add some
- // additional padding for memory layout optimizations so not everytime the
- // stride is equal to BYTES_PER_PIXEL x WIDTH. This is fine, because during
- // the import we will use OpenGL and same graphics driver so it will be able
- // to work with the stride it provided, but later on when we work with
- // images we get from DMA-BUFs we will need to update the stride to be equal
- // to BYTES_PER_PIXEL x WIDTH as that's the size of the DesktopFrame we
- // allocate for each captured frame.
- src_unique_ptr = egl_dmabuf_->ImageFromDmaBuf(
- stream_size_, spa_video_format_.format, plane_datas, modifier_);
- if (src_unique_ptr) {
- src = src_unique_ptr.get();
- } else {
- RTC_LOG(LS_ERROR) << "Dropping DMA-BUF modifier: " << modifier_
- << " and trying to renegotiate stream parameters";
-
- if (pw_server_version_ >= kDropSingleModifierMinVersion) {
- modifiers_.erase(
- std::remove(modifiers_.begin(), modifiers_.end(), modifier_),
- modifiers_.end());
- } else {
- modifiers_.clear();
- }
-
- pw_loop_signal_event(pw_thread_loop_get_loop(pw_main_loop_),
- renegotiate_);
- return;
- }
- } else if (spa_buffer->datas[0].type == SPA_DATA_MemPtr) {
- src = static_cast<uint8_t*>(spa_buffer->datas[0].data);
- }
-
- if (!src) {
- if (observer_) {
- observer_->OnFailedToProcessBuffer();
- }
- return;
- }
-
// Use SPA_META_VideoCrop metadata to get the frame size. KDE and GNOME do
// handle screen/window sharing differently. KDE/KWin doesn't use
// SPA_META_VideoCrop metadata and when sharing a window, it always sets
@@ -787,8 +715,8 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
}
// Get the position of the video crop within the stream. Just double-check
- // that the position doesn't exceed the size of the stream itself. NOTE:
- // Currently it looks there is no implementation using this.
+ // that the position doesn't exceed the size of the stream itself.
+ // NOTE: Currently it looks there is no implementation using this.
uint32_t y_offset =
videocrop_metadata_use &&
(videocrop_metadata->region.position.y + frame_size_.height() <=
@@ -801,22 +729,7 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
stream_size_.width())
? videocrop_metadata->region.position.x
: 0;
-
- const uint32_t stream_stride = kBytesPerPixel * stream_size_.width();
- uint32_t buffer_stride = spa_buffer->datas[0].chunk->stride;
- uint32_t src_stride = buffer_stride;
-
- if (spa_buffer->datas[0].type == SPA_DATA_DmaBuf &&
- buffer_stride > stream_stride) {
- // When DMA-BUFs are used, sometimes spa_buffer->stride we get might
- // contain additional padding, but after we import the buffer, the stride
- // we used is no longer relevant and we should just calculate it based on
- // the stream width. For more context see https://crbug.com/1333304.
- src_stride = stream_stride;
- }
-
- uint8_t* updated_src =
- src + (src_stride * y_offset) + (kBytesPerPixel * x_offset);
+ DesktopVector offset = DesktopVector(x_offset, y_offset);
webrtc::MutexLock lock(&queue_lock_);
@@ -836,9 +749,20 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
queue_.ReplaceCurrentFrame(SharedDesktopFrame::Wrap(std::move(frame)));
}
- queue_.current_frame()->CopyPixelsFrom(
- updated_src, (src_stride - (kBytesPerPixel * x_offset)),
- DesktopRect::MakeWH(frame_size_.width(), frame_size_.height()));
+ bool bufferProcessed = false;
+ if (spa_buffer->datas[0].type == SPA_DATA_MemFd) {
+ bufferProcessed =
+ ProcessMemFDBuffer(buffer, *queue_.current_frame(), offset);
+ } else if (spa_buffer->datas[0].type == SPA_DATA_DmaBuf) {
+ bufferProcessed = ProcessDMABuffer(buffer, *queue_.current_frame(), offset);
+ }
+
+ if (!bufferProcessed) {
+ if (observer_) {
+ observer_->OnFailedToProcessBuffer();
+ }
+ return;
+ }
if (spa_video_format_.format == SPA_VIDEO_FORMAT_RGBx ||
spa_video_format_.format == SPA_VIDEO_FORMAT_RGBA) {
@@ -885,6 +809,87 @@ void SharedScreenCastStreamPrivate::ProcessBuffer(pw_buffer* buffer) {
queue_.current_frame()->set_may_contain_cursor(is_cursor_embedded_);
}
+RTC_NO_SANITIZE("cfi-icall")
+bool SharedScreenCastStreamPrivate::ProcessMemFDBuffer(
+ pw_buffer* buffer,
+ DesktopFrame& frame,
+ const DesktopVector& offset) {
+ spa_buffer* spa_buffer = buffer->buffer;
+ ScopedBuf map;
+ uint8_t* src = nullptr;
+
+ map.initialize(
+ static_cast<uint8_t*>(
+ mmap(nullptr,
+ spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
+ PROT_READ, MAP_PRIVATE, spa_buffer->datas[0].fd, 0)),
+ spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
+ spa_buffer->datas[0].fd);
+
+ if (!map) {
+ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno);
+ return false;
+ }
+
+ src = SPA_MEMBER(map.get(), spa_buffer->datas[0].mapoffset, uint8_t);
+
+ uint32_t buffer_stride = spa_buffer->datas[0].chunk->stride;
+ uint32_t src_stride = buffer_stride;
+
+ uint8_t* updated_src =
+ src + (src_stride * offset.y()) + (kBytesPerPixel * offset.x());
+
+ frame.CopyPixelsFrom(
+ updated_src, (src_stride - (kBytesPerPixel * offset.x())),
+ DesktopRect::MakeWH(frame.size().width(), frame.size().height()));
+
+ return true;
+}
+
+RTC_NO_SANITIZE("cfi-icall")
+bool SharedScreenCastStreamPrivate::ProcessDMABuffer(
+ pw_buffer* buffer,
+ DesktopFrame& frame,
+ const DesktopVector& offset) {
+ spa_buffer* spa_buffer = buffer->buffer;
+
+ const uint n_planes = spa_buffer->n_datas;
+
+ if (!n_planes) {
+ return false;
+ }
+
+ std::vector<EglDmaBuf::PlaneData> plane_datas;
+ for (uint32_t i = 0; i < n_planes; ++i) {
+ EglDmaBuf::PlaneData data = {
+ static_cast<int32_t>(spa_buffer->datas[i].fd),
+ static_cast<uint32_t>(spa_buffer->datas[i].chunk->stride),
+ static_cast<uint32_t>(spa_buffer->datas[i].chunk->offset)};
+ plane_datas.push_back(data);
+ }
+
+ const bool imported = egl_dmabuf_->ImageFromDmaBuf(
+ stream_size_, spa_video_format_.format, plane_datas, modifier_, offset,
+ frame.size(), frame.data());
+ if (!imported) {
+ RTC_LOG(LS_ERROR) << "Dropping DMA-BUF modifier: " << modifier_
+ << " and trying to renegotiate stream parameters";
+
+ if (pw_server_version_ >= kDropSingleModifierMinVersion) {
+ modifiers_.erase(
+ std::remove(modifiers_.begin(), modifiers_.end(), modifier_),
+ modifiers_.end());
+ } else {
+ modifiers_.clear();
+ }
+
+ pw_loop_signal_event(pw_thread_loop_get_loop(pw_main_loop_), renegotiate_);
+ return false;
+ }
+
+ return true;
+}
+
void SharedScreenCastStreamPrivate::ConvertRGBxToBGRx(uint8_t* frame,
uint32_t size) {
for (uint32_t i = 0; i < size; i += 4) {
namespace cricket {
using webrtc::FrameDecryptorInterface;
using webrtc::FrameEncryptorInterface;
diff --git a/video/BUILD.gn b/video/BUILD.gn
index e21e1c7ea8..2c0a411e35 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -17,7 +17,7 @@ rtc_library("video_stream_encoder_interface") {
"../api:fec_controller_api",
"../api:rtc_error",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api/adaptation:resource_adaptation_api",
"../api/units:data_rate",
@@ -410,7 +410,7 @@ rtc_library("video_stream_encoder_impl") {
":video_stream_encoder_interface",
"../api:field_trials_view",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:sequence_checker",
"../api/adaptation:resource_adaptation_api",
"../api/task_queue:pending_task_safety_flag",
--
2.34.1

Просмотреть файл

@ -1,269 +1,25 @@
From: Byron Campen <docfaraday@gmail.com>
Date: Fri, 31 Mar 2023 16:21:00 -0500
Subject: Bug 1822194 - (fix-acabb3641b) Break the new SetParametersCallback
stuff into stand-alone files.
Date: Tue, 4 Apr 2023 16:34:00 -0500
Subject: Bug 1822194 - (fix-3b51cd328e) - Add missing designated initializer
that gcc is sad about.
acabb3641b from upstream added a callback mechanism to allow failures to be
propagated back to RTCRtpSender.setParameters. Unfortunately, this callback
mechanism was (needlessly) tightly coupled to libwebrtc's implementation of
RTCRtpSender, and also their media channel code. This introduced a lot of
unnecessary dependencies throughout libwebrtc, that spilled into our code as
well.
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/59232687efa00e5f7b7bd3d6befca129149e2bf5
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/108046c7cbb21c6cf19320c0804e9aee1a3eb4bf
---
api/BUILD.gn | 14 +++++++++++-
api/rtp_sender_interface.h | 4 ++--
api/rtp_sender_setparameters_callback.cc | 27 +++++++++++++++++++++++
api/rtp_sender_setparameters_callback.h | 28 ++++++++++++++++++++++++
call/BUILD.gn | 4 ++--
call/audio_send_stream.h | 2 +-
call/video_send_stream.h | 2 +-
media/BUILD.gn | 2 +-
media/base/media_channel.h | 4 ----
media/base/media_channel_impl.cc | 13 -----------
video/BUILD.gn | 4 ++--
11 files changed, 77 insertions(+), 27 deletions(-)
create mode 100644 api/rtp_sender_setparameters_callback.cc
create mode 100644 api/rtp_sender_setparameters_callback.h
modules/audio_processing/audio_processing_impl.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 3f313e2743..56afc5efce 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -214,8 +214,8 @@ rtc_library("rtp_sender_interface") {
":dtmf_sender_interface",
":frame_transformer_interface",
":media_stream_interface",
- ":rtc_error",
":rtp_parameters",
+ ":rtp_sender_setparameters_callback",
":scoped_refptr",
"../rtc_base:checks",
"../rtc_base:refcount",
@@ -223,6 +223,18 @@ rtc_library("rtp_sender_interface") {
"crypto:frame_encryptor_interface",
"video_codecs:video_codecs_api",
]
+}
+
+rtc_library("rtp_sender_setparameters_callback") {
+ visibility = [ "*" ]
+
+ sources = [
+ "rtp_sender_setparameters_callback.cc",
+ "rtp_sender_setparameters_callback.h",
+ ]
+ deps = [
+ ":rtc_error",
+ ]
absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
}
diff --git a/api/rtp_sender_interface.h b/api/rtp_sender_interface.h
index 2786a2ac19..98ee91b1cc 100644
--- a/api/rtp_sender_interface.h
+++ b/api/rtp_sender_interface.h
@@ -32,9 +32,9 @@
#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
-namespace webrtc {
+#include "api/rtp_sender_setparameters_callback.h"
-using SetParametersCallback = absl::AnyInvocable<void(RTCError) &&>;
+namespace webrtc {
class RTC_EXPORT RtpSenderInterface : public rtc::RefCountInterface {
public:
diff --git a/api/rtp_sender_setparameters_callback.cc b/api/rtp_sender_setparameters_callback.cc
new file mode 100644
index 0000000000..99728ef95e
--- /dev/null
+++ b/api/rtp_sender_setparameters_callback.cc
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// File added by mozilla, to decouple this from libwebrtc's implementation of
+// RTCRtpSender.
+
+#include "api/rtp_sender_setparameters_callback.h"
+
+namespace webrtc {
+
+webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
+ RTCError error) {
+ if (callback) {
+ std::move(callback)(error);
+ callback = nullptr;
+ }
+ return error;
+}
+
+} // namespace webrtc
diff --git a/api/rtp_sender_setparameters_callback.h b/api/rtp_sender_setparameters_callback.h
new file mode 100644
index 0000000000..45194f5ace
--- /dev/null
+++ b/api/rtp_sender_setparameters_callback.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// File added by mozilla, to decouple this from libwebrtc's implementation of
+// RTCRtpSender.
+
+#ifndef API_RTP_SENDER_SETPARAMETERS_CALLBACK_H_
+#define API_RTP_SENDER_SETPARAMETERS_CALLBACK_H_
+
+#include "api/rtc_error.h"
+#include "absl/functional/any_invocable.h"
+
+namespace webrtc {
+
+using SetParametersCallback = absl::AnyInvocable<void(RTCError) &&>;
+
+webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
+ RTCError error);
+} // namespace webrtc
+
+#endif // API_RTP_SENDER_SETPARAMETERS_CALLBACK_H_
diff --git a/call/BUILD.gn b/call/BUILD.gn
index fb23b7ef39..2bc7aaec92 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -52,7 +52,7 @@ rtc_library("call_interfaces") {
"../api:rtc_error",
"../api:rtp_headers",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api:transport_api",
"../api/adaptation:resource_adaptation_api",
@@ -389,7 +389,7 @@ rtc_library("video_stream_api") {
"../api:frame_transformer_interface",
"../api:rtp_headers",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api:transport_api",
"../api/adaptation:resource_adaptation_api",
diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h
index bafa22d312..187ec65ed8 100644
--- a/call/audio_send_stream.h
+++ b/call/audio_send_stream.h
@@ -25,7 +25,7 @@
#include "api/crypto/frame_encryptor_interface.h"
#include "api/frame_transformer_interface.h"
#include "api/rtp_parameters.h"
-#include "api/rtp_sender_interface.h"
+#include "api/rtp_sender_setparameters_callback.h"
#include "api/scoped_refptr.h"
#include "call/audio_sender.h"
#include "call/rtp_config.h"
diff --git a/call/video_send_stream.h b/call/video_send_stream.h
index 431c267e1e..de18fc7b92 100644
--- a/call/video_send_stream.h
+++ b/call/video_send_stream.h
@@ -23,7 +23,7 @@
#include "api/crypto/crypto_options.h"
#include "api/frame_transformer_interface.h"
#include "api/rtp_parameters.h"
-#include "api/rtp_sender_interface.h"
+#include "api/rtp_sender_setparameters_callback.h"
#include "api/scoped_refptr.h"
#include "api/video/video_content_type.h"
#include "api/video/video_frame.h"
diff --git a/media/BUILD.gn b/media/BUILD.gn
index daca67e033..80662563b0 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -64,7 +64,7 @@ rtc_library("rtc_media_base") {
"../api:media_stream_interface",
"../api:rtc_error",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api:sequence_checker",
"../api:transport_api",
diff --git a/media/base/media_channel.h b/media/base/media_channel.h
index 43e09290bd..138d28ae4c 100644
--- a/media/base/media_channel.h
+++ b/media/base/media_channel.h
@@ -64,10 +64,6 @@ class Timing;
namespace webrtc {
class VideoFrame;
-
-webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
- RTCError error);
-
} // namespace webrtc
namespace cricket {
diff --git a/media/base/media_channel_impl.cc b/media/base/media_channel_impl.cc
index a72b97413d..0e72f47d6d 100644
--- a/media/base/media_channel_impl.cc
+++ b/media/base/media_channel_impl.cc
@@ -31,19 +31,6 @@
#include "modules/rtp_rtcp/include/report_block_data.h"
#include "rtc_base/checks.h"
-namespace webrtc {
-
-webrtc::RTCError InvokeSetParametersCallback(SetParametersCallback& callback,
- RTCError error) {
- if (callback) {
- std::move(callback)(error);
- callback = nullptr;
- }
- return error;
-}
-
-} // namespace webrtc
-
namespace cricket {
using webrtc::FrameDecryptorInterface;
using webrtc::FrameEncryptorInterface;
diff --git a/video/BUILD.gn b/video/BUILD.gn
index e21e1c7ea8..2c0a411e35 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -17,7 +17,7 @@ rtc_library("video_stream_encoder_interface") {
"../api:fec_controller_api",
"../api:rtc_error",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:scoped_refptr",
"../api/adaptation:resource_adaptation_api",
"../api/units:data_rate",
@@ -410,7 +410,7 @@ rtc_library("video_stream_encoder_impl") {
":video_stream_encoder_interface",
"../api:field_trials_view",
"../api:rtp_parameters",
- "../api:rtp_sender_interface",
+ "../api:rtp_sender_setparameters_callback",
"../api:sequence_checker",
"../api/adaptation:resource_adaptation_api",
"../api/task_queue:pending_task_safety_flag",
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index c80cc76a3d..c304453388 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -450,6 +450,7 @@ AudioProcessingImpl::GetGainController2ExperimentParams() {
},
.adaptive_digital_controller =
{
+ .enabled = false,
.headroom_db = static_cast<float>(headroom_db.Get()),
.max_gain_db = static_cast<float>(max_gain_db.Get()),
.initial_gain_db =
--
2.34.1

Просмотреть файл

@ -1,25 +1,27 @@
From: Byron Campen <docfaraday@gmail.com>
Date: Tue, 4 Apr 2023 16:34:00 -0500
Subject: Bug 1822194 - (fix-3b51cd328e) - Add missing designated initializer
that gcc is sad about.
Date: Fri, 7 Apr 2023 20:28:00 +0000
Subject: Bug 1819048: Remove this bad assertion. r=webrtc-reviewers,jib
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/108046c7cbb21c6cf19320c0804e9aee1a3eb4bf
Differential Revision: https://phabricator.services.mozilla.com/D174978
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5a52e1b0c808edfda82f0abea668699eb68098dc
---
modules/audio_processing/audio_processing_impl.cc | 1 +
1 file changed, 1 insertion(+)
video/task_queue_frame_decode_scheduler.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index c80cc76a3d..c304453388 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -450,6 +450,7 @@ AudioProcessingImpl::GetGainController2ExperimentParams() {
},
.adaptive_digital_controller =
{
+ .enabled = false,
.headroom_db = static_cast<float>(headroom_db.Get()),
.max_gain_db = static_cast<float>(max_gain_db.Get()),
.initial_gain_db =
diff --git a/video/task_queue_frame_decode_scheduler.cc b/video/task_queue_frame_decode_scheduler.cc
index cd109c2932..6dd7b47f17 100644
--- a/video/task_queue_frame_decode_scheduler.cc
+++ b/video/task_queue_frame_decode_scheduler.cc
@@ -37,7 +37,8 @@ void TaskQueueFrameDecodeScheduler::ScheduleFrame(
uint32_t rtp,
FrameDecodeTiming::FrameSchedule schedule,
FrameReleaseCallback cb) {
- RTC_DCHECK(!stopped_) << "Can not schedule frames after stopped.";
+ // Mozilla modification, until https://bugs.webrtc.org/14944 is fixed
+ //RTC_DCHECK(!stopped_) << "Can not schedule frames after stopped.";
RTC_DCHECK(!scheduled_rtp_.has_value())
<< "Can not schedule two frames for release at the same time.";
RTC_DCHECK(cb);
--
2.34.1

Просмотреть файл

@ -1,27 +1,146 @@
From: Byron Campen <docfaraday@gmail.com>
Date: Fri, 7 Apr 2023 20:28:00 +0000
Subject: Bug 1819048: Remove this bad assertion. r=webrtc-reviewers,jib
From: Michael Froman <mfroman@mozilla.com>
Date: Thu, 20 Apr 2023 09:59:00 -0500
Subject: Bug 1828517 - (fix-794d599741) account for moved files in BUILD.gn
that we don't want to build.
Differential Revision: https://phabricator.services.mozilla.com/D174978
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/5a52e1b0c808edfda82f0abea668699eb68098dc
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4a969f6709183d4f55215adaffb8a52b790a8492
---
video/task_queue_frame_decode_scheduler.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
api/BUILD.gn | 10 ++++++++++
media/BUILD.gn | 20 ++++++++++----------
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/video/task_queue_frame_decode_scheduler.cc b/video/task_queue_frame_decode_scheduler.cc
index cd109c2932..6dd7b47f17 100644
--- a/video/task_queue_frame_decode_scheduler.cc
+++ b/video/task_queue_frame_decode_scheduler.cc
@@ -37,7 +37,8 @@ void TaskQueueFrameDecodeScheduler::ScheduleFrame(
uint32_t rtp,
FrameDecodeTiming::FrameSchedule schedule,
FrameReleaseCallback cb) {
- RTC_DCHECK(!stopped_) << "Can not schedule frames after stopped.";
+ // Mozilla modification, until https://bugs.webrtc.org/14944 is fixed
+ //RTC_DCHECK(!stopped_) << "Can not schedule frames after stopped.";
RTC_DCHECK(!scheduled_rtp_.has_value())
<< "Can not schedule two frames for release at the same time.";
RTC_DCHECK(cb);
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 56afc5efce..7c16b45e05 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -175,6 +175,10 @@ rtc_source_set("ice_transport_interface") {
}
rtc_library("dtls_transport_interface") {
+# Previously, Mozilla has tried to limit including this dep, but as
+# upstream changes, it requires whack-a-mole. Making it an empty
+# definition has the same effect, but only requires one change.
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
@@ -191,6 +195,7 @@ rtc_library("dtls_transport_interface") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+}
rtc_library("dtmf_sender_interface") {
visibility = [ "*" ]
@@ -203,6 +208,10 @@ rtc_library("dtmf_sender_interface") {
}
rtc_library("rtp_sender_interface") {
+# Previously, Mozilla has tried to limit including this dep, but as
+# upstream changes, it requires whack-a-mole. Making it an empty
+# definition has the same effect, but only requires one change.
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
@@ -224,6 +233,7 @@ rtc_library("rtp_sender_interface") {
"video_codecs:video_codecs_api",
]
}
+}
rtc_library("rtp_sender_setparameters_callback") {
visibility = [ "*" ]
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 80662563b0..36c3aa9d1c 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -154,23 +154,14 @@ rtc_library("rtc_media_base") {
"base/audio_source.h",
"base/delayable.h",
"base/media_channel.h",
- "base/media_channel_impl.cc",
- "base/media_channel_impl.h",
"base/media_engine.cc",
"base/media_engine.h",
- "base/rid_description.cc",
- "base/rid_description.h",
- "base/rtp_utils.cc",
- "base/rtp_utils.h",
- "base/stream_params.cc",
- "base/stream_params.h",
- "base/turn_utils.cc",
- "base/turn_utils.h",
]
}
}
rtc_library("media_channel_impl") {
+if (!build_with_mozilla) {
sources = [
"base/media_channel_impl.cc",
"base/media_channel_impl.h",
@@ -219,6 +210,7 @@ rtc_library("media_channel_impl") {
"//third_party/abseil-cpp/absl/types:optional",
]
}
+}
rtc_source_set("media_channel") {
sources = [ "base/media_channel.h" ]
@@ -292,6 +284,7 @@ rtc_library("codec") {
}
rtc_library("rtp_utils") {
+if (!build_with_mozilla) {
sources = [
"base/rtp_utils.cc",
"base/rtp_utils.h",
@@ -308,8 +301,10 @@ rtc_library("rtp_utils") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
+}
rtc_library("stream_params") {
+if (!build_with_mozilla) {
sources = [
"base/stream_params.cc",
"base/stream_params.h",
@@ -322,6 +317,7 @@ rtc_library("stream_params") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/algorithm:container" ]
}
+}
rtc_library("media_constants") {
sources = [
@@ -332,6 +328,7 @@ rtc_library("media_constants") {
}
rtc_library("turn_utils") {
+if (!build_with_mozilla) {
sources = [
"base/turn_utils.cc",
"base/turn_utils.h",
@@ -342,14 +339,17 @@ rtc_library("turn_utils") {
"../rtc_base/system:rtc_export",
]
}
+}
rtc_library("rid_description") {
+if (!build_with_mozilla) {
sources = [
"base/rid_description.cc",
"base/rid_description.h",
]
deps = []
}
+}
rtc_library("rtc_simulcast_encoder_adapter") {
visibility = [ "*" ]
--
2.34.1

Просмотреть файл

@ -1,146 +1,177 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Thu, 20 Apr 2023 09:59:00 -0500
Subject: Bug 1828517 - (fix-794d599741) account for moved files in BUILD.gn
that we don't want to build.
Date: Thu, 20 Apr 2023 14:52:00 -0500
Subject: Bug 1828517 - (fix-a138c6c8a5) handle file moves in BUILD.gn
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4a969f6709183d4f55215adaffb8a52b790a8492
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/cf7e333da17689b3c115a6ffd07fab042bc5f086
---
api/BUILD.gn | 10 ++++++++++
media/BUILD.gn | 20 ++++++++++----------
2 files changed, 20 insertions(+), 10 deletions(-)
rtc_base/BUILD.gn | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 56afc5efce..7c16b45e05 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -175,6 +175,10 @@ rtc_source_set("ice_transport_interface") {
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 0b1e2a6208..7573a137ab 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -1147,6 +1147,7 @@ if (!build_with_chromium) {
}
rtc_library("dtls_transport_interface") {
+# Previously, Mozilla has tried to limit including this dep, but as
+# upstream changes, it requires whack-a-mole. Making it an empty
+# definition has the same effect, but only requires one change.
rtc_library("network") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
@@ -191,6 +195,7 @@ rtc_library("dtls_transport_interface") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
"network.cc",
@@ -1185,16 +1186,20 @@ rtc_library("network") {
deps += [ ":win32" ]
}
}
+}
rtc_library("dtmf_sender_interface") {
visibility = [ "*" ]
@@ -203,6 +208,10 @@ rtc_library("dtmf_sender_interface") {
}
rtc_library("rtp_sender_interface") {
+# Previously, Mozilla has tried to limit including this dep, but as
+# upstream changes, it requires whack-a-mole. Making it an empty
+# definition has the same effect, but only requires one change.
rtc_library("socket_address_pair") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
@@ -224,6 +233,7 @@ rtc_library("rtp_sender_interface") {
"video_codecs:video_codecs_api",
"socket_address_pair.cc",
"socket_address_pair.h",
]
deps = [ ":socket_address" ]
}
+}
rtc_library("rtp_sender_setparameters_callback") {
visibility = [ "*" ]
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 80662563b0..36c3aa9d1c 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -154,23 +154,14 @@ rtc_library("rtc_media_base") {
"base/audio_source.h",
"base/delayable.h",
"base/media_channel.h",
- "base/media_channel_impl.cc",
- "base/media_channel_impl.h",
"base/media_engine.cc",
"base/media_engine.h",
- "base/rid_description.cc",
- "base/rid_description.h",
- "base/rtp_utils.cc",
- "base/rtp_utils.h",
- "base/stream_params.cc",
- "base/stream_params.h",
- "base/turn_utils.cc",
- "base/turn_utils.h",
]
}
}
rtc_library("media_channel_impl") {
rtc_library("net_helper") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"base/media_channel_impl.cc",
"base/media_channel_impl.h",
@@ -219,6 +210,7 @@ rtc_library("media_channel_impl") {
"//third_party/abseil-cpp/absl/types:optional",
]
"net_helper.cc",
@@ -1203,8 +1208,10 @@ rtc_library("net_helper") {
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
deps = [ "system:rtc_export" ]
}
+}
rtc_source_set("media_channel") {
sources = [ "base/media_channel.h" ]
@@ -292,6 +284,7 @@ rtc_library("codec") {
}
rtc_library("rtp_utils") {
rtc_library("socket_adapters") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"base/rtp_utils.cc",
"base/rtp_utils.h",
@@ -308,8 +301,10 @@ rtc_library("rtp_utils") {
"socket_adapters.cc",
@@ -1224,6 +1231,7 @@ rtc_library("socket_adapters") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
+}
rtc_library("stream_params") {
+if (!build_with_mozilla) {
rtc_library("network_route") {
sources = [
"base/stream_params.cc",
"base/stream_params.h",
@@ -322,6 +317,7 @@ rtc_library("stream_params") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/algorithm:container" ]
}
+}
rtc_library("media_constants") {
sources = [
@@ -332,6 +328,7 @@ rtc_library("media_constants") {
@@ -1238,6 +1246,7 @@ rtc_library("network_route") {
}
rtc_library("turn_utils") {
rtc_library("async_tcp_socket") {
+if (!build_with_mozilla) {
sources = [
"base/turn_utils.cc",
"base/turn_utils.h",
@@ -342,14 +339,17 @@ rtc_library("turn_utils") {
"../rtc_base/system:rtc_export",
"async_tcp_socket.cc",
"async_tcp_socket.h",
@@ -1256,8 +1265,10 @@ rtc_library("async_tcp_socket") {
"third_party/sigslot",
]
}
+}
rtc_library("rid_description") {
rtc_library("async_udp_socket") {
+if (!build_with_mozilla) {
sources = [
"base/rid_description.cc",
"base/rid_description.h",
]
deps = []
}
+}
rtc_library("rtc_simulcast_encoder_adapter") {
visibility = [ "*" ]
sources = [
"async_udp_socket.cc",
@@ -1279,8 +1290,10 @@ rtc_library("async_udp_socket") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+}
rtc_library("async_packet_socket") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"async_packet_socket.cc",
@@ -1298,6 +1311,7 @@ rtc_library("async_packet_socket") {
"third_party/sigslot",
]
}
+}
rtc_library("mdns_responder_interface") {
sources = [ "mdns_responder_interface.h" ]
@@ -1310,6 +1324,7 @@ rtc_library("dscp") {
}
rtc_library("proxy_info") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"proxy_info.cc",
@@ -1320,6 +1335,7 @@ rtc_library("proxy_info") {
":socket_address",
]
}
+}
rtc_library("file_rotating_stream") {
sources = [
@@ -1348,6 +1364,7 @@ rtc_library("data_rate_limiter") {
}
rtc_library("unique_id_generator") {
+if (!build_with_mozilla) {
sources = [
"unique_id_generator.cc",
"unique_id_generator.h",
@@ -1362,6 +1379,7 @@ rtc_library("unique_id_generator") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
+}
rtc_library("crc32") {
sources = [
@@ -1389,6 +1407,7 @@ rtc_library("stream") {
}
rtc_library("rtc_certificate_generator") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"rtc_certificate_generator.cc",
@@ -1406,8 +1425,10 @@ rtc_library("rtc_certificate_generator") {
"//third_party/abseil-cpp/absl/types:optional",
]
}
+}
rtc_library("ssl") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"helpers.cc",
@@ -1506,6 +1527,7 @@ rtc_library("ssl") {
deps += [ ":win32" ]
}
}
+}
rtc_library("crypt_string") {
sources = [
@@ -1515,6 +1537,7 @@ rtc_library("crypt_string") {
}
rtc_library("http_common") {
+if (!build_with_mozilla) {
sources = [
"http_common.cc",
"http_common.h",
@@ -1531,6 +1554,7 @@ rtc_library("http_common") {
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
+}
rtc_source_set("gtest_prod") {
sources = [ "gtest_prod_util.h" ]
--
2.34.1

Просмотреть файл

@ -1,177 +0,0 @@
From: Michael Froman <mfroman@mozilla.com>
Date: Thu, 20 Apr 2023 14:52:00 -0500
Subject: Bug 1828517 - (fix-a138c6c8a5) handle file moves in BUILD.gn
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/cf7e333da17689b3c115a6ffd07fab042bc5f086
---
rtc_base/BUILD.gn | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 0b1e2a6208..7573a137ab 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -1147,6 +1147,7 @@ if (!build_with_chromium) {
}
rtc_library("network") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"network.cc",
@@ -1185,16 +1186,20 @@ rtc_library("network") {
deps += [ ":win32" ]
}
}
+}
rtc_library("socket_address_pair") {
+if (!build_with_mozilla) {
sources = [
"socket_address_pair.cc",
"socket_address_pair.h",
]
deps = [ ":socket_address" ]
}
+}
rtc_library("net_helper") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"net_helper.cc",
@@ -1203,8 +1208,10 @@ rtc_library("net_helper") {
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
deps = [ "system:rtc_export" ]
}
+}
rtc_library("socket_adapters") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"socket_adapters.cc",
@@ -1224,6 +1231,7 @@ rtc_library("socket_adapters") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
+}
rtc_library("network_route") {
sources = [
@@ -1238,6 +1246,7 @@ rtc_library("network_route") {
}
rtc_library("async_tcp_socket") {
+if (!build_with_mozilla) {
sources = [
"async_tcp_socket.cc",
"async_tcp_socket.h",
@@ -1256,8 +1265,10 @@ rtc_library("async_tcp_socket") {
"third_party/sigslot",
]
}
+}
rtc_library("async_udp_socket") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"async_udp_socket.cc",
@@ -1279,8 +1290,10 @@ rtc_library("async_udp_socket") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+}
rtc_library("async_packet_socket") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"async_packet_socket.cc",
@@ -1298,6 +1311,7 @@ rtc_library("async_packet_socket") {
"third_party/sigslot",
]
}
+}
rtc_library("mdns_responder_interface") {
sources = [ "mdns_responder_interface.h" ]
@@ -1310,6 +1324,7 @@ rtc_library("dscp") {
}
rtc_library("proxy_info") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"proxy_info.cc",
@@ -1320,6 +1335,7 @@ rtc_library("proxy_info") {
":socket_address",
]
}
+}
rtc_library("file_rotating_stream") {
sources = [
@@ -1348,6 +1364,7 @@ rtc_library("data_rate_limiter") {
}
rtc_library("unique_id_generator") {
+if (!build_with_mozilla) {
sources = [
"unique_id_generator.cc",
"unique_id_generator.h",
@@ -1362,6 +1379,7 @@ rtc_library("unique_id_generator") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
+}
rtc_library("crc32") {
sources = [
@@ -1389,6 +1407,7 @@ rtc_library("stream") {
}
rtc_library("rtc_certificate_generator") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"rtc_certificate_generator.cc",
@@ -1406,8 +1425,10 @@ rtc_library("rtc_certificate_generator") {
"//third_party/abseil-cpp/absl/types:optional",
]
}
+}
rtc_library("ssl") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
sources = [
"helpers.cc",
@@ -1506,6 +1527,7 @@ rtc_library("ssl") {
deps += [ ":win32" ]
}
}
+}
rtc_library("crypt_string") {
sources = [
@@ -1515,6 +1537,7 @@ rtc_library("crypt_string") {
}
rtc_library("http_common") {
+if (!build_with_mozilla) {
sources = [
"http_common.cc",
"http_common.h",
@@ -1531,6 +1554,7 @@ rtc_library("http_common") {
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
+}
rtc_source_set("gtest_prod") {
sources = [ "gtest_prod_util.h" ]
--
2.34.1