From a0facea495aa57f695002497c029e34d0dfa5c64 Mon Sep 17 00:00:00 2001 From: "Ilya (Marshal)" Date: Thu, 15 Oct 2026 19:21:51 +0200 Subject: [PATCH] Drop unused audio processing and video render smoothing --- .../cpp/src/interfaces/peer_connection_factory.cpp | 9 +++------ python-webrtc/cpp/src/interfaces/rtc_data_channel.cpp | 2 +- .../rtc_peer_connection/rtc_peer_connection.cpp | 2 ++ python-webrtc/cpp/src/interfaces/rtc_rtp_sender.cpp | 2 +- python-webrtc/python/webrtc/exceptions.py | 2 +- python-webrtc/python/webrtc/models/rtp_parameters.py | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/python-webrtc/cpp/src/interfaces/peer_connection_factory.cpp b/python-webrtc/cpp/src/interfaces/peer_connection_factory.cpp index 2924d3f..bb94767 100644 --- a/python-webrtc/cpp/src/interfaces/peer_connection_factory.cpp +++ b/python-webrtc/cpp/src/interfaces/peer_connection_factory.cpp @@ -17,7 +17,6 @@ #include "../utils/port_allocator.h" #include "../utils/task_queue_factory.h" -#include #include #include #include @@ -84,7 +83,7 @@ namespace python_webrtc { } } // namespace - // webrtc::CreatePeerConnectionFactory without the RTC event log, which keeps every packet's buffer in memory + // webrtc::CreatePeerConnectionFactory without the RTC event log (holds every packet) or audio processing (no capture) webrtc::PeerConnectionFactoryDependencies PeerConnectionFactory::Dependencies() { webrtc::PeerConnectionFactoryDependencies dependencies; dependencies.network_thread = _workerThread.get(); @@ -95,7 +94,6 @@ namespace python_webrtc { dependencies.adm = _audioDeviceModule; dependencies.audio_encoder_factory = webrtc::CreateBuiltinAudioEncoderFactory(); dependencies.audio_decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory(); - dependencies.audio_processing_builder = std::make_unique(); dependencies.video_encoder_factory = std::make_unique(); dependencies.video_decoder_factory = std::make_unique(); webrtc::EnableMedia(dependencies); @@ -117,9 +115,8 @@ namespace python_webrtc { PeerConnectionFactory::PeerConnectionFactory() : _fieldTrials(_trials), _networkIgnoreMask(_loopbackAllowed ? 0 : webrtc::kDefaultNetworkIgnoreMask) { - _workerThread = Started(std::make_unique(std::make_unique()), - "PeerConnectionFactory:workerThread"); - _signalingThread = Started(webrtc::Thread::Create(), "PeerConnectionFactory:signalingThread"); + _workerThread = Started(std::make_unique(std::make_unique()), "wrtc-network"); + _signalingThread = Started(webrtc::Thread::Create(), "wrtc-signaling"); // sanitizer builds check that these threads never enter Python _workerThread->PostTask(&TagNativeThread); _signalingThread->PostTask(&TagNativeThread); diff --git a/python-webrtc/cpp/src/interfaces/rtc_data_channel.cpp b/python-webrtc/cpp/src/interfaces/rtc_data_channel.cpp index 2a66038..719a7d2 100644 --- a/python-webrtc/cpp/src/interfaces/rtc_data_channel.cpp +++ b/python-webrtc/cpp/src/interfaces/rtc_data_channel.cpp @@ -204,7 +204,7 @@ namespace python_webrtc { } webrtc::Priority RTCDataChannel::GetPriority() { - // the ranges Chromium maps priority values to + // splits at the midpoints between the DCEP priority values of W3C webrtc-priority (128, 256, 512, 1024) constexpr int veryLowMax = 192; constexpr int lowMax = 384; constexpr int mediumMax = 768; diff --git a/python-webrtc/cpp/src/interfaces/rtc_peer_connection/rtc_peer_connection.cpp b/python-webrtc/cpp/src/interfaces/rtc_peer_connection/rtc_peer_connection.cpp index 39e33ce..03cf622 100644 --- a/python-webrtc/cpp/src/interfaces/rtc_peer_connection/rtc_peer_connection.cpp +++ b/python-webrtc/cpp/src/interfaces/rtc_peer_connection/rtc_peer_connection.cpp @@ -32,6 +32,8 @@ namespace python_webrtc { auto configuration = webrtc::PeerConnectionInterface::RTCConfiguration(); configuration.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan; configuration = _configuration.Apply(configuration); + // renders each decoded frame at once, without a smoothing queue per video receiver + configuration.set_prerenderer_smoothing(false); webrtc::PeerConnectionDependencies dependencies(this); dependencies.allocator = _factory->CreatePortAllocator(configuration); diff --git a/python-webrtc/cpp/src/interfaces/rtc_rtp_sender.cpp b/python-webrtc/cpp/src/interfaces/rtc_rtp_sender.cpp index 4805562..34d9cf7 100644 --- a/python-webrtc/cpp/src/interfaces/rtc_rtp_sender.cpp +++ b/python-webrtc/cpp/src/interfaces/rtc_rtp_sender.cpp @@ -22,7 +22,7 @@ namespace python_webrtc { namespace { - // only what setParameters may change, as in Chromium + // only the encoding members setParameters may change, the rest keep their current values void applySettable(const webrtc::RtpEncodingParameters &requested, webrtc::RtpEncodingParameters ¤t) { current.active = requested.active; current.request_key_frame = requested.request_key_frame; diff --git a/python-webrtc/python/webrtc/exceptions.py b/python-webrtc/python/webrtc/exceptions.py index 481b5a0..6e1ceea 100644 --- a/python-webrtc/python/webrtc/exceptions.py +++ b/python-webrtc/python/webrtc/exceptions.py @@ -212,7 +212,7 @@ def __init__(self, init: RTCErrorInit, message: str = '') -> None: _BY_RTC_ERROR_TYPE = { - # the same mapping as Chromium's + # the W3C error names for libwebrtc's RTCErrorType values 'UNSUPPORTED_OPERATION': OperationError, 'UNSUPPORTED_PARAMETER': InvalidAccessError, 'INVALID_PARAMETER': InvalidAccessError, diff --git a/python-webrtc/python/webrtc/models/rtp_parameters.py b/python-webrtc/python/webrtc/models/rtp_parameters.py index 3b29d4a..e7be6cd 100644 --- a/python-webrtc/python/webrtc/models/rtp_parameters.py +++ b/python-webrtc/python/webrtc/models/rtp_parameters.py @@ -31,7 +31,7 @@ _NativeCodecT = TypeVar('_NativeCodecT', bound='wrtc.RtpCodec') -# the bitrate priorities of libwebrtc for RTCRtpEncodingParameters.priority, as Chromium maps them +# libwebrtc's bitrate priorities for RTCRtpEncodingParameters.priority, doubling per level from low (the default) at 1.0 _BITRATE_PRIORITY = { RTCPriorityType.very_low: 0.5, RTCPriorityType.low: 1.0,