tor-browser

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

commit 48bc95ec84827fe1898653383aa3f5d844d1403d
parent 173cae6d001aa5349c12f2a519215d007397fc2b
Author: Dan Baker <dbaker@mozilla.com>
Date:   Mon,  1 Dec 2025 22:56:00 -0700

Bug 2000941 - Vendor libwebrtc from 5f1552d8a3

Upstream commit: https://webrtc.googlesource.com/src/+/5f1552d8a31c99670e95ce3505c91428a13e11aa
    Prevent adding transceivers without a media engine

    Add checks to make sure that a media engine is configured when adding
    audio and/or video transceivers.

    Fix bug for PlanB where PeerConnection would add default audio and video
    transceivers even if no media engine was configured. This could lead to
    runtime errors later when operations were attempted on these
    transceivers. (addressed TODO)

    Additionally, add `RTC_DCHECK`s to the RtpTransceiver constructors to
    ensure a media engine is always present upon instantiation and
    restricting use of the media_engine() accessor to the worker thread.

    Bug: none
    Change-Id: I28bb7b32831d3ca3bcd0d03db5c9603a94ef4f89
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/410362
    Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45702}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/pc/peer_connection.cc | 2+-
Mthird_party/libwebrtc/pc/rtp_transceiver.cc | 8++------
Mthird_party/libwebrtc/pc/rtp_transceiver.h | 4+++-
4 files changed, 8 insertions(+), 10 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-02T05:51:23.235034+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T05:55:45.975874+00:00. # base of lastest vendoring -58888d69ba +5f1552d8a3 diff --git a/third_party/libwebrtc/pc/peer_connection.cc b/third_party/libwebrtc/pc/peer_connection.cc @@ -634,7 +634,7 @@ PeerConnection::PeerConnection( sdp_handler_->UpdateNegotiationNeeded(); }); // Add default audio/video transceivers for Plan B SDP. - if (!IsUnifiedPlan()) { + if (!IsUnifiedPlan() && ConfiguredForMedia()) { rtp_manager_->transceivers()->Add( RtpTransceiverProxyWithInternal<RtpTransceiver>::Create( signaling_thread(), make_ref_counted<RtpTransceiver>( diff --git a/third_party/libwebrtc/pc/rtp_transceiver.cc b/third_party/libwebrtc/pc/rtp_transceiver.cc @@ -126,6 +126,7 @@ RtpTransceiver::RtpTransceiver(const Environment& env, codec_lookup_helper_(codec_lookup_helper) { RTC_DCHECK(media_type == MediaType::AUDIO || media_type == MediaType::VIDEO); RTC_DCHECK(context_); + RTC_DCHECK(context_->media_engine()); RTC_DCHECK(codec_lookup_helper_); } @@ -147,6 +148,7 @@ RtpTransceiver::RtpTransceiver( std::move(header_extensions_to_negotiate)), on_negotiation_needed_(std::move(on_negotiation_needed)) { RTC_DCHECK(context_); + RTC_DCHECK(context_->media_engine()); RTC_DCHECK(media_type_ == MediaType::AUDIO || media_type_ == MediaType::VIDEO); RTC_DCHECK_EQ(sender->media_type(), receiver->media_type()); @@ -212,12 +214,6 @@ RTCError RtpTransceiver::CreateChannel( RTC_DCHECK_RUN_ON(thread_); RTC_DCHECK(!channel()); - if (!media_engine()) { - // TODO(hta): Must be a better way - return RTCError(RTCErrorType::INTERNAL_ERROR, - "No media engine for mid=" + std::string(mid)); - } - std::unique_ptr<ChannelInterface> new_channel; if (media_type() == MediaType::AUDIO) { // TODO(bugs.webrtc.org/11992): CreateVideoChannel internally switches to diff --git a/third_party/libwebrtc/pc/rtp_transceiver.h b/third_party/libwebrtc/pc/rtp_transceiver.h @@ -33,6 +33,7 @@ #include "api/rtp_transceiver_direction.h" #include "api/rtp_transceiver_interface.h" #include "api/scoped_refptr.h" +#include "api/sequence_checker.h" #include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/task_queue_base.h" #include "api/video/video_bitrate_allocator_factory.h" @@ -300,7 +301,8 @@ class RtpTransceiver : public RtpTransceiverInterface { const MediaContentDescription* content); private: - MediaEngineInterface* media_engine() const { + MediaEngineInterface* media_engine() const + RTC_RUN_ON(context()->worker_thread()) { return context_->media_engine(); } ConnectionContext* context() const { return context_; }