tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 7bdcd27090595599942f8ecabce8bbd3b00b6f16
parent c3514d7d27bbd2c01eab39d812442681a8d8960c
Author: Dan Baker <dbaker@mozilla.com>
Date:   Wed, 19 Nov 2025 17:46:18 -0700

Bug 2000941 - Vendor libwebrtc from 5dcfbc8e8a

Upstream commit: https://webrtc.googlesource.com/src/+/5dcfbc8e8a357b3fb577dc1b9e6d61c9a7b8bdb6
    Make SessionDescriptionInterface methods pure virtual

    The `Clone()` and `GetType()` methods in `SessionDescriptionInterface`
    had unnecessary (inefficient+insufficient) default implementations.

    To enforce that all...ehm, _the_ derived class provides a concrete
    implementation, these methods are now pure virtual.

    As part of this change, the `JsepSessionDescription` class has also been
    updated to use the `override` and `final` specifiers for improved
    clarity and compiler enforcement.

    Bug: webrtc:442220720, webrtc:12215
    Change-Id: I7edea11777d31b5ea10943c3ea25136670050a6b
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/407422
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45526}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/api/jsep.h | 9++-------
Mthird_party/libwebrtc/api/jsep_session_description.h | 35++++++++++++++++++-----------------
Mthird_party/libwebrtc/pc/jsep_session_description.cc | 36++++++++++--------------------------
4 files changed, 32 insertions(+), 52 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-11-20T00:42:11.487140+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-11-20T00:45:47.126882+00:00. # base of lastest vendoring -b9c34de50e +5dcfbc8e8a diff --git a/third_party/libwebrtc/api/jsep.h b/third_party/libwebrtc/api/jsep.h @@ -222,10 +222,7 @@ class RTC_EXPORT SessionDescriptionInterface { // Create a new SessionDescriptionInterface object // with the same values as the old object. - // TODO(bugs.webrtc.org:12215): Remove default implementation - virtual std::unique_ptr<SessionDescriptionInterface> Clone() const { - return nullptr; - } + virtual std::unique_ptr<SessionDescriptionInterface> Clone() const = 0; // Only for use internally. virtual SessionDescription* description() = 0; @@ -238,9 +235,7 @@ class RTC_EXPORT SessionDescriptionInterface { // Returns the type of this session description as an SdpType. Descriptions of // the various types are found in the SdpType documentation. - // TODO(steveanton): Remove default implementation once Chromium has been - // updated. - virtual SdpType GetType() const; + virtual SdpType GetType() const = 0; // kOffer/kPrAnswer/kAnswer // TODO(steveanton): Remove this in favor of `GetType` that returns SdpType. diff --git a/third_party/libwebrtc/api/jsep_session_description.h b/third_party/libwebrtc/api/jsep_session_description.h @@ -27,16 +27,17 @@ namespace webrtc { class SessionDescription; // Implementation of SessionDescriptionInterface. -class JsepSessionDescription : public SessionDescriptionInterface { +class JsepSessionDescription final : public SessionDescriptionInterface { public: explicit JsepSessionDescription(SdpType type); - // TODO(steveanton): Remove this once callers have switched to SdpType. + [[deprecated( + "Use the CreateSessionDescription() method(s) to create an instance.")]] explicit JsepSessionDescription(const std::string& type); JsepSessionDescription(SdpType type, std::unique_ptr<SessionDescription> description, absl::string_view session_id, absl::string_view session_version); - virtual ~JsepSessionDescription(); + ~JsepSessionDescription() override; JsepSessionDescription(const JsepSessionDescription&) = delete; JsepSessionDescription& operator=(const JsepSessionDescription&) = delete; @@ -46,30 +47,30 @@ class JsepSessionDescription : public SessionDescriptionInterface { const std::string& session_id, const std::string& session_version); - virtual std::unique_ptr<SessionDescriptionInterface> Clone() const; + std::unique_ptr<SessionDescriptionInterface> Clone() const override; - virtual SessionDescription* description() { return description_.get(); } - virtual const SessionDescription* description() const { + SessionDescription* description() override { return description_.get(); } + const SessionDescription* description() const override { return description_.get(); } - virtual std::string session_id() const { return session_id_; } - virtual std::string session_version() const { return session_version_; } - virtual SdpType GetType() const { return type_; } - virtual std::string type() const { return SdpTypeToString(type_); } + std::string session_id() const override { return session_id_; } + std::string session_version() const override { return session_version_; } + SdpType GetType() const override { return type_; } + std::string type() const override { return SdpTypeToString(type_); } // Allows changing the type. Used for testing. - virtual bool AddCandidate(const IceCandidate* candidate); - virtual bool RemoveCandidate(const IceCandidate* candidate); + bool AddCandidate(const IceCandidate* candidate) override; + bool RemoveCandidate(const IceCandidate* candidate) override; - virtual size_t number_of_mediasections() const; - virtual const IceCandidateCollection* candidates( - size_t mediasection_index) const; - virtual bool ToString(std::string* out) const; + size_t number_of_mediasections() const override; + const IceCandidateCollection* candidates( + size_t mediasection_index) const override; + bool ToString(std::string* out) const override; private: std::unique_ptr<SessionDescription> description_; std::string session_id_; std::string session_version_; - SdpType type_; + const SdpType type_; std::vector<JsepCandidateCollection> candidate_collection_; bool IsValidMLineIndex(int index) const; diff --git a/third_party/libwebrtc/pc/jsep_session_description.cc b/third_party/libwebrtc/pc/jsep_session_description.cc @@ -44,6 +44,14 @@ namespace { constexpr char kDummyAddress[] = "0.0.0.0"; constexpr int kDummyPort = 9; +// Remove this method when the deprecated constructor that calls it has been +// removed. +SdpType SdpTypeFromStringOrDie(const std::string& type) { + auto sdp_type = SdpTypeFromString(type); + RTC_CHECK(sdp_type.has_value()); + return sdp_type.value(); +} + // Update the connection address for the MediaContentDescription based on the // candidates. void UpdateConnectionAddress( @@ -105,21 +113,6 @@ void UpdateConnectionAddress( } } // namespace -// TODO(steveanton): Remove this default implementation once Chromium has been -// updated. -SdpType SessionDescriptionInterface::GetType() const { - std::optional<SdpType> maybe_type = SdpTypeFromString(type()); - if (maybe_type) { - return *maybe_type; - } else { - RTC_LOG(LS_WARNING) << "Default implementation of " - "SessionDescriptionInterface::GetType does not " - "recognize the result from type(), returning " - "kOffer."; - return SdpType::kOffer; - } -} - SessionDescriptionInterface* CreateSessionDescription(const std::string& type, const std::string& sdp, SdpParseError* error) { @@ -164,17 +157,8 @@ std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription( JsepSessionDescription::JsepSessionDescription(SdpType type) : type_(type) {} -JsepSessionDescription::JsepSessionDescription(const std::string& type) { - std::optional<SdpType> maybe_type = SdpTypeFromString(type); - if (maybe_type) { - type_ = *maybe_type; - } else { - RTC_LOG(LS_WARNING) - << "JsepSessionDescription constructed with invalid type string: " - << type << ". Assuming it is an offer."; - type_ = SdpType::kOffer; - } -} +JsepSessionDescription::JsepSessionDescription(const std::string& type) + : JsepSessionDescription(SdpTypeFromStringOrDie(type)) {} JsepSessionDescription::JsepSessionDescription( SdpType type,