commit b6b2485efe6ce2132c4d5cdd63bf108d23e679a0
parent 5aa29f6c2e7de5f1466bfaf2e42fe38782704f7e
Author: Dan Baker <dbaker@mozilla.com>
Date: Mon, 1 Dec 2025 19:13:38 -0700
Bug 2000941 - Vendor libwebrtc from 81bc5413a3
Upstream commit: https://webrtc.googlesource.com/src/+/81bc5413a37886fb1fe880ef236beab0d5a67464
Remove Initialize method from JsepSessionDescription
This change removes the deprecated `Initialize` method, which allowed
for a problematic two-step initialization. This pattern prevented class
members from being `const` and could lead to objects in an indeterminate
state if called more than once.
By removing this method, initialization is now enforced exclusively
through the constructor. This change improves const-correctness by
making the session description, ID, and version immutable after
construction, leading to more robust and predictable behavior.
Bug: webrtc:442220720
Change-Id: I61b258f8d00491f781284ce4d8c40fc98540810e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/408882
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45617}
Diffstat:
3 files changed, 5 insertions(+), 35 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-02T02:10:00.063681+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T02:13:18.601267+00:00.
# base of lastest vendoring
-c15949eda5
+81bc5413a3
diff --git a/third_party/libwebrtc/api/jsep_session_description.h b/third_party/libwebrtc/api/jsep_session_description.h
@@ -48,22 +48,6 @@ class JsepSessionDescription final : public SessionDescriptionInterface {
JsepSessionDescription(const JsepSessionDescription&) = delete;
JsepSessionDescription& operator=(const JsepSessionDescription&) = delete;
- // Takes ownership of `description`.
- // TODO(bugs.webrtc.org/442220720): Remove and prefer raii traits, make state
- // const where possible. The problem with the Initialize method is that it
- // is an _optional_ 2-step initialization method that prevents the class from
- // making state const and also has been used in tests (possibly elsewhere)
- // to call Initialize() more than once on the same object and rely on the
- // fact that the implementation did not reset part of the state when called
- // (the candidate list could be partially, but not completely, trimmed),
- // meaning that the pre and post state is indeterminate.
- [[deprecated(
- "Use CreateSessionDescription() to construct SessionDescriptionInterface "
- "objects.")]]
- bool Initialize(std::unique_ptr<SessionDescription> description,
- const std::string& session_id,
- const std::string& session_version);
-
std::unique_ptr<SessionDescriptionInterface> Clone() const override;
SessionDescription* description() override { return description_.get(); }
@@ -82,9 +66,9 @@ class JsepSessionDescription final : public SessionDescriptionInterface {
bool ToString(std::string* out) const override;
private:
- std::unique_ptr<SessionDescription> description_;
- std::string session_id_;
- std::string session_version_;
+ const std::unique_ptr<SessionDescription> description_;
+ const std::string session_id_;
+ const std::string session_version_;
const SdpType type_;
std::vector<IceCandidateCollection> candidate_collection_;
diff --git a/third_party/libwebrtc/pc/jsep_session_description.cc b/third_party/libwebrtc/pc/jsep_session_description.cc
@@ -178,20 +178,6 @@ JsepSessionDescription::JsepSessionDescription(
JsepSessionDescription::~JsepSessionDescription() {}
-bool JsepSessionDescription::Initialize(
- std::unique_ptr<SessionDescription> description,
- const std::string& session_id,
- const std::string& session_version) {
- if (!description)
- return false;
-
- session_id_ = session_id;
- session_version_ = session_version;
- description_ = std::move(description);
- candidate_collection_.resize(number_of_mediasections());
- return true;
-}
-
std::unique_ptr<SessionDescriptionInterface> JsepSessionDescription::Clone()
const {
auto new_description = std::make_unique<JsepSessionDescription>(