Remove RTCPeerConnectionHandlerPlatform class.
This simplifies the class hierarchy; the class is no longer used
outside of modules/peerconnection.
Bug: chromium:787254
Change-Id: Iff526b1ef1d6d324c67b72ff3e1420ccd1f0ae9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144025
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759370}
diff --git a/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.cc b/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.cc
index a64d77d..5372b03 100644
--- a/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.cc
+++ b/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "third_party/blink/public/platform/web_media_stream.h"
#include "third_party/blink/public/platform/web_media_stream_source.h"
#include "third_party/blink/public/platform/web_media_stream_track.h"
@@ -240,8 +241,9 @@
scoped_refptr<DummyTransceiverInternal> internal_;
};
-MockRTCPeerConnectionHandlerPlatform::MockRTCPeerConnectionHandlerPlatform() =
- default;
+MockRTCPeerConnectionHandlerPlatform::MockRTCPeerConnectionHandlerPlatform()
+ : RTCPeerConnectionHandler(
+ scheduler::GetSingleThreadTaskRunnerForTesting()) {}
MockRTCPeerConnectionHandlerPlatform::~MockRTCPeerConnectionHandlerPlatform() =
default;
@@ -414,7 +416,7 @@
const char* trace_event_name) {}
void MockRTCPeerConnectionHandlerPlatform::TrackIceConnectionStateChange(
- RTCPeerConnectionHandlerPlatform::IceConnectionStateVersion version,
+ RTCPeerConnectionHandler::IceConnectionStateVersion version,
webrtc::PeerConnectionInterface::IceConnectionState state) {}
} // namespace blink
diff --git a/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h b/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h
index 734dfc5..0f4329e 100644
--- a/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h
+++ b/third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/single_thread_task_runner.h"
-#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "third_party/webrtc/api/peer_connection_interface.h"
@@ -20,8 +20,9 @@
// TODO(https://crbug.com/908461): This is currently implemented as NO-OPs or to
// create dummy objects whose methods return default values. Consider renaming
// the class, changing it to be GMOCK friendly or deleting it.
-class MockRTCPeerConnectionHandlerPlatform
- : public RTCPeerConnectionHandlerPlatform {
+// TODO(https://crbug.com/787254): Remove "Platform" from the name of this
+// class.
+class MockRTCPeerConnectionHandlerPlatform : public RTCPeerConnectionHandler {
public:
MockRTCPeerConnectionHandlerPlatform();
~MockRTCPeerConnectionHandlerPlatform() override;
@@ -84,7 +85,7 @@
const base::RepeatingClosure& closure,
const char* trace_event_name) override;
void TrackIceConnectionStateChange(
- RTCPeerConnectionHandlerPlatform::IceConnectionStateVersion version,
+ RTCPeerConnectionHandler::IceConnectionStateVersion version,
webrtc::PeerConnectionInterface::IceConnectionState state) override;
private:
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc
index 15929f4..3e7a15c 100644
--- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc
+++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc
@@ -46,7 +46,6 @@
#include "third_party/blink/renderer/platform/p2p/port_allocator.h"
#include "third_party/blink/renderer/platform/p2p/socket_dispatcher.h"
#include "third_party/blink/renderer/platform/peerconnection/audio_codec_factory.h"
-#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/stun_field_trial.h"
#include "third_party/blink/renderer/platform/peerconnection/video_codec_factory.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
@@ -136,7 +135,7 @@
return &instance;
}
-std::unique_ptr<RTCPeerConnectionHandlerPlatform>
+std::unique_ptr<RTCPeerConnectionHandler>
PeerConnectionDependencyFactory::CreateRTCPeerConnectionHandler(
RTCPeerConnectionHandlerClient* client,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h
index ff1fde1..9984fa1 100644
--- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h
+++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h
@@ -38,7 +38,7 @@
class MdnsResponderAdapter;
class P2PSocketDispatcher;
class RTCPeerConnectionHandlerClient;
-class RTCPeerConnectionHandlerPlatform;
+class RTCPeerConnectionHandler;
class StunProberTrial;
class WebLocalFrame;
class WebRtcAudioDeviceImpl;
@@ -51,10 +51,8 @@
static PeerConnectionDependencyFactory* GetInstance();
- // Create a RTCPeerConnectionHandler object that implements the
- // WebKit RTCPeerConnectionHandlerPlatform interface.
- std::unique_ptr<RTCPeerConnectionHandlerPlatform>
- CreateRTCPeerConnectionHandler(
+ // Create a RTCPeerConnectionHandler object.
+ std::unique_ptr<RTCPeerConnectionHandler> CreateRTCPeerConnectionHandler(
RTCPeerConnectionHandlerClient* client,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
bool force_encoded_audio_insertable_streams,
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc
index f2a47f4..058ed4f 100644
--- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc
+++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory_test.cc
@@ -23,7 +23,7 @@
TEST_F(PeerConnectionDependencyFactoryTest, CreateRTCPeerConnectionHandler) {
MockRTCPeerConnectionHandlerClient client_jsep;
- std::unique_ptr<RTCPeerConnectionHandlerPlatform> pc_handler(
+ std::unique_ptr<RTCPeerConnectionHandler> pc_handler(
dependency_factory_->CreateRTCPeerConnectionHandler(
&client_jsep, blink::scheduler::GetSingleThreadTaskRunnerForTesting(),
/*force_encoded_audio_insertable_streams=*/false,
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.cc b/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.cc
index 96482df..be6517c 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.cc
@@ -38,8 +38,8 @@
#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer_view.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_error_event.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
-#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
@@ -212,7 +212,7 @@
RTCDataChannel::RTCDataChannel(
ExecutionContext* context,
scoped_refptr<webrtc::DataChannelInterface> channel,
- RTCPeerConnectionHandlerPlatform* peer_connection_handler)
+ RTCPeerConnectionHandler* peer_connection_handler)
: ExecutionContextLifecycleObserver(context),
state_(webrtc::DataChannelInterface::kConnecting),
binary_type_(kBinaryTypeArrayBuffer),
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.h b/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.h
index fc5b72f..f6042bfe 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.h
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.h
@@ -44,7 +44,7 @@
class DOMArrayBuffer;
class DOMArrayBufferView;
class ExceptionState;
-class RTCPeerConnectionHandlerPlatform;
+class RTCPeerConnectionHandler;
class MODULES_EXPORT RTCDataChannel final
: public EventTargetWithInlineData,
@@ -57,7 +57,7 @@
public:
RTCDataChannel(ExecutionContext*,
scoped_refptr<webrtc::DataChannelInterface> channel,
- RTCPeerConnectionHandlerPlatform* peer_connection_handler);
+ RTCPeerConnectionHandler* peer_connection_handler);
~RTCDataChannel() override;
String label() const;
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_dtmf_sender.cc b/third_party/blink/renderer/modules/peerconnection/rtc_dtmf_sender.cc
index b7e226f..fd3da66 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_dtmf_sender.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_dtmf_sender.cc
@@ -32,9 +32,9 @@
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_track.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_dtmf_tone_change_event.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_dtmf_sender_handler.h"
-#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
index 4cdbf61..3f53d05 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
@@ -1284,7 +1284,7 @@
auto new_state = ComputeIceConnectionState();
if (ice_connection_state_ != new_state) {
peer_handler_->TrackIceConnectionStateChange(
- RTCPeerConnectionHandlerPlatform::IceConnectionStateVersion::kDefault,
+ RTCPeerConnectionHandler::IceConnectionStateVersion::kDefault,
new_state);
}
ChangeIceConnectionState(new_state);
@@ -2860,11 +2860,11 @@
if (sdp_semantics_ == webrtc::SdpSemantics::kUnifiedPlan) {
// Unified plan relies on UpdateIceConnectionState() instead.
peer_handler_->TrackIceConnectionStateChange(
- RTCPeerConnectionHandlerPlatform::IceConnectionStateVersion::kLegacy,
+ RTCPeerConnectionHandler::IceConnectionStateVersion::kLegacy,
new_state);
} else {
peer_handler_->TrackIceConnectionStateChange(
- RTCPeerConnectionHandlerPlatform::IceConnectionStateVersion::kDefault,
+ RTCPeerConnectionHandler::IceConnectionStateVersion::kDefault,
new_state);
ChangeIceConnectionState(new_state);
}
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h
index 52491f92..ff82afa 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h
@@ -44,12 +44,12 @@
#include "third_party/blink/renderer/modules/peerconnection/call_setup_state_tracker.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_ice_candidate.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_controller.h"
+#include "third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_transceiver.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_session_description_enums.h"
#include "third_party/blink/renderer/platform/heap/heap_allocator.h"
#include "third_party/blink/renderer/platform/mediastream/media_constraints.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_client.h"
-#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_session_description_request.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_void_request.h"
#include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h"
@@ -418,8 +418,8 @@
base::TimeTicks WebRtcTimestampToBlinkTimestamp(
base::TimeTicks webrtc_monotonic_time) const;
- using RtcPeerConnectionHandlerFactoryCallback = base::RepeatingCallback<
- std::unique_ptr<RTCPeerConnectionHandlerPlatform>()>;
+ using RtcPeerConnectionHandlerFactoryCallback =
+ base::RepeatingCallback<std::unique_ptr<RTCPeerConnectionHandler>()>;
static void SetRtcPeerConnectionHandlerFactoryForTesting(
RtcPeerConnectionHandlerFactoryCallback);
@@ -604,7 +604,7 @@
ice_transports_by_native_transport_;
// TODO(crbug.com/787254): Use RTCPeerConnectionHandler.
- std::unique_ptr<RTCPeerConnectionHandlerPlatform> peer_handler_;
+ std::unique_ptr<RTCPeerConnectionHandler> peer_handler_;
TaskHandle dispatch_scheduled_events_task_handle_;
HeapVector<Member<EventWrapper>> scheduled_events_;
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc
index 5cafa39..762234b7 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.cc
@@ -52,6 +52,7 @@
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_void_request.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
+#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
#include "third_party/webrtc/api/data_channel_interface.h"
@@ -1079,6 +1080,13 @@
GetPeerConnectionHandlers()->insert(this);
}
+// Constructor to be used for creating mocks only.
+RTCPeerConnectionHandler::RTCPeerConnectionHandler(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner)
+ : client_(nullptr),
+ dependency_factory_(nullptr),
+ task_runner_(std::move(task_runner)) {}
+
RTCPeerConnectionHandler::~RTCPeerConnectionHandler() {
if (!is_unregistered_) {
StopAndUnregister();
@@ -2246,16 +2254,16 @@
}
void RTCPeerConnectionHandler::TrackIceConnectionStateChange(
- RTCPeerConnectionHandlerPlatform::IceConnectionStateVersion version,
+ RTCPeerConnectionHandler::IceConnectionStateVersion version,
webrtc::PeerConnectionInterface::IceConnectionState state) {
if (!peer_connection_tracker_)
return;
switch (version) {
- case RTCPeerConnectionHandlerPlatform::IceConnectionStateVersion::kLegacy:
+ case RTCPeerConnectionHandler::IceConnectionStateVersion::kLegacy:
peer_connection_tracker_->TrackLegacyIceConnectionStateChange(this,
state);
break;
- case RTCPeerConnectionHandlerPlatform::IceConnectionStateVersion::kDefault:
+ case RTCPeerConnectionHandler::IceConnectionStateVersion::kDefault:
peer_connection_tracker_->TrackIceConnectionStateChange(this, state);
break;
}
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h
index 8fe2175..d4cb5e6 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_handler.h
@@ -23,11 +23,20 @@
#include "third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender_impl.h"
#include "third_party/blink/renderer/modules/peerconnection/transceiver_state_surfacer.h"
#include "third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter_map.h"
+#include "third_party/blink/renderer/platform/heap/member.h"
+#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_client.h"
-#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h"
+#include "third_party/blink/renderer/platform/peerconnection/rtc_session_description_platform.h"
+#include "third_party/blink/renderer/platform/peerconnection/rtc_session_description_request.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats_request.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_stats_response_base.h"
+#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
+#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
+#include "third_party/blink/renderer/platform/wtf/vector.h"
+#include "third_party/webrtc/api/peer_connection_interface.h"
+#include "third_party/webrtc/api/rtc_error.h"
+#include "third_party/webrtc/api/rtp_transceiver_interface.h"
#include "third_party/webrtc/api/stats/rtc_stats.h"
#include "third_party/webrtc/api/stats/rtc_stats_collector_callback.h"
@@ -84,16 +93,26 @@
// WebKit calls all of these methods on the main render thread.
// Callbacks to the webrtc::PeerConnectionObserver implementation also occur on
// the main render thread.
-class MODULES_EXPORT RTCPeerConnectionHandler
- : public RTCPeerConnectionHandlerPlatform {
+class MODULES_EXPORT RTCPeerConnectionHandler {
public:
+ enum class IceConnectionStateVersion {
+ // Only applicable in Unified Plan when the JavaScript-exposed
+ // iceConnectionState is calculated in blink. In this case, kLegacy is used
+ // to report the webrtc::PeerConnectionInterface implementation which is not
+ // visible in JavaScript, but still useful to track for debugging purposes.
+ kLegacy,
+ // The JavaScript-visible iceConnectionState. In Plan B, this is the same as
+ // the webrtc::PeerConnectionInterface implementation.
+ kDefault,
+ };
+
RTCPeerConnectionHandler(
RTCPeerConnectionHandlerClient* client,
blink::PeerConnectionDependencyFactory* dependency_factory,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
bool force_encoded_audio_insertable_streams,
bool force_encoded_video_insertable_streams);
- ~RTCPeerConnectionHandler() override;
+ virtual ~RTCPeerConnectionHandler();
// Initialize method only used for unit test.
bool InitializeForTest(
@@ -103,79 +122,78 @@
const base::WeakPtr<PeerConnectionTracker>& peer_connection_tracker);
// RTCPeerConnectionHandlerPlatform implementation
- bool Initialize(const webrtc::PeerConnectionInterface::RTCConfiguration&
- server_configuration,
- const MediaConstraints& options,
- WebLocalFrame* web_frame) override;
+ virtual bool Initialize(
+ const webrtc::PeerConnectionInterface::RTCConfiguration&
+ server_configuration,
+ const MediaConstraints& options,
+ WebLocalFrame* web_frame);
- void Stop() override;
- void StopAndUnregister() override;
+ virtual void Stop();
+ virtual void StopAndUnregister();
- Vector<std::unique_ptr<RTCRtpTransceiverPlatform>> CreateOffer(
+ virtual Vector<std::unique_ptr<RTCRtpTransceiverPlatform>> CreateOffer(
RTCSessionDescriptionRequest* request,
- const MediaConstraints& options) override;
- Vector<std::unique_ptr<RTCRtpTransceiverPlatform>> CreateOffer(
+ const MediaConstraints& options);
+ virtual Vector<std::unique_ptr<RTCRtpTransceiverPlatform>> CreateOffer(
RTCSessionDescriptionRequest* request,
- RTCOfferOptionsPlatform* options) override;
+ RTCOfferOptionsPlatform* options);
- void CreateAnswer(blink::RTCSessionDescriptionRequest* request,
- const MediaConstraints& options) override;
- void CreateAnswer(blink::RTCSessionDescriptionRequest* request,
- blink::RTCAnswerOptionsPlatform* options) override;
+ virtual void CreateAnswer(blink::RTCSessionDescriptionRequest* request,
+ const MediaConstraints& options);
+ virtual void CreateAnswer(blink::RTCSessionDescriptionRequest* request,
+ blink::RTCAnswerOptionsPlatform* options);
- void SetLocalDescription(blink::RTCVoidRequest* request) override;
- void SetLocalDescription(blink::RTCVoidRequest* request,
- RTCSessionDescriptionPlatform* description) override;
- void SetRemoteDescription(
- blink::RTCVoidRequest* request,
- RTCSessionDescriptionPlatform* description) override;
+ virtual void SetLocalDescription(blink::RTCVoidRequest* request);
+ virtual void SetLocalDescription(blink::RTCVoidRequest* request,
+ RTCSessionDescriptionPlatform* description);
+ virtual void SetRemoteDescription(blink::RTCVoidRequest* request,
+ RTCSessionDescriptionPlatform* description);
- RTCSessionDescriptionPlatform* LocalDescription() override;
- RTCSessionDescriptionPlatform* RemoteDescription() override;
- RTCSessionDescriptionPlatform* CurrentLocalDescription() override;
- RTCSessionDescriptionPlatform* CurrentRemoteDescription() override;
- RTCSessionDescriptionPlatform* PendingLocalDescription() override;
- RTCSessionDescriptionPlatform* PendingRemoteDescription() override;
+ virtual RTCSessionDescriptionPlatform* LocalDescription();
+ virtual RTCSessionDescriptionPlatform* RemoteDescription();
+ virtual RTCSessionDescriptionPlatform* CurrentLocalDescription();
+ virtual RTCSessionDescriptionPlatform* CurrentRemoteDescription();
+ virtual RTCSessionDescriptionPlatform* PendingLocalDescription();
+ virtual RTCSessionDescriptionPlatform* PendingRemoteDescription();
- const webrtc::PeerConnectionInterface::RTCConfiguration& GetConfiguration()
- const override;
- webrtc::RTCErrorType SetConfiguration(
- const webrtc::PeerConnectionInterface::RTCConfiguration& configuration)
- override;
- void AddICECandidate(blink::RTCVoidRequest* request,
- RTCIceCandidatePlatform* candidate) override;
- void RestartIce() override;
+ virtual const webrtc::PeerConnectionInterface::RTCConfiguration&
+ GetConfiguration() const;
+ virtual webrtc::RTCErrorType SetConfiguration(
+ const webrtc::PeerConnectionInterface::RTCConfiguration& configuration);
+ virtual void AddICECandidate(blink::RTCVoidRequest* request,
+ RTCIceCandidatePlatform* candidate);
+ virtual void RestartIce();
- void GetStats(RTCStatsRequest* request) override;
- void GetStats(
+ virtual void GetStats(RTCStatsRequest* request);
+ virtual void GetStats(
RTCStatsReportCallback callback,
- const Vector<webrtc::NonStandardGroupId>& exposed_group_ids) override;
- webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
+ const Vector<webrtc::NonStandardGroupId>& exposed_group_ids);
+ virtual webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
AddTransceiverWithTrack(const blink::WebMediaStreamTrack& web_track,
- const webrtc::RtpTransceiverInit& init) override;
- webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
+ const webrtc::RtpTransceiverInit& init);
+ virtual webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
AddTransceiverWithKind(const String& kind,
- const webrtc::RtpTransceiverInit& init) override;
- webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>> AddTrack(
- const WebMediaStreamTrack& web_track,
- const Vector<WebMediaStream>& web_streams) override;
- webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>> RemoveTrack(
- blink::RTCRtpSenderPlatform* web_sender) override;
+ const webrtc::RtpTransceiverInit& init);
+ virtual webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
+ AddTrack(const WebMediaStreamTrack& web_track,
+ const Vector<WebMediaStream>& web_streams);
+ virtual webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
+ RemoveTrack(blink::RTCRtpSenderPlatform* web_sender);
- scoped_refptr<webrtc::DataChannelInterface> CreateDataChannel(
+ virtual scoped_refptr<webrtc::DataChannelInterface> CreateDataChannel(
const String& label,
- const webrtc::DataChannelInit& init) override;
- webrtc::PeerConnectionInterface* NativePeerConnection() override;
- void RunSynchronousOnceClosureOnSignalingThread(
+ const webrtc::DataChannelInit& init);
+ virtual webrtc::PeerConnectionInterface* NativePeerConnection();
+ virtual void RunSynchronousOnceClosureOnSignalingThread(
CrossThreadOnceClosure closure,
- const char* trace_event_name) override;
- void RunSynchronousRepeatingClosureOnSignalingThread(
+ const char* trace_event_name);
+ virtual void RunSynchronousRepeatingClosureOnSignalingThread(
const base::RepeatingClosure& closure,
- const char* trace_event_name) override;
+ const char* trace_event_name);
- void TrackIceConnectionStateChange(
- RTCPeerConnectionHandlerPlatform::IceConnectionStateVersion version,
- webrtc::PeerConnectionInterface::IceConnectionState state) override;
+ virtual void TrackIceConnectionStateChange(
+ RTCPeerConnectionHandler::IceConnectionStateVersion version,
+ webrtc::PeerConnectionInterface::IceConnectionState state);
// Delegate functions to allow for mocking of WebKit interfaces.
// getStats takes ownership of request parameter.
@@ -210,6 +228,10 @@
}
protected:
+ // Constructor to be used for constructing mocks only.
+ explicit RTCPeerConnectionHandler(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+
webrtc::PeerConnectionInterface* native_peer_connection() {
return native_peer_connection_.get();
}
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc
index 4fed7a75..ec897f7e 100644
--- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection_test.cc
@@ -32,7 +32,6 @@
#include "third_party/blink/renderer/modules/peerconnection/mock_rtc_peer_connection_handler_platform.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/heap/heap_allocator.h"
-#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_receiver_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_sender_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_session_description_platform.h"
@@ -403,7 +402,7 @@
scope.GetExceptionState());
}
- virtual std::unique_ptr<RTCPeerConnectionHandlerPlatform>
+ virtual std::unique_ptr<RTCPeerConnectionHandler>
CreateRTCPeerConnectionHandler() {
return std::make_unique<MockRTCPeerConnectionHandlerPlatform>();
}
@@ -775,8 +774,8 @@
//
class RTCPeerConnectionCallSetupStateTest : public RTCPeerConnectionTest {
public:
- std::unique_ptr<RTCPeerConnectionHandlerPlatform>
- CreateRTCPeerConnectionHandler() override {
+ std::unique_ptr<RTCPeerConnectionHandler> CreateRTCPeerConnectionHandler()
+ override {
auto handler = std::make_unique<FakeRTCPeerConnectionHandlerPlatform>();
handler_ = handler.get();
return handler;
@@ -1179,8 +1178,7 @@
return result;
}
- std::unique_ptr<RTCPeerConnectionHandlerPlatform>
- CreateRTCPeerConnectionHandler() {
+ std::unique_ptr<RTCPeerConnectionHandler> CreateRTCPeerConnectionHandler() {
return std::make_unique<MockRTCPeerConnectionHandlerPlatform>();
}
};
diff --git a/third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_node.cc b/third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_node.cc
index 26dec5e4..098fb7f 100644
--- a/third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_node.cc
+++ b/third_party/blink/renderer/modules/webaudio/media_stream_audio_destination_node.cc
@@ -34,7 +34,6 @@
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
-#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h"
#include "third_party/blink/renderer/platform/wtf/uuid.h"
namespace blink {
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn
index 2ef890ec..ea5a01d 100644
--- a/third_party/blink/renderer/platform/BUILD.gn
+++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1286,7 +1286,6 @@
"peerconnection/rtc_offer_options_platform.h",
"peerconnection/rtc_peer_connection_handler_client.cc",
"peerconnection/rtc_peer_connection_handler_client.h",
- "peerconnection/rtc_peer_connection_handler_platform.h",
"peerconnection/rtc_rtp_receiver_platform.cc",
"peerconnection/rtc_rtp_receiver_platform.h",
"peerconnection/rtc_rtp_sender_platform.cc",
diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h b/third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h
deleted file mode 100644
index 870ea35..0000000
--- a/third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_PEER_CONNECTION_HANDLER_PLATFORM_H_
-#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_PEER_CONNECTION_HANDLER_PLATFORM_H_
-
-#include <memory>
-
-#include "third_party/blink/renderer/platform/peerconnection/rtc_stats.h"
-#include "third_party/blink/renderer/platform/platform_export.h"
-#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
-#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
-#include "third_party/blink/renderer/platform/wtf/vector.h"
-#include "third_party/webrtc/api/peer_connection_interface.h"
-#include "third_party/webrtc/api/rtc_error.h"
-#include "third_party/webrtc/api/rtp_transceiver_interface.h"
-#include "third_party/webrtc/api/stats/rtc_stats.h"
-
-namespace webrtc {
-enum class RTCErrorType;
-struct DataChannelInit;
-} // namespace webrtc
-
-namespace blink {
-
-class MediaConstraints;
-class RTCAnswerOptionsPlatform;
-class RTCIceCandidatePlatform;
-class RTCOfferOptionsPlatform;
-class RTCRtpSenderPlatform;
-class RTCRtpTransceiverPlatform;
-class RTCSessionDescriptionPlatform;
-class RTCSessionDescriptionRequest;
-class RTCStatsRequest;
-class RTCVoidRequest;
-class WebLocalFrame;
-class WebMediaStream;
-class WebMediaStreamTrack;
-
-class PLATFORM_EXPORT RTCPeerConnectionHandlerPlatform {
- public:
- enum class IceConnectionStateVersion {
- // Only applicable in Unified Plan when the JavaScript-exposed
- // iceConnectionState is calculated in blink. In this case, kLegacy is used
- // to report the webrtc::PeerConnectionInterface implementation which is not
- // visible in JavaScript, but still useful to track for debugging purposes.
- kLegacy,
- // The JavaScript-visible iceConnectionState. In Plan B, this is the same as
- // the webrtc::PeerConnectionInterface implementation.
- kDefault,
- };
-
- virtual ~RTCPeerConnectionHandlerPlatform() = default;
-
- virtual bool Initialize(
- const webrtc::PeerConnectionInterface::RTCConfiguration&,
- const MediaConstraints&,
- WebLocalFrame*) = 0;
-
- virtual void Stop() = 0;
- // This function should be called when the object is taken out of service.
- // There might be functions that need to return through the object, so it
- // cannot be deleted yet, but no new operations should be allowed.
- // All references to the object except the owning reference are deleted
- // by this function.
- virtual void StopAndUnregister() = 0;
-
- // Unified Plan: The list of transceivers after the createOffer() call.
- // Because of offerToReceive[Audio/Video] it is possible for createOffer() to
- // create new transceivers or update the direction of existing transceivers.
- // https://w3c.github.io/webrtc-pc/#legacy-configuration-extensions
- // Plan B: Returns an empty list.
- virtual Vector<std::unique_ptr<RTCRtpTransceiverPlatform>> CreateOffer(
- RTCSessionDescriptionRequest*,
- const MediaConstraints&) = 0;
- virtual Vector<std::unique_ptr<RTCRtpTransceiverPlatform>> CreateOffer(
- RTCSessionDescriptionRequest*,
- RTCOfferOptionsPlatform*) = 0;
- virtual void CreateAnswer(RTCSessionDescriptionRequest*,
- const MediaConstraints&) = 0;
- virtual void CreateAnswer(RTCSessionDescriptionRequest*,
- RTCAnswerOptionsPlatform*) = 0;
- virtual void SetLocalDescription(RTCVoidRequest*) = 0;
- virtual void SetLocalDescription(RTCVoidRequest*,
- RTCSessionDescriptionPlatform*) = 0;
- virtual void SetRemoteDescription(RTCVoidRequest*,
- RTCSessionDescriptionPlatform*) = 0;
- virtual RTCSessionDescriptionPlatform* LocalDescription() = 0;
- virtual RTCSessionDescriptionPlatform* RemoteDescription() = 0;
- virtual RTCSessionDescriptionPlatform* CurrentLocalDescription() = 0;
- virtual RTCSessionDescriptionPlatform* CurrentRemoteDescription() = 0;
- virtual RTCSessionDescriptionPlatform* PendingLocalDescription() = 0;
- virtual RTCSessionDescriptionPlatform* PendingRemoteDescription() = 0;
- virtual const webrtc::PeerConnectionInterface::RTCConfiguration&
- GetConfiguration() const = 0;
- virtual webrtc::RTCErrorType SetConfiguration(
- const webrtc::PeerConnectionInterface::RTCConfiguration&) = 0;
-
- virtual void AddICECandidate(RTCVoidRequest*, RTCIceCandidatePlatform*) = 0;
- virtual void RestartIce() = 0;
- virtual void GetStats(RTCStatsRequest*) = 0;
- // Gets stats using the new stats collection API, see
- // third_party/webrtc/api/stats/. These will replace the old stats collection
- // API when the new API has matured enough.
- virtual void GetStats(RTCStatsReportCallback,
- const Vector<webrtc::NonStandardGroupId>&) = 0;
- virtual scoped_refptr<webrtc::DataChannelInterface> CreateDataChannel(
- const String& label,
- const webrtc::DataChannelInit&) = 0;
- virtual webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
- AddTransceiverWithTrack(const WebMediaStreamTrack&,
- const webrtc::RtpTransceiverInit&) = 0;
- virtual webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
- AddTransceiverWithKind(
- // webrtc::MediaStreamTrackInterface::kAudioKind or kVideoKind
- const String& kind,
- const webrtc::RtpTransceiverInit&) = 0;
- // Adds the track to the peer connection, returning the resulting transceiver
- // or error.
- virtual webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
- AddTrack(const WebMediaStreamTrack&, const Vector<WebMediaStream>&) = 0;
- // Removes the sender.
- // In Plan B: Returns OK() with value nullptr on success. The sender's track
- // must be nulled by the caller.
- // In Unified Plan: Returns OK() with the updated transceiver state.
- virtual webrtc::RTCErrorOr<std::unique_ptr<RTCRtpTransceiverPlatform>>
- RemoveTrack(RTCRtpSenderPlatform*) = 0;
-
- // Returns a pointer to the underlying native PeerConnection object.
- virtual webrtc::PeerConnectionInterface* NativePeerConnection() = 0;
-
- virtual void RunSynchronousOnceClosureOnSignalingThread(
- CrossThreadOnceClosure closure,
- const char* trace_event_name) = 0;
- virtual void RunSynchronousRepeatingClosureOnSignalingThread(
- const base::RepeatingClosure& closure,
- const char* trace_event_name) = 0;
-
- // Inform chrome://webrtc-internals/ that the iceConnectionState has changed.
- virtual void TrackIceConnectionStateChange(
- IceConnectionStateVersion version,
- webrtc::PeerConnectionInterface::IceConnectionState state) = 0;
-};
-
-} // namespace blink
-
-#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_PEER_CONNECTION_HANDLER_PLATFORM_H_
diff --git a/third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.h b/third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.h
index 20782171..7768fe89 100644
--- a/third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.h
+++ b/third_party/blink/renderer/platform/peerconnection/webrtc_audio_sink.h
@@ -22,6 +22,7 @@
#include "third_party/blink/public/platform/modules/mediastream/web_media_stream_audio_sink.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_audio_level_calculator.h"
#include "third_party/blink/renderer/platform/platform_export.h"
+#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h"
#include "third_party/webrtc/api/media_stream_interface.h"
#include "third_party/webrtc/pc/media_stream_track.h"
#include "third_party/webrtc/rtc_base/time_utils.h"