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 #include "remoting/protocol/ice_connection_to_client.h" | 5 #include "remoting/protocol/ice_connection_to_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 void IceConnectionToClient::Disconnect(ErrorCode error) { | 77 void IceConnectionToClient::Disconnect(ErrorCode error) { |
78 DCHECK(thread_checker_.CalledOnValidThread()); | 78 DCHECK(thread_checker_.CalledOnValidThread()); |
79 | 79 |
80 // This should trigger OnConnectionClosed() event and this object | 80 // This should trigger OnConnectionClosed() event and this object |
81 // may be destroyed as the result. | 81 // may be destroyed as the result. |
82 session_->Close(error); | 82 session_->Close(error); |
83 } | 83 } |
84 | 84 |
85 void IceConnectionToClient::OnInputEventReceived(int64_t timestamp) { | |
86 DCHECK(thread_checker_.CalledOnValidThread()); | |
87 event_handler_->OnInputEventReceived(this, timestamp); | |
88 } | |
89 | |
90 std::unique_ptr<VideoStream> IceConnectionToClient::StartVideoStream( | 85 std::unique_ptr<VideoStream> IceConnectionToClient::StartVideoStream( |
91 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { | 86 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { |
92 DCHECK(thread_checker_.CalledOnValidThread()); | 87 DCHECK(thread_checker_.CalledOnValidThread()); |
93 | 88 |
94 std::unique_ptr<VideoEncoder> video_encoder = | 89 std::unique_ptr<VideoEncoder> video_encoder = |
95 VideoEncoder::Create(session_->config()); | 90 VideoEncoder::Create(session_->config()); |
96 | 91 |
97 std::unique_ptr<VideoFramePump> pump( | 92 std::unique_ptr<VideoFramePump> pump( |
98 new VideoFramePump(video_encode_task_runner_, std::move(desktop_capturer), | 93 new VideoFramePump(video_encode_task_runner_, std::move(desktop_capturer), |
99 std::move(video_encoder), video_dispatcher_.get())); | 94 std::move(video_encoder), video_dispatcher_.get())); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 197 |
203 NotifyIfChannelsReady(); | 198 NotifyIfChannelsReady(); |
204 } | 199 } |
205 | 200 |
206 void IceConnectionToClient::OnChannelClosed( | 201 void IceConnectionToClient::OnChannelClosed( |
207 ChannelDispatcherBase* channel_dispatcher) { | 202 ChannelDispatcherBase* channel_dispatcher) { |
208 // ICE transport doesn't close channels dynamically. | 203 // ICE transport doesn't close channels dynamically. |
209 NOTREACHED(); | 204 NOTREACHED(); |
210 } | 205 } |
211 | 206 |
| 207 void IceConnectionToClient::OnInputEventReceived(int64_t timestamp) { |
| 208 DCHECK(thread_checker_.CalledOnValidThread()); |
| 209 event_handler_->OnInputEventReceived(this, timestamp); |
| 210 } |
| 211 |
212 void IceConnectionToClient::NotifyIfChannelsReady() { | 212 void IceConnectionToClient::NotifyIfChannelsReady() { |
213 DCHECK(thread_checker_.CalledOnValidThread()); | 213 DCHECK(thread_checker_.CalledOnValidThread()); |
214 | 214 |
215 if (!control_dispatcher_ || !control_dispatcher_->is_connected()) | 215 if (!control_dispatcher_ || !control_dispatcher_->is_connected()) |
216 return; | 216 return; |
217 if (!event_dispatcher_ || !event_dispatcher_->is_connected()) | 217 if (!event_dispatcher_ || !event_dispatcher_->is_connected()) |
218 return; | 218 return; |
219 if (!video_dispatcher_ || !video_dispatcher_->is_connected()) | 219 if (!video_dispatcher_ || !video_dispatcher_->is_connected()) |
220 return; | 220 return; |
221 if ((!audio_writer_ || !audio_writer_->is_connected()) && | 221 if ((!audio_writer_ || !audio_writer_->is_connected()) && |
222 session_->config().is_audio_enabled()) { | 222 session_->config().is_audio_enabled()) { |
223 return; | 223 return; |
224 } | 224 } |
225 event_handler_->OnConnectionChannelsConnected(this); | 225 event_handler_->OnConnectionChannelsConnected(this); |
226 event_handler_->CreateMediaStreams(this); | 226 event_handler_->CreateMediaStreams(this); |
227 } | 227 } |
228 | 228 |
229 void IceConnectionToClient::CloseChannels() { | 229 void IceConnectionToClient::CloseChannels() { |
230 control_dispatcher_.reset(); | 230 control_dispatcher_.reset(); |
231 event_dispatcher_.reset(); | 231 event_dispatcher_.reset(); |
232 video_dispatcher_.reset(); | 232 video_dispatcher_.reset(); |
233 audio_writer_.reset(); | 233 audio_writer_.reset(); |
234 } | 234 } |
235 | 235 |
236 } // namespace protocol | 236 } // namespace protocol |
237 } // namespace remoting | 237 } // namespace remoting |
OLD | NEW |