Expose a PeerConnection's NetworkControllerInterface instance
Allow API users to access the NetworkControllerInterface instance that a given PC ended up with, to allow integrators who have provided a PeerConnectionFactoryDependencies.network_controller_factory to associate a created instance of their custom network controller with the PC using it. Eg for the RTCRtpTransport Chromium implementation as in crrev.com/c/5607744. Bug: chromium:345101934 Change-Id: Ia712ca4f45b90d5078f4e8e5977622d3e9f9aa6f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353980 Commit-Queue: Tony Herre <herre@google.com> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42506}
This commit is contained in:
parent
799c8e6422
commit
418bcf2acb
@ -1221,6 +1221,10 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
|
||||
// pointers.
|
||||
virtual rtc::Thread* signaling_thread() const = 0;
|
||||
|
||||
// NetworkController instance being used by this PeerConnection, to be used
|
||||
// to identify instances when using a custom NetworkControllerFactory.
|
||||
virtual NetworkControllerInterface* GetNetworkController() = 0;
|
||||
|
||||
protected:
|
||||
// Dtor protected as objects shouldn't be deleted via this interface.
|
||||
~PeerConnectionInterface() override = default;
|
||||
|
||||
@ -215,6 +215,10 @@ class MockPeerConnectionInterface : public webrtc::PeerConnectionInterface {
|
||||
MOCK_METHOD(void, StopRtcEventLog, (), (override));
|
||||
MOCK_METHOD(void, Close, (), (override));
|
||||
MOCK_METHOD(rtc::Thread*, signaling_thread, (), (const override));
|
||||
MOCK_METHOD(NetworkControllerInterface*,
|
||||
GetNetworkController,
|
||||
(),
|
||||
(override));
|
||||
};
|
||||
|
||||
static_assert(
|
||||
|
||||
@ -120,6 +120,11 @@ class RtpTransportControllerSend final
|
||||
// Implements NetworkStateEstimateObserver interface
|
||||
void OnRemoteNetworkEstimate(NetworkStateEstimate estimate) override;
|
||||
|
||||
NetworkControllerInterface* GetNetworkController() override {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
return controller_.get();
|
||||
}
|
||||
|
||||
private:
|
||||
void MaybeCreateControllers() RTC_RUN_ON(sequence_checker_);
|
||||
void UpdateNetworkAvailability() RTC_RUN_ON(sequence_checker_);
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "api/frame_transformer_interface.h"
|
||||
#include "api/transport/bandwidth_estimation_settings.h"
|
||||
#include "api/transport/bitrate_settings.h"
|
||||
#include "api/transport/network_control.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "call/rtp_config.h"
|
||||
#include "common_video/frame_counts.h"
|
||||
@ -160,6 +161,7 @@ class RtpTransportControllerSendInterface {
|
||||
virtual void IncludeOverheadInPacedSender() = 0;
|
||||
|
||||
virtual void EnsureStarted() = 0;
|
||||
virtual NetworkControllerInterface* GetNetworkController() = 0;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -105,6 +105,10 @@ class MockRtpTransportControllerSend
|
||||
MOCK_METHOD(void, IncludeOverheadInPacedSender, (), (override));
|
||||
MOCK_METHOD(void, OnReceivedPacket, (const ReceivedPacket&), (override));
|
||||
MOCK_METHOD(void, EnsureStarted, (), (override));
|
||||
MOCK_METHOD(NetworkControllerInterface*,
|
||||
GetNetworkController,
|
||||
(),
|
||||
(override));
|
||||
};
|
||||
} // namespace webrtc
|
||||
#endif // CALL_TEST_MOCK_RTP_TRANSPORT_CONTROLLER_SEND_H_
|
||||
|
||||
@ -439,6 +439,16 @@ class PeerConnection : public PeerConnectionInternal,
|
||||
}
|
||||
void RequestUsagePatternReportForTesting();
|
||||
|
||||
NetworkControllerInterface* GetNetworkController() override {
|
||||
if (!worker_thread()->IsCurrent()) {
|
||||
return worker_thread()->BlockingCall(
|
||||
[this]() { return GetNetworkController(); });
|
||||
}
|
||||
RTC_DCHECK_RUN_ON(worker_thread());
|
||||
RTC_DCHECK(call_);
|
||||
return call_->GetTransportControllerSend()->GetNetworkController();
|
||||
}
|
||||
|
||||
protected:
|
||||
// Available for rtc::scoped_refptr creation
|
||||
PeerConnection(const Environment& env,
|
||||
|
||||
@ -166,6 +166,7 @@ PROXY_METHOD2(bool,
|
||||
PROXY_METHOD1(bool, StartRtcEventLog, std::unique_ptr<RtcEventLogOutput>)
|
||||
PROXY_METHOD0(void, StopRtcEventLog)
|
||||
PROXY_METHOD0(void, Close)
|
||||
PROXY_METHOD0(NetworkControllerInterface*, GetNetworkController)
|
||||
BYPASS_PROXY_CONSTMETHOD0(rtc::Thread*, signaling_thread)
|
||||
END_PROXY_MAP(PeerConnection)
|
||||
|
||||
|
||||
@ -369,6 +369,10 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
|
||||
|
||||
const FieldTrialsView& trials() const override { return field_trials_; }
|
||||
|
||||
NetworkControllerInterface* GetNetworkController() override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
test::ScopedKeyValueConfig field_trials_;
|
||||
};
|
||||
|
||||
@ -330,6 +330,10 @@ class MockPeerConnectionInternal : public PeerConnectionInternal {
|
||||
OnSctpDataChannelStateChanged,
|
||||
(int channel_id, DataChannelInterface::DataState),
|
||||
(override));
|
||||
MOCK_METHOD(NetworkControllerInterface*,
|
||||
GetNetworkController,
|
||||
(),
|
||||
(override));
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user