commit 60bd1d455c4f004ac4a8ecadbd4130a65dc1a7be
parent 5038fc8fbda1615a41fcc48c0d3c044b09c406c0
Author: Dan Baker <dbaker@mozilla.com>
Date: Mon, 1 Dec 2025 20:14:57 -0700
Bug 2000941 - Vendor libwebrtc from 792b85ba27
Upstream commit: https://webrtc.googlesource.com/src/+/792b85ba279cf76f5ed0b4f6cbf33a2dfd4a9cfc
Initialize JsepSessionDescription with candidates from Clone()
Small simplification of the `Clone()` method and JsepSessionDescription
construction. This removes the need for the size checks post
construction of JsepSessionDescription.
Bug: webrtc:442220720
Change-Id: Ibc186f5d7e7135a106ebd297574e8bbf92d55d55
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/409200
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45640}
Diffstat:
3 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor
@@ -1,4 +1,4 @@
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
-libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T03:11:42.226815+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T03:14:44.933338+00:00.
# base of lastest vendoring
-edaebd69e7
+792b85ba27
diff --git a/third_party/libwebrtc/api/jsep_session_description.h b/third_party/libwebrtc/api/jsep_session_description.h
@@ -39,7 +39,8 @@ class JsepSessionDescription final : public SessionDescriptionInterface {
JsepSessionDescription(SdpType type,
std::unique_ptr<SessionDescription> description,
absl::string_view session_id,
- absl::string_view session_version);
+ absl::string_view session_version,
+ std::vector<IceCandidateCollection> candidates = {});
~JsepSessionDescription() override;
JsepSessionDescription(const JsepSessionDescription&) = delete;
diff --git a/third_party/libwebrtc/pc/jsep_session_description.cc b/third_party/libwebrtc/pc/jsep_session_description.cc
@@ -103,6 +103,17 @@ void UpdateConnectionAddress(
}
media_desc->set_connection_address(connection_addr);
}
+
+std::vector<IceCandidateCollection> CloneCandidateCollection(
+ const std::vector<IceCandidateCollection>& original) {
+ std::vector<IceCandidateCollection> ret;
+ ret.reserve(original.size());
+ for (const auto& collection : original) {
+ ret.push_back(collection.Clone());
+ }
+ return ret;
+}
+
} // namespace
std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription(
@@ -145,12 +156,16 @@ JsepSessionDescription::JsepSessionDescription(
SdpType type,
std::unique_ptr<SessionDescription> description,
absl::string_view session_id,
- absl::string_view session_version)
+ absl::string_view session_version,
+ std::vector<IceCandidateCollection> candidates)
: description_(std::move(description)),
session_id_(session_id),
session_version_(session_version),
- type_(type) {
+ type_(type),
+ candidate_collection_(std::move(candidates)) {
RTC_DCHECK(description_ || type == SdpType::kRollback);
+ RTC_DCHECK(candidate_collection_.empty() ||
+ candidate_collection_.size() == number_of_mediasections());
candidate_collection_.resize(number_of_mediasections());
}
@@ -158,17 +173,10 @@ JsepSessionDescription::~JsepSessionDescription() {}
std::unique_ptr<SessionDescriptionInterface> JsepSessionDescription::Clone()
const {
- auto new_description = std::make_unique<JsepSessionDescription>(
+ return std::make_unique<JsepSessionDescription>(
GetType(), description_.get() ? description_->Clone() : nullptr,
- session_id_, session_version_);
- RTC_DCHECK_EQ(new_description->candidate_collection_.size(),
- candidate_collection_.size());
- for (size_t i = 0; i < candidate_collection_.size(); ++i) {
- RTC_DCHECK(new_description->candidate_collection_[i].empty());
- new_description->candidate_collection_[i].Append(
- candidate_collection_[i].Clone());
- }
- return new_description;
+ session_id_, session_version_,
+ CloneCandidateCollection(candidate_collection_));
}
bool JsepSessionDescription::AddCandidate(const IceCandidate* candidate) {