OLD | NEW |
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_ICE_CONNECTION_TO_CLIENT_H_ |
6 #define REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ | 6 #define REMOTING_PROTOCOL_ICE_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; | 20 class AudioWriter; |
21 class HostControlDispatcher; | 21 class HostControlDispatcher; |
22 class HostEventDispatcher; | 22 class HostEventDispatcher; |
23 class HostVideoDispatcher; | 23 class HostVideoDispatcher; |
24 class VideoFeedbackStub; | 24 class VideoFeedbackStub; |
| 25 class VideoFramePump; |
25 | 26 |
26 // This class represents a remote viewer connection to the chromoting | 27 // This class represents a remote viewer connection to the chromoting |
27 // host. It sets up all protocol channels and connects them to the | 28 // host. It sets up all protocol channels and connects them to the |
28 // stubs. | 29 // stubs. |
29 class IceConnectionToClient : public ConnectionToClient, | 30 class IceConnectionToClient : public ConnectionToClient, |
30 public Session::EventHandler, | 31 public Session::EventHandler, |
31 public ChannelDispatcherBase::EventHandler { | 32 public ChannelDispatcherBase::EventHandler { |
32 public: | 33 public: |
33 explicit IceConnectionToClient(scoped_ptr<Session> session); | 34 IceConnectionToClient( |
| 35 scoped_ptr<Session> session, |
| 36 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner); |
34 ~IceConnectionToClient() override; | 37 ~IceConnectionToClient() override; |
35 | 38 |
36 // ConnectionToClient interface. | 39 // ConnectionToClient interface. |
37 void SetEventHandler( | 40 void SetEventHandler( |
38 ConnectionToClient::EventHandler* event_handler) override; | 41 ConnectionToClient::EventHandler* event_handler) override; |
39 Session* session() override; | 42 Session* session() override; |
40 void Disconnect(ErrorCode error) override; | 43 void Disconnect(ErrorCode error) override; |
41 void OnInputEventReceived(int64_t timestamp) override; | 44 void OnInputEventReceived(int64_t timestamp) override; |
42 VideoStub* video_stub() override; | 45 scoped_ptr<VideoStream> StartVideoStream( |
| 46 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override; |
43 AudioStub* audio_stub() override; | 47 AudioStub* audio_stub() override; |
44 ClientStub* client_stub() override; | 48 ClientStub* client_stub() override; |
45 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; | 49 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; |
46 void set_host_stub(HostStub* host_stub) override; | 50 void set_host_stub(HostStub* host_stub) override; |
47 void set_input_stub(InputStub* input_stub) override; | 51 void set_input_stub(InputStub* input_stub) override; |
48 void set_video_feedback_stub(VideoFeedbackStub* video_feedback_stub) override; | |
49 | 52 |
50 // Session::EventHandler interface. | 53 // Session::EventHandler interface. |
51 void OnSessionStateChange(Session::State state) override; | 54 void OnSessionStateChange(Session::State state) override; |
52 void OnSessionRouteChange(const std::string& channel_name, | 55 void OnSessionRouteChange(const std::string& channel_name, |
53 const TransportRoute& route) override; | 56 const TransportRoute& route) override; |
54 | 57 |
55 // ChannelDispatcherBase::EventHandler interface. | 58 // ChannelDispatcherBase::EventHandler interface. |
56 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; | 59 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; |
57 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, | 60 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, |
58 ErrorCode error) override; | 61 ErrorCode error) override; |
59 | 62 |
60 private: | 63 private: |
61 void NotifyIfChannelsReady(); | 64 void NotifyIfChannelsReady(); |
62 | 65 |
63 void Close(ErrorCode error); | 66 void Close(ErrorCode error); |
64 | 67 |
65 // Stops writing in the channels. | 68 // Stops writing in the channels. |
66 void CloseChannels(); | 69 void CloseChannels(); |
67 | 70 |
68 base::ThreadChecker thread_checker_; | 71 base::ThreadChecker thread_checker_; |
69 | 72 |
70 // Event handler for handling events sent from this object. | 73 // Event handler for handling events sent from this object. |
71 ConnectionToClient::EventHandler* handler_; | 74 ConnectionToClient::EventHandler* event_handler_; |
72 | 75 |
73 // The libjingle channel used to send and receive data from the remote client. | 76 // The libjingle channel used to send and receive data from the remote client. |
74 scoped_ptr<Session> session_; | 77 scoped_ptr<Session> session_; |
75 | 78 |
| 79 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; |
| 80 |
76 scoped_ptr<HostControlDispatcher> control_dispatcher_; | 81 scoped_ptr<HostControlDispatcher> control_dispatcher_; |
77 scoped_ptr<HostEventDispatcher> event_dispatcher_; | 82 scoped_ptr<HostEventDispatcher> event_dispatcher_; |
78 scoped_ptr<HostVideoDispatcher> video_dispatcher_; | 83 scoped_ptr<HostVideoDispatcher> video_dispatcher_; |
79 scoped_ptr<AudioWriter> audio_writer_; | 84 scoped_ptr<AudioWriter> audio_writer_; |
80 | 85 |
81 DISALLOW_COPY_AND_ASSIGN(IceConnectionToClient); | 86 DISALLOW_COPY_AND_ASSIGN(IceConnectionToClient); |
82 }; | 87 }; |
83 | 88 |
84 } // namespace protocol | 89 } // namespace protocol |
85 } // namespace remoting | 90 } // namespace remoting |
86 | 91 |
87 #endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ | 92 #endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |