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

Unified Diff: remoting/protocol/webrtc_transport.h

Issue 1510333002: Cleanups in WebrtcTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
Index: remoting/protocol/webrtc_transport.h
diff --git a/remoting/protocol/webrtc_transport.h b/remoting/protocol/webrtc_transport.h
index 74ec30c9b4140ae7db0c8686aeb3d2c4a275b028..ae792f28980da6da0aa6c85995e6cdcfd428d281 100644
--- a/remoting/protocol/webrtc_transport.h
+++ b/remoting/protocol/webrtc_transport.h
@@ -9,7 +9,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
-#include "base/threading/thread.h"
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "remoting/protocol/transport.h"
@@ -27,13 +26,19 @@ namespace protocol {
class WebrtcTransport : public Transport,
public webrtc::PeerConnectionObserver {
public:
- WebrtcTransport(
- rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
- port_allocator_factory,
- TransportRole role,
- scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner);
+ WebrtcTransport(rtc::Thread* worker_thread,
+ rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
+ port_allocator_factory,
+ TransportRole role);
~WebrtcTransport() override;
+ webrtc::PeerConnectionInterface* peer_connection() {
+ return peer_connection_;
+ }
+ webrtc::PeerConnectionFactoryInterface* peer_connection_factory() {
+ return peer_connection_factory_;
+ }
+
// Transport interface.
void Start(EventHandler* event_handler,
Authenticator* authenticator) override;
@@ -42,12 +47,13 @@ class WebrtcTransport : public Transport,
StreamChannelFactory* GetMultiplexedChannelFactory() override;
private:
- void DoStart(rtc::Thread* worker_thread);
void OnLocalSessionDescriptionCreated(
scoped_ptr<webrtc::SessionDescriptionInterface> description,
const std::string& error);
void OnLocalDescriptionSet(bool success, const std::string& error);
- void OnRemoteDescriptionSet(bool success, const std::string& error);
+ void OnRemoteDescriptionSet(bool send_answer,
+ bool success,
+ const std::string& error);
// webrtc::PeerConnectionObserver interface.
void OnSignalingChange(
@@ -62,6 +68,8 @@ class WebrtcTransport : public Transport,
webrtc::PeerConnectionInterface::IceGatheringState new_state) override;
void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override;
+ void RequestNegotiation();
+ void SendOffer();
void EnsurePendingTransportInfoMessage();
void SendTransportInfo();
void AddPendingCandidatesIfPossible();
@@ -74,7 +82,7 @@ class WebrtcTransport : public Transport,
port_allocator_factory_;
TransportRole role_;
EventHandler* event_handler_ = nullptr;
- scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner_;
+ rtc::Thread* worker_thread_;
scoped_ptr<webrtc::FakeAudioDeviceModule> fake_audio_device_module_;
@@ -82,6 +90,8 @@ class WebrtcTransport : public Transport,
peer_connection_factory_;
rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
+ bool negotiation_pending_ = false;
+
scoped_ptr<buzz::XmlElement> pending_transport_info_message_;
base::OneShotTimer transport_info_timer_;
@@ -100,6 +110,7 @@ class WebrtcTransport : public Transport,
class WebrtcTransportFactory : public TransportFactory {
public:
WebrtcTransportFactory(
+ rtc::Thread* worker_thread,
SignalStrategy* signal_strategy,
rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
port_allocator_factory,
@@ -110,13 +121,12 @@ class WebrtcTransportFactory : public TransportFactory {
scoped_ptr<Transport> CreateTransport() override;
private:
+ rtc::Thread* worker_thread_;
SignalStrategy* signal_strategy_;
rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
port_allocator_factory_;
TransportRole role_;
- base::Thread worker_thread_;
-
DISALLOW_COPY_AND_ASSIGN(WebrtcTransportFactory);
};

Powered by Google App Engine
This is Rietveld 408576698