| 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_WEBRTC_CONNECTION_TO_HOST_H_ | 5 #ifndef REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ |
| 6 #define REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ | 6 #define REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "remoting/protocol/channel_dispatcher_base.h" | 12 #include "remoting/protocol/channel_dispatcher_base.h" |
| 13 #include "remoting/protocol/clipboard_filter.h" | 13 #include "remoting/protocol/clipboard_filter.h" |
| 14 #include "remoting/protocol/connection_to_host.h" | 14 #include "remoting/protocol/connection_to_host.h" |
| 15 #include "remoting/protocol/errors.h" | 15 #include "remoting/protocol/errors.h" |
| 16 #include "remoting/protocol/input_filter.h" | 16 #include "remoting/protocol/input_filter.h" |
| 17 #include "remoting/protocol/session.h" | 17 #include "remoting/protocol/session.h" |
| 18 #include "remoting/protocol/webrtc_transport.h" | 18 #include "remoting/protocol/webrtc_transport.h" |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 namespace protocol { | 21 namespace protocol { |
| 22 | 22 |
| 23 class ClientControlDispatcher; | 23 class ClientControlDispatcher; |
| 24 class ClientEventDispatcher; | 24 class ClientEventDispatcher; |
| 25 class SessionConfig; | 25 class SessionConfig; |
| 26 class WebrtcVideoRendererAdapter; | 26 class WebrtcVideoRendererAdapter; |
| 27 class WebrtcAudioSinkAdapter; |
| 27 | 28 |
| 28 class WebrtcConnectionToHost : public ConnectionToHost, | 29 class WebrtcConnectionToHost : public ConnectionToHost, |
| 29 public Session::EventHandler, | 30 public Session::EventHandler, |
| 30 public WebrtcTransport::EventHandler, | 31 public WebrtcTransport::EventHandler, |
| 31 public ChannelDispatcherBase::EventHandler { | 32 public ChannelDispatcherBase::EventHandler { |
| 32 public: | 33 public: |
| 33 WebrtcConnectionToHost(); | 34 WebrtcConnectionToHost(); |
| 34 ~WebrtcConnectionToHost() override; | 35 ~WebrtcConnectionToHost() override; |
| 35 | 36 |
| 36 // ConnectionToHost interface. | 37 // ConnectionToHost interface. |
| 37 void set_client_stub(ClientStub* client_stub) override; | 38 void set_client_stub(ClientStub* client_stub) override; |
| 38 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; | 39 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; |
| 39 void set_video_renderer(VideoRenderer* video_renderer) override; | 40 void set_video_renderer(VideoRenderer* video_renderer) override; |
| 40 void InitializeAudio( | 41 void InitializeAudio( |
| 41 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner, | 42 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner, |
| 42 base::WeakPtr<AudioStub> audio_stub) override; | 43 base::WeakPtr<AudioStub> audio_consumer) override; |
| 43 void Connect(std::unique_ptr<Session> session, | 44 void Connect(std::unique_ptr<Session> session, |
| 44 scoped_refptr<TransportContext> transport_context, | 45 scoped_refptr<TransportContext> transport_context, |
| 45 HostEventCallback* event_callback) override; | 46 HostEventCallback* event_callback) override; |
| 46 const SessionConfig& config() override; | 47 const SessionConfig& config() override; |
| 47 ClipboardStub* clipboard_forwarder() override; | 48 ClipboardStub* clipboard_forwarder() override; |
| 48 HostStub* host_stub() override; | 49 HostStub* host_stub() override; |
| 49 InputStub* input_stub() override; | 50 InputStub* input_stub() override; |
| 50 State state() const override; | 51 State state() const override; |
| 51 | 52 |
| 52 private: | 53 private: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 76 void CloseChannels(); | 77 void CloseChannels(); |
| 77 | 78 |
| 78 void OnFrameRendered(uint32_t frame_id, | 79 void OnFrameRendered(uint32_t frame_id, |
| 79 base::TimeTicks event_timestamp, | 80 base::TimeTicks event_timestamp, |
| 80 base::TimeTicks frame_rendered_time); | 81 base::TimeTicks frame_rendered_time); |
| 81 | 82 |
| 82 void SetState(State state, ErrorCode error); | 83 void SetState(State state, ErrorCode error); |
| 83 | 84 |
| 84 HostEventCallback* event_callback_ = nullptr; | 85 HostEventCallback* event_callback_ = nullptr; |
| 85 | 86 |
| 87 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner_; |
| 88 |
| 86 // Stub for incoming messages. | 89 // Stub for incoming messages. |
| 87 ClientStub* client_stub_ = nullptr; | 90 ClientStub* client_stub_ = nullptr; |
| 88 VideoRenderer* video_renderer_ = nullptr; | 91 VideoRenderer* video_renderer_ = nullptr; |
| 92 base::WeakPtr<AudioStub> audio_consumer_; |
| 89 ClipboardStub* clipboard_stub_ = nullptr; | 93 ClipboardStub* clipboard_stub_ = nullptr; |
| 90 | 94 |
| 91 std::unique_ptr<Session> session_; | 95 std::unique_ptr<Session> session_; |
| 92 std::unique_ptr<WebrtcTransport> transport_; | 96 std::unique_ptr<WebrtcTransport> transport_; |
| 93 | 97 |
| 94 std::unique_ptr<ClientControlDispatcher> control_dispatcher_; | 98 std::unique_ptr<ClientControlDispatcher> control_dispatcher_; |
| 95 std::unique_ptr<ClientEventDispatcher> event_dispatcher_; | 99 std::unique_ptr<ClientEventDispatcher> event_dispatcher_; |
| 96 ClipboardFilter clipboard_forwarder_; | 100 ClipboardFilter clipboard_forwarder_; |
| 97 InputFilter event_forwarder_; | 101 InputFilter event_forwarder_; |
| 98 | 102 |
| 99 std::unique_ptr<WebrtcVideoRendererAdapter> video_adapter_; | 103 std::unique_ptr<WebrtcVideoRendererAdapter> video_adapter_; |
| 104 std::unique_ptr<WebrtcAudioSinkAdapter> audio_adapter_; |
| 100 | 105 |
| 101 // Internal state of the connection. | 106 // Internal state of the connection. |
| 102 State state_ = INITIALIZING; | 107 State state_ = INITIALIZING; |
| 103 ErrorCode error_ = OK; | 108 ErrorCode error_ = OK; |
| 104 | 109 |
| 105 private: | |
| 106 DISALLOW_COPY_AND_ASSIGN(WebrtcConnectionToHost); | 110 DISALLOW_COPY_AND_ASSIGN(WebrtcConnectionToHost); |
| 107 }; | 111 }; |
| 108 | 112 |
| 109 } // namespace protocol | 113 } // namespace protocol |
| 110 } // namespace remoting | 114 } // namespace remoting |
| 111 | 115 |
| 112 #endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ | 116 #endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ |
| OLD | NEW |