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

Side by Side Diff: remoting/protocol/webrtc_connection_to_client.h

Issue 1510343002: Add WebrtcConnectionToClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webrtc_thread
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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/video_stream.h ('k') | remoting/protocol/webrtc_connection_to_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ 5 #ifndef REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_CLIENT_H_
6 #define REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ 6 #define REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #include "remoting/protocol/channel_dispatcher_base.h" 13 #include "remoting/protocol/channel_dispatcher_base.h"
14 #include "remoting/protocol/connection_to_client.h" 14 #include "remoting/protocol/connection_to_client.h"
15 #include "remoting/protocol/session.h" 15 #include "remoting/protocol/session.h"
16 16
17 namespace remoting { 17 namespace remoting {
18 namespace protocol { 18 namespace protocol {
19 19
20 class AudioWriter;
21 class HostControlDispatcher; 20 class HostControlDispatcher;
22 class HostEventDispatcher; 21 class HostEventDispatcher;
23 class HostVideoDispatcher;
24 class VideoFeedbackStub;
25 class VideoFramePump;
26 22
27 // This class represents a remote viewer connection to the chromoting 23 class WebrtcConnectionToClient : public ConnectionToClient,
28 // host. It sets up all protocol channels and connects them to the 24 public Session::EventHandler,
29 // stubs. 25 public ChannelDispatcherBase::EventHandler {
30 class IceConnectionToClient : public ConnectionToClient,
31 public Session::EventHandler,
32 public ChannelDispatcherBase::EventHandler {
33 public: 26 public:
34 IceConnectionToClient( 27 explicit WebrtcConnectionToClient(scoped_ptr<Session> session);
35 scoped_ptr<Session> session, 28 ~WebrtcConnectionToClient() override;
36 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner);
37 ~IceConnectionToClient() override;
38 29
39 // ConnectionToClient interface. 30 // ConnectionToClient interface.
40 void SetEventHandler( 31 void SetEventHandler(
41 ConnectionToClient::EventHandler* event_handler) override; 32 ConnectionToClient::EventHandler* event_handler) override;
42 Session* session() override; 33 Session* session() override;
43 void Disconnect(ErrorCode error) override; 34 void Disconnect(ErrorCode error) override;
44 void OnInputEventReceived(int64_t timestamp) override; 35 void OnInputEventReceived(int64_t timestamp) override;
45 scoped_ptr<VideoStream> StartVideoStream( 36 scoped_ptr<VideoStream> StartVideoStream(
46 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override; 37 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override;
47 AudioStub* audio_stub() override; 38 AudioStub* audio_stub() override;
48 ClientStub* client_stub() override; 39 ClientStub* client_stub() override;
49 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; 40 void set_clipboard_stub(ClipboardStub* clipboard_stub) override;
50 void set_host_stub(HostStub* host_stub) override; 41 void set_host_stub(HostStub* host_stub) override;
51 void set_input_stub(InputStub* input_stub) override; 42 void set_input_stub(InputStub* input_stub) override;
52 43
53 // Session::EventHandler interface. 44 // Session::EventHandler interface.
54 void OnSessionStateChange(Session::State state) override; 45 void OnSessionStateChange(Session::State state) override;
55 void OnSessionRouteChange(const std::string& channel_name, 46 void OnSessionRouteChange(const std::string& channel_name,
56 const TransportRoute& route) override; 47 const TransportRoute& route) override;
57 48
58 // ChannelDispatcherBase::EventHandler interface. 49 // ChannelDispatcherBase::EventHandler interface.
59 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; 50 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override;
60 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, 51 void OnChannelError(ChannelDispatcherBase* channel_dispatcher,
61 ErrorCode error) override; 52 ErrorCode error) override;
62 53
63 private: 54 private:
64 void NotifyIfChannelsReady();
65
66 void Close(ErrorCode error);
67
68 // Stops writing in the channels.
69 void CloseChannels();
70
71 base::ThreadChecker thread_checker_; 55 base::ThreadChecker thread_checker_;
72 56
73 // Event handler for handling events sent from this object. 57 // Event handler for handling events sent from this object.
74 ConnectionToClient::EventHandler* event_handler_; 58 ConnectionToClient::EventHandler* event_handler_ = nullptr;
75 59
76 // The libjingle channel used to send and receive data from the remote client.
77 scoped_ptr<Session> session_; 60 scoped_ptr<Session> session_;
78 61
79 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_;
80
81 scoped_ptr<HostControlDispatcher> control_dispatcher_; 62 scoped_ptr<HostControlDispatcher> control_dispatcher_;
82 scoped_ptr<HostEventDispatcher> event_dispatcher_; 63 scoped_ptr<HostEventDispatcher> event_dispatcher_;
83 scoped_ptr<HostVideoDispatcher> video_dispatcher_;
84 scoped_ptr<AudioWriter> audio_writer_;
85 64
86 DISALLOW_COPY_AND_ASSIGN(IceConnectionToClient); 65 DISALLOW_COPY_AND_ASSIGN(WebrtcConnectionToClient);
87 }; 66 };
88 67
89 } // namespace protocol 68 } // namespace protocol
90 } // namespace remoting 69 } // namespace remoting
91 70
92 #endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ 71 #endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_CLIENT_H_
OLDNEW
« no previous file with comments | « remoting/protocol/video_stream.h ('k') | remoting/protocol/webrtc_connection_to_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698