Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1152)

Unified Diff: remoting/protocol/webrtc_transport.h

Issue 2172153005: Ensure that connection can be closed in response to a data message. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass all tests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/webrtc_data_stream_adapter.cc ('k') | remoting/protocol/webrtc_transport.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_transport.h
diff --git a/remoting/protocol/webrtc_transport.h b/remoting/protocol/webrtc_transport.h
index df3d21e992eccf550674b8b9e22201b869a554e1..ad1cf0c270b0d5ea5b91a233f846b0182d24a508 100644
--- a/remoting/protocol/webrtc_transport.h
+++ b/remoting/protocol/webrtc_transport.h
@@ -21,18 +21,13 @@
#include "remoting/signaling/signal_strategy.h"
#include "third_party/webrtc/api/peerconnectioninterface.h"
-namespace webrtc {
-class FakeAudioDeviceModule;
-} // namespace webrtc
-
namespace remoting {
namespace protocol {
class TransportContext;
class MessagePipe;
-class WebrtcTransport : public Transport,
- public webrtc::PeerConnectionObserver {
+class WebrtcTransport : public Transport {
public:
class EventHandler {
public:
@@ -70,12 +65,8 @@ class WebrtcTransport : public Transport,
EventHandler* event_handler);
~WebrtcTransport() override;
- webrtc::PeerConnectionInterface* peer_connection() {
- return peer_connection_;
- }
- webrtc::PeerConnectionFactoryInterface* peer_connection_factory() {
- return peer_connection_factory_;
- }
+ webrtc::PeerConnectionInterface* peer_connection();
+ webrtc::PeerConnectionFactoryInterface* peer_connection_factory();
remoting::WebrtcVideoEncoderFactory* video_encoder_factory() {
return video_encoder_factory_;
}
@@ -92,6 +83,13 @@ class WebrtcTransport : public Transport,
void Close(ErrorCode error);
private:
+ // PeerConnectionWrapper is responsible for PeerConnection creation,
+ // ownership. It passes all events to the corresponding methods below. This is
+ // necessary to make it possible to close and destroy PeerConnection
+ // asynchronously, as it may be on stack when the transport is destroyed.
+ class PeerConnectionWrapper;
+ friend class PeerConnectionWrapper;
+
void OnLocalSessionDescriptionCreated(
std::unique_ptr<webrtc::SessionDescriptionInterface> description,
const std::string& error);
@@ -100,21 +98,21 @@ class WebrtcTransport : public Transport,
bool success,
const std::string& error);
- // webrtc::PeerConnectionObserver interface.
+ // PeerConnection event handlers, called by PeerConnectionWrapper.
void OnSignalingChange(
- webrtc::PeerConnectionInterface::SignalingState new_state) override;
+ webrtc::PeerConnectionInterface::SignalingState new_state);
void OnAddStream(
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override;
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> stream);
void OnRemoveStream(
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override;
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> stream);
void OnDataChannel(
- rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) override;
- void OnRenegotiationNeeded() override;
+ rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel);
+ void OnRenegotiationNeeded();
void OnIceConnectionChange(
- webrtc::PeerConnectionInterface::IceConnectionState new_state) override;
+ webrtc::PeerConnectionInterface::IceConnectionState new_state);
void OnIceGatheringChange(
- webrtc::PeerConnectionInterface::IceGatheringState new_state) override;
- void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override;
+ webrtc::PeerConnectionInterface::IceGatheringState new_state);
+ void OnIceCandidate(const webrtc::IceCandidateInterface* candidate);
void RequestNegotiation();
void SendOffer();
@@ -131,11 +129,7 @@ class WebrtcTransport : public Transport,
crypto::HMAC handshake_hmac_;
- std::unique_ptr<webrtc::FakeAudioDeviceModule> fake_audio_device_module_;
-
- rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
- peer_connection_factory_;
- rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
+ std::unique_ptr<PeerConnectionWrapper> peer_connection_wrapper_;
remoting::WebrtcVideoEncoderFactory* video_encoder_factory_;
« no previous file with comments | « remoting/protocol/webrtc_data_stream_adapter.cc ('k') | remoting/protocol/webrtc_transport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698