| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 | 183 |
| 184 void IceConnectionToClient::OnIceTransportRouteChange( | 184 void IceConnectionToClient::OnIceTransportRouteChange( |
| 185 const std::string& channel_name, | 185 const std::string& channel_name, |
| 186 const TransportRoute& route) { | 186 const TransportRoute& route) { |
| 187 event_handler_->OnRouteChange(channel_name, route); | 187 event_handler_->OnRouteChange(channel_name, route); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void IceConnectionToClient::OnIceTransportError(ErrorCode error) { | 190 void IceConnectionToClient::OnIceTransportError(ErrorCode error) { |
| 191 DCHECK(thread_checker_.CalledOnValidThread()); | 191 DCHECK(thread_checker_.CalledOnValidThread()); |
| 192 | |
| 193 Disconnect(error); | 192 Disconnect(error); |
| 194 } | 193 } |
| 195 | 194 |
| 196 void IceConnectionToClient::OnChannelInitialized( | 195 void IceConnectionToClient::OnChannelInitialized( |
| 197 ChannelDispatcherBase* channel_dispatcher) { | 196 ChannelDispatcherBase* channel_dispatcher) { |
| 198 DCHECK(thread_checker_.CalledOnValidThread()); | 197 DCHECK(thread_checker_.CalledOnValidThread()); |
| 199 | 198 |
| 200 NotifyIfChannelsReady(); | 199 NotifyIfChannelsReady(); |
| 201 } | 200 } |
| 202 | 201 |
| 203 void IceConnectionToClient::OnChannelClosed( | 202 void IceConnectionToClient::OnChannelClosed( |
| 204 ChannelDispatcherBase* channel_dispatcher) { | 203 ChannelDispatcherBase* channel_dispatcher) { |
| 205 // ICE transport doesn't close channels dynamically. | 204 DCHECK(thread_checker_.CalledOnValidThread()); |
| 206 NOTREACHED(); | 205 Disconnect(OK); |
| 207 } | 206 } |
| 208 | 207 |
| 209 void IceConnectionToClient::NotifyIfChannelsReady() { | 208 void IceConnectionToClient::NotifyIfChannelsReady() { |
| 210 DCHECK(thread_checker_.CalledOnValidThread()); | 209 DCHECK(thread_checker_.CalledOnValidThread()); |
| 211 | 210 |
| 212 if (!control_dispatcher_ || !control_dispatcher_->is_connected()) | 211 if (!control_dispatcher_ || !control_dispatcher_->is_connected()) |
| 213 return; | 212 return; |
| 214 if (!event_dispatcher_ || !event_dispatcher_->is_connected()) | 213 if (!event_dispatcher_ || !event_dispatcher_->is_connected()) |
| 215 return; | 214 return; |
| 216 if (!video_dispatcher_ || !video_dispatcher_->is_connected()) | 215 if (!video_dispatcher_ || !video_dispatcher_->is_connected()) |
| 217 return; | 216 return; |
| 218 if ((!audio_writer_ || !audio_writer_->is_connected()) && | 217 if ((!audio_writer_ || !audio_writer_->is_connected()) && |
| 219 session_->config().is_audio_enabled()) { | 218 session_->config().is_audio_enabled()) { |
| 220 return; | 219 return; |
| 221 } | 220 } |
| 222 event_handler_->OnConnectionChannelsConnected(); | 221 event_handler_->OnConnectionChannelsConnected(); |
| 223 event_handler_->CreateMediaStreams(); | 222 event_handler_->CreateMediaStreams(); |
| 224 } | 223 } |
| 225 | 224 |
| 226 void IceConnectionToClient::CloseChannels() { | 225 void IceConnectionToClient::CloseChannels() { |
| 227 control_dispatcher_.reset(); | 226 control_dispatcher_.reset(); |
| 228 event_dispatcher_.reset(); | 227 event_dispatcher_.reset(); |
| 229 video_dispatcher_.reset(); | 228 video_dispatcher_.reset(); |
| 230 audio_writer_.reset(); | 229 audio_writer_.reset(); |
| 231 } | 230 } |
| 232 | 231 |
| 233 } // namespace protocol | 232 } // namespace protocol |
| 234 } // namespace remoting | 233 } // namespace remoting |
| OLD | NEW |