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/webrtc_connection_to_host.h" | 5 #include "remoting/protocol/webrtc_connection_to_host.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "jingle/glue/thread_wrapper.h" | 9 #include "jingle/glue/thread_wrapper.h" |
10 #include "remoting/protocol/client_control_dispatcher.h" | 10 #include "remoting/protocol/client_control_dispatcher.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 scoped_refptr<webrtc::MediaStreamInterface> stream) { | 132 scoped_refptr<webrtc::MediaStreamInterface> stream) { |
133 if (video_adapter_ && video_adapter_->label() == stream->label()) | 133 if (video_adapter_ && video_adapter_->label() == stream->label()) |
134 video_adapter_.reset(); | 134 video_adapter_.reset(); |
135 } | 135 } |
136 | 136 |
137 void WebrtcConnectionToHost::OnChannelInitialized( | 137 void WebrtcConnectionToHost::OnChannelInitialized( |
138 ChannelDispatcherBase* channel_dispatcher) { | 138 ChannelDispatcherBase* channel_dispatcher) { |
139 NotifyIfChannelsReady(); | 139 NotifyIfChannelsReady(); |
140 } | 140 } |
141 | 141 |
142 void WebrtcConnectionToHost::OnChannelError( | |
143 ChannelDispatcherBase* channel_dispatcher, | |
144 ErrorCode error) { | |
145 LOG(ERROR) << "Failed to connect channel " << channel_dispatcher; | |
146 CloseChannels(); | |
147 SetState(FAILED, CHANNEL_CONNECTION_ERROR); | |
148 } | |
149 | |
150 ConnectionToHost::State WebrtcConnectionToHost::state() const { | 142 ConnectionToHost::State WebrtcConnectionToHost::state() const { |
151 return state_; | 143 return state_; |
152 } | 144 } |
153 | 145 |
154 void WebrtcConnectionToHost::NotifyIfChannelsReady() { | 146 void WebrtcConnectionToHost::NotifyIfChannelsReady() { |
155 if (!control_dispatcher_.get() || !control_dispatcher_->is_connected()) | 147 if (!control_dispatcher_.get() || !control_dispatcher_->is_connected()) |
156 return; | 148 return; |
157 if (!event_dispatcher_.get() || !event_dispatcher_->is_connected()) | 149 if (!event_dispatcher_.get() || !event_dispatcher_->is_connected()) |
158 return; | 150 return; |
159 | 151 |
(...skipping 16 matching lines...) Expand all Loading... |
176 | 168 |
177 if (state != state_) { | 169 if (state != state_) { |
178 state_ = state; | 170 state_ = state; |
179 error_ = error; | 171 error_ = error; |
180 event_callback_->OnConnectionState(state_, error_); | 172 event_callback_->OnConnectionState(state_, error_); |
181 } | 173 } |
182 } | 174 } |
183 | 175 |
184 } // namespace protocol | 176 } // namespace protocol |
185 } // namespace remoting | 177 } // namespace remoting |
OLD | NEW |