OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/jingle_chromotocol_connection.h" | 5 #include "remoting/protocol/jingle_session.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "remoting/base/constants.h" | 9 #include "remoting/base/constants.h" |
10 #include "remoting/jingle_glue/channel_socket_adapter.h" | 10 #include "remoting/jingle_glue/channel_socket_adapter.h" |
11 #include "remoting/jingle_glue/jingle_thread.h" | 11 #include "remoting/jingle_glue/jingle_thread.h" |
12 #include "remoting/jingle_glue/stream_socket_adapter.h" | 12 #include "remoting/jingle_glue/stream_socket_adapter.h" |
13 #include "remoting/protocol/jingle_chromotocol_server.h" | 13 #include "remoting/protocol/jingle_session_manager.h" |
14 #include "third_party/libjingle/source/talk/base/thread.h" | 14 #include "third_party/libjingle/source/talk/base/thread.h" |
15 #include "third_party/libjingle/source/talk/p2p/base/session.h" | 15 #include "third_party/libjingle/source/talk/p2p/base/session.h" |
16 #include "third_party/libjingle/source/talk/session/tunnel/pseudotcpchannel.h" | 16 #include "third_party/libjingle/source/talk/session/tunnel/pseudotcpchannel.h" |
17 | 17 |
18 using cricket::BaseSession; | 18 using cricket::BaseSession; |
19 using cricket::PseudoTcpChannel; | 19 using cricket::PseudoTcpChannel; |
20 using cricket::Session; | |
21 | 20 |
22 namespace remoting { | 21 namespace remoting { |
23 | 22 |
| 23 namespace protocol { |
| 24 |
24 namespace { | 25 namespace { |
25 const char kControlChannelName[] = "control"; | 26 const char kControlChannelName[] = "control"; |
26 const char kEventChannelName[] = "event"; | 27 const char kEventChannelName[] = "event"; |
27 const char kVideoChannelName[] = "video"; | 28 const char kVideoChannelName[] = "video"; |
28 const char kVideoRtpChannelName[] = "videortp"; | 29 const char kVideoRtpChannelName[] = "videortp"; |
29 const char kVideoRtcpChannelName[] = "videortcp"; | 30 const char kVideoRtcpChannelName[] = "videortcp"; |
30 } // namespace | 31 } // namespace |
31 | 32 |
32 const char JingleChromotocolConnection::kChromotingContentName[] = "chromoting"; | 33 const char JingleSession::kChromotingContentName[] = "chromoting"; |
33 | 34 |
34 JingleChromotocolConnection::JingleChromotocolConnection( | 35 JingleSession::JingleSession( |
35 JingleChromotocolServer* server) | 36 JingleSessionManager* jingle_session_manager) |
36 : server_(server), | 37 : jingle_session_manager_(jingle_session_manager), |
37 state_(INITIALIZING), | 38 state_(INITIALIZING), |
38 closed_(false), | 39 closed_(false), |
39 session_(NULL), | 40 cricket_session_(NULL), |
40 event_channel_(NULL), | 41 event_channel_(NULL), |
41 video_channel_(NULL) { | 42 video_channel_(NULL) { |
42 } | 43 } |
43 | 44 |
44 JingleChromotocolConnection::~JingleChromotocolConnection() { | 45 JingleSession::~JingleSession() { |
45 DCHECK(closed_); | 46 DCHECK(closed_); |
46 } | 47 } |
47 | 48 |
48 void JingleChromotocolConnection::Init(Session* session) { | 49 void JingleSession::Init(cricket::Session* cricket_session) { |
49 DCHECK_EQ(server_->message_loop(), MessageLoop::current()); | 50 DCHECK_EQ(jingle_session_manager_->message_loop(), MessageLoop::current()); |
50 | 51 |
51 session_ = session; | 52 cricket_session_ = cricket_session; |
52 jid_ = session_->remote_name(); | 53 jid_ = cricket_session_->remote_name(); |
53 session_->SignalState.connect( | 54 cricket_session_->SignalState.connect( |
54 this, &JingleChromotocolConnection::OnSessionState); | 55 this, &JingleSession::OnSessionState); |
55 } | 56 } |
56 | 57 |
57 bool JingleChromotocolConnection::HasSession(cricket::Session* session) { | 58 bool JingleSession::HasSession(cricket::Session* cricket_session) { |
58 return session_ == session; | 59 return cricket_session_ == cricket_session; |
59 } | 60 } |
60 | 61 |
61 Session* JingleChromotocolConnection::ReleaseSession() { | 62 cricket::Session* JingleSession::ReleaseSession() { |
62 DCHECK_EQ(server_->message_loop(), MessageLoop::current()); | 63 DCHECK_EQ(jingle_session_manager_->message_loop(), MessageLoop::current()); |
63 | 64 |
64 SetState(CLOSED); | 65 SetState(CLOSED); |
65 Session* session = session_; | 66 cricket::Session* session = cricket_session_; |
66 if (session_) | 67 if (cricket_session_) |
67 session_->SignalState.disconnect(this); | 68 cricket_session_->SignalState.disconnect(this); |
68 session_ = NULL; | 69 cricket_session_ = NULL; |
69 closed_ = true; | 70 closed_ = true; |
70 return session; | 71 return session; |
71 } | 72 } |
72 | 73 |
73 void JingleChromotocolConnection::SetStateChangeCallback( | 74 void JingleSession::SetStateChangeCallback( |
74 StateChangeCallback* callback) { | 75 StateChangeCallback* callback) { |
75 DCHECK_EQ(server_->message_loop(), MessageLoop::current()); | 76 DCHECK_EQ(jingle_session_manager_->message_loop(), MessageLoop::current()); |
76 DCHECK(callback); | 77 DCHECK(callback); |
77 state_change_callback_.reset(callback); | 78 state_change_callback_.reset(callback); |
78 } | 79 } |
79 | 80 |
80 net::Socket* JingleChromotocolConnection::control_channel() { | 81 net::Socket* JingleSession::control_channel() { |
81 DCHECK_EQ(server_->message_loop(), MessageLoop::current()); | 82 DCHECK_EQ(jingle_session_manager_->message_loop(), MessageLoop::current()); |
82 return control_channel_adapter_.get(); | 83 return control_channel_adapter_.get(); |
83 } | 84 } |
84 | 85 |
85 net::Socket* JingleChromotocolConnection::event_channel() { | 86 net::Socket* JingleSession::event_channel() { |
86 DCHECK_EQ(server_->message_loop(), MessageLoop::current()); | 87 DCHECK_EQ(jingle_session_manager_->message_loop(), MessageLoop::current()); |
87 return event_channel_adapter_.get(); | 88 return event_channel_adapter_.get(); |
88 } | 89 } |
89 | 90 |
90 // TODO(sergeyu): Remove this method after we switch to RTP. | 91 // TODO(sergeyu): Remove this method after we switch to RTP. |
91 net::Socket* JingleChromotocolConnection::video_channel() { | 92 net::Socket* JingleSession::video_channel() { |
92 DCHECK_EQ(server_->message_loop(), MessageLoop::current()); | 93 DCHECK_EQ(jingle_session_manager_->message_loop(), MessageLoop::current()); |
93 return video_channel_adapter_.get(); | 94 return video_channel_adapter_.get(); |
94 } | 95 } |
95 | 96 |
96 net::Socket* JingleChromotocolConnection::video_rtp_channel() { | 97 net::Socket* JingleSession::video_rtp_channel() { |
97 DCHECK_EQ(server_->message_loop(), MessageLoop::current()); | 98 DCHECK_EQ(jingle_session_manager_->message_loop(), MessageLoop::current()); |
98 return video_rtp_channel_.get(); | 99 return video_rtp_channel_.get(); |
99 } | 100 } |
100 | 101 |
101 net::Socket* JingleChromotocolConnection::video_rtcp_channel() { | 102 net::Socket* JingleSession::video_rtcp_channel() { |
102 DCHECK_EQ(server_->message_loop(), MessageLoop::current()); | 103 DCHECK_EQ(jingle_session_manager_->message_loop(), MessageLoop::current()); |
103 return video_rtcp_channel_.get(); | 104 return video_rtcp_channel_.get(); |
104 } | 105 } |
105 | 106 |
106 const std::string& JingleChromotocolConnection::jid() { | 107 const std::string& JingleSession::jid() { |
107 // No synchronization is needed because jid_ is not changed | 108 // No synchronization is needed because jid_ is not changed |
108 // after new connection is passed to JingleChromotocolServer callback. | 109 // after new connection is passed to JingleChromotocolServer callback. |
109 return jid_; | 110 return jid_; |
110 } | 111 } |
111 | 112 |
112 MessageLoop* JingleChromotocolConnection::message_loop() { | 113 MessageLoop* JingleSession::message_loop() { |
113 return server_->message_loop(); | 114 return jingle_session_manager_->message_loop(); |
114 } | 115 } |
115 | 116 |
116 const CandidateChromotocolConfig* | 117 const CandidateChromotocolConfig* |
117 JingleChromotocolConnection::candidate_config() { | 118 JingleSession::candidate_config() { |
118 DCHECK(candidate_config_.get()); | 119 DCHECK(candidate_config_.get()); |
119 return candidate_config_.get(); | 120 return candidate_config_.get(); |
120 } | 121 } |
121 | 122 |
122 void JingleChromotocolConnection::set_candidate_config( | 123 void JingleSession::set_candidate_config( |
123 const CandidateChromotocolConfig* candidate_config) { | 124 const CandidateChromotocolConfig* candidate_config) { |
124 DCHECK(!candidate_config_.get()); | 125 DCHECK(!candidate_config_.get()); |
125 DCHECK(candidate_config); | 126 DCHECK(candidate_config); |
126 candidate_config_.reset(candidate_config); | 127 candidate_config_.reset(candidate_config); |
127 } | 128 } |
128 | 129 |
129 const ChromotocolConfig* JingleChromotocolConnection::config() { | 130 const ChromotocolConfig* JingleSession::config() { |
130 DCHECK(config_.get()); | 131 DCHECK(config_.get()); |
131 return config_.get(); | 132 return config_.get(); |
132 } | 133 } |
133 | 134 |
134 void JingleChromotocolConnection::set_config(const ChromotocolConfig* config) { | 135 void JingleSession::set_config(const ChromotocolConfig* config) { |
135 DCHECK(!config_.get()); | 136 DCHECK(!config_.get()); |
136 DCHECK(config); | 137 DCHECK(config); |
137 config_.reset(config); | 138 config_.reset(config); |
138 } | 139 } |
139 | 140 |
140 void JingleChromotocolConnection::Close(Task* closed_task) { | 141 void JingleSession::Close(Task* closed_task) { |
141 if (MessageLoop::current() != server_->message_loop()) { | 142 if (MessageLoop::current() != jingle_session_manager_->message_loop()) { |
142 server_->message_loop()->PostTask( | 143 jingle_session_manager_->message_loop()->PostTask( |
143 FROM_HERE, NewRunnableMethod(this, &JingleChromotocolConnection::Close, | 144 FROM_HERE, NewRunnableMethod(this, &JingleSession::Close, |
144 closed_task)); | 145 closed_task)); |
145 return; | 146 return; |
146 } | 147 } |
147 | 148 |
148 if (!closed_) { | 149 if (!closed_) { |
149 if (control_channel_adapter_.get()) | 150 if (control_channel_adapter_.get()) |
150 control_channel_adapter_->Close(net::ERR_CONNECTION_CLOSED); | 151 control_channel_adapter_->Close(net::ERR_CONNECTION_CLOSED); |
151 | 152 |
152 if (control_channel_) { | 153 if (control_channel_) { |
153 control_channel_->OnSessionTerminate(session_); | 154 control_channel_->OnSessionTerminate(cricket_session_); |
154 control_channel_ = NULL; | 155 control_channel_ = NULL; |
155 } | 156 } |
156 | 157 |
157 if (event_channel_adapter_.get()) | 158 if (event_channel_adapter_.get()) |
158 event_channel_adapter_->Close(net::ERR_CONNECTION_CLOSED); | 159 event_channel_adapter_->Close(net::ERR_CONNECTION_CLOSED); |
159 | 160 |
160 if (event_channel_) { | 161 if (event_channel_) { |
161 event_channel_->OnSessionTerminate(session_); | 162 event_channel_->OnSessionTerminate(cricket_session_); |
162 event_channel_ = NULL; | 163 event_channel_ = NULL; |
163 } | 164 } |
164 | 165 |
165 if (video_channel_adapter_.get()) | 166 if (video_channel_adapter_.get()) |
166 video_channel_adapter_->Close(net::ERR_CONNECTION_CLOSED); | 167 video_channel_adapter_->Close(net::ERR_CONNECTION_CLOSED); |
167 | 168 |
168 if (video_channel_) { | 169 if (video_channel_) { |
169 video_channel_->OnSessionTerminate(session_); | 170 video_channel_->OnSessionTerminate(cricket_session_); |
170 video_channel_ = NULL; | 171 video_channel_ = NULL; |
171 } | 172 } |
172 | 173 |
173 if (video_rtp_channel_.get()) | 174 if (video_rtp_channel_.get()) |
174 video_rtp_channel_->Close(net::ERR_CONNECTION_CLOSED); | 175 video_rtp_channel_->Close(net::ERR_CONNECTION_CLOSED); |
175 if (video_rtcp_channel_.get()) | 176 if (video_rtcp_channel_.get()) |
176 video_rtcp_channel_->Close(net::ERR_CONNECTION_CLOSED); | 177 video_rtcp_channel_->Close(net::ERR_CONNECTION_CLOSED); |
177 | 178 |
178 if (session_) | 179 if (cricket_session_) |
179 session_->Terminate(); | 180 cricket_session_->Terminate(); |
180 | 181 |
181 SetState(CLOSED); | 182 SetState(CLOSED); |
182 | 183 |
183 closed_ = true; | 184 closed_ = true; |
184 } | 185 } |
185 | 186 |
186 closed_task->Run(); | 187 closed_task->Run(); |
187 delete closed_task; | 188 delete closed_task; |
188 } | 189 } |
189 | 190 |
190 void JingleChromotocolConnection::OnSessionState( | 191 void JingleSession::OnSessionState( |
191 BaseSession* session, BaseSession::State state) { | 192 BaseSession* session, BaseSession::State state) { |
192 DCHECK_EQ(session_, session); | 193 DCHECK_EQ(cricket_session_, session); |
193 | 194 |
194 switch (state) { | 195 switch (state) { |
195 case Session::STATE_SENTINITIATE: | 196 case cricket::Session::STATE_SENTINITIATE: |
196 case Session::STATE_RECEIVEDINITIATE: | 197 case cricket::Session::STATE_RECEIVEDINITIATE: |
197 OnInitiate(); | 198 OnInitiate(); |
198 break; | 199 break; |
199 | 200 |
200 case Session::STATE_SENTACCEPT: | 201 case cricket::Session::STATE_SENTACCEPT: |
201 case Session::STATE_RECEIVEDACCEPT: | 202 case cricket::Session::STATE_RECEIVEDACCEPT: |
202 OnAccept(); | 203 OnAccept(); |
203 break; | 204 break; |
204 | 205 |
205 case Session::STATE_SENTTERMINATE: | 206 case cricket::Session::STATE_SENTTERMINATE: |
206 case Session::STATE_RECEIVEDTERMINATE: | 207 case cricket::Session::STATE_RECEIVEDTERMINATE: |
207 case Session::STATE_SENTREJECT: | 208 case cricket::Session::STATE_SENTREJECT: |
208 case Session::STATE_RECEIVEDREJECT: | 209 case cricket::Session::STATE_RECEIVEDREJECT: |
209 OnTerminate(); | 210 OnTerminate(); |
210 break; | 211 break; |
211 | 212 |
212 case Session::STATE_DEINIT: | 213 case cricket::Session::STATE_DEINIT: |
213 // Close() must have been called before this. | 214 // Close() must have been called before this. |
214 NOTREACHED(); | 215 NOTREACHED(); |
215 break; | 216 break; |
216 | 217 |
217 default: | 218 default: |
218 // We don't care about other steates. | 219 // We don't care about other steates. |
219 break; | 220 break; |
220 } | 221 } |
221 } | 222 } |
222 | 223 |
223 void JingleChromotocolConnection::OnInitiate() { | 224 void JingleSession::OnInitiate() { |
224 jid_ = session_->remote_name(); | 225 jid_ = cricket_session_->remote_name(); |
225 | 226 |
226 std::string content_name; | 227 std::string content_name; |
227 // If we initiate the connection, we get to specify the content name. When | 228 // If we initiate the session, we get to specify the content name. When |
228 // accepting one, the remote end specifies it. | 229 // accepting one, the remote end specifies it. |
229 if (session_->initiator()) { | 230 if (cricket_session_->initiator()) { |
230 content_name = kChromotingContentName; | 231 content_name = kChromotingContentName; |
231 } else { | 232 } else { |
232 const cricket::ContentInfo* content; | 233 const cricket::ContentInfo* content; |
233 content = session_->remote_description()->FirstContentByType( | 234 content = cricket_session_->remote_description()->FirstContentByType( |
234 kChromotingXmlNamespace); | 235 kChromotingXmlNamespace); |
235 CHECK(content); | 236 CHECK(content); |
236 content_name = content->name; | 237 content_name = content->name; |
237 } | 238 } |
238 | 239 |
239 // Create video RTP channels. | 240 // Create video RTP channels. |
240 video_rtp_channel_.reset(new TransportChannelSocketAdapter( | 241 video_rtp_channel_.reset(new TransportChannelSocketAdapter( |
241 session_->CreateChannel(content_name, kVideoRtpChannelName))); | 242 cricket_session_->CreateChannel(content_name, kVideoRtpChannelName))); |
242 video_rtcp_channel_.reset(new TransportChannelSocketAdapter( | 243 video_rtcp_channel_.reset(new TransportChannelSocketAdapter( |
243 session_->CreateChannel(content_name, kVideoRtcpChannelName))); | 244 cricket_session_->CreateChannel(content_name, kVideoRtcpChannelName))); |
244 | 245 |
245 // Create control channel. | 246 // Create control channel. |
246 control_channel_ = new PseudoTcpChannel(server_->jingle_thread(), session_); | 247 control_channel_ = new PseudoTcpChannel( |
| 248 jingle_session_manager_->jingle_thread(), cricket_session_); |
247 control_channel_->Connect(content_name, kControlChannelName); | 249 control_channel_->Connect(content_name, kControlChannelName); |
248 control_channel_adapter_.reset(new StreamSocketAdapter( | 250 control_channel_adapter_.reset(new StreamSocketAdapter( |
249 control_channel_->GetStream())); | 251 control_channel_->GetStream())); |
250 | 252 |
251 // Create event channel. | 253 // Create event channel. |
252 event_channel_ = new PseudoTcpChannel(server_->jingle_thread(), session_); | 254 event_channel_ = new PseudoTcpChannel( |
| 255 jingle_session_manager_->jingle_thread(), cricket_session_); |
253 event_channel_->Connect(content_name, kEventChannelName); | 256 event_channel_->Connect(content_name, kEventChannelName); |
254 event_channel_adapter_.reset(new StreamSocketAdapter( | 257 event_channel_adapter_.reset(new StreamSocketAdapter( |
255 event_channel_->GetStream())); | 258 event_channel_->GetStream())); |
256 | 259 |
257 // Create video channel. | 260 // Create video channel. |
258 // TODO(sergeyu): Remove video channel when we are ready to switch to RTP. | 261 // TODO(sergeyu): Remove video channel when we are ready to switch to RTP. |
259 video_channel_ = new PseudoTcpChannel(server_->jingle_thread(), session_); | 262 video_channel_ = new PseudoTcpChannel( |
| 263 jingle_session_manager_->jingle_thread(), cricket_session_); |
260 video_channel_->Connect(content_name, kVideoChannelName); | 264 video_channel_->Connect(content_name, kVideoChannelName); |
261 video_channel_adapter_.reset(new StreamSocketAdapter( | 265 video_channel_adapter_.reset(new StreamSocketAdapter( |
262 video_channel_->GetStream())); | 266 video_channel_->GetStream())); |
263 | 267 |
264 if (!session_->initiator()) | 268 if (!cricket_session_->initiator()) |
265 server_->AcceptConnection(this, session_); | 269 jingle_session_manager_->AcceptConnection(this, cricket_session_); |
266 | 270 |
267 SetState(CONNECTING); | 271 SetState(CONNECTING); |
268 } | 272 } |
269 | 273 |
270 void JingleChromotocolConnection::OnAccept() { | 274 void JingleSession::OnAccept() { |
271 // Set config for outgoing connections. | 275 // Set the config if we are the one who initiated the session. |
272 if (session_->initiator()) { | 276 if (cricket_session_->initiator()) { |
273 const cricket::ContentInfo* content = | 277 const cricket::ContentInfo* content = |
274 session_->remote_description()->FirstContentByType( | 278 cricket_session_->remote_description()->FirstContentByType( |
275 kChromotingXmlNamespace); | 279 kChromotingXmlNamespace); |
276 CHECK(content); | 280 CHECK(content); |
277 | 281 |
278 const ChromotocolContentDescription* content_description = | 282 const protocol::ContentDescription* content_description = |
279 static_cast<const ChromotocolContentDescription*>(content->description); | 283 static_cast<const protocol::ContentDescription*>(content->description); |
280 ChromotocolConfig* config = content_description->config()->GetFinalConfig(); | 284 ChromotocolConfig* config = content_description->config()->GetFinalConfig(); |
281 | 285 |
282 // Terminate the session if the config we received is invalid. | 286 // Terminate the session if the config we received is invalid. |
283 if (!config || !candidate_config()->IsSupported(config)) { | 287 if (!config || !candidate_config()->IsSupported(config)) { |
284 // TODO(sergeyu): Inform the user that the host is misbehaving? | 288 // TODO(sergeyu): Inform the user that the host is misbehaving? |
285 LOG(ERROR) << "Terminating outgoing session after an " | 289 LOG(ERROR) << "Terminating outgoing session after an " |
286 "invalid session description has been received."; | 290 "invalid session description has been received."; |
287 session_->Terminate(); | 291 cricket_session_->Terminate(); |
288 return; | 292 return; |
289 } | 293 } |
290 | 294 |
291 set_config(config); | 295 set_config(config); |
292 } | 296 } |
293 | 297 |
294 SetState(CONNECTED); | 298 SetState(CONNECTED); |
295 } | 299 } |
296 | 300 |
297 void JingleChromotocolConnection::OnTerminate() { | 301 void JingleSession::OnTerminate() { |
298 if (control_channel_adapter_.get()) | 302 if (control_channel_adapter_.get()) |
299 control_channel_adapter_->Close(net::ERR_CONNECTION_ABORTED); | 303 control_channel_adapter_->Close(net::ERR_CONNECTION_ABORTED); |
300 if (control_channel_) { | 304 if (control_channel_) { |
301 control_channel_->OnSessionTerminate(session_); | 305 control_channel_->OnSessionTerminate(cricket_session_); |
302 control_channel_ = NULL; | 306 control_channel_ = NULL; |
303 } | 307 } |
304 | 308 |
305 if (event_channel_adapter_.get()) | 309 if (event_channel_adapter_.get()) |
306 event_channel_adapter_->Close(net::ERR_CONNECTION_ABORTED); | 310 event_channel_adapter_->Close(net::ERR_CONNECTION_ABORTED); |
307 if (event_channel_) { | 311 if (event_channel_) { |
308 event_channel_->OnSessionTerminate(session_); | 312 event_channel_->OnSessionTerminate(cricket_session_); |
309 event_channel_ = NULL; | 313 event_channel_ = NULL; |
310 } | 314 } |
311 | 315 |
312 if (video_channel_adapter_.get()) | 316 if (video_channel_adapter_.get()) |
313 video_channel_adapter_->Close(net::ERR_CONNECTION_ABORTED); | 317 video_channel_adapter_->Close(net::ERR_CONNECTION_ABORTED); |
314 if (video_channel_) { | 318 if (video_channel_) { |
315 video_channel_->OnSessionTerminate(session_); | 319 video_channel_->OnSessionTerminate(cricket_session_); |
316 video_channel_ = NULL; | 320 video_channel_ = NULL; |
317 } | 321 } |
318 | 322 |
319 if (video_rtp_channel_.get()) | 323 if (video_rtp_channel_.get()) |
320 video_rtp_channel_->Close(net::ERR_CONNECTION_ABORTED); | 324 video_rtp_channel_->Close(net::ERR_CONNECTION_ABORTED); |
321 if (video_rtcp_channel_.get()) | 325 if (video_rtcp_channel_.get()) |
322 video_rtcp_channel_->Close(net::ERR_CONNECTION_ABORTED); | 326 video_rtcp_channel_->Close(net::ERR_CONNECTION_ABORTED); |
323 | 327 |
324 SetState(CLOSED); | 328 SetState(CLOSED); |
325 | 329 |
326 closed_ = true; | 330 closed_ = true; |
327 } | 331 } |
328 | 332 |
329 void JingleChromotocolConnection::SetState(State new_state) { | 333 void JingleSession::SetState(State new_state) { |
330 if (new_state != state_) { | 334 if (new_state != state_) { |
331 state_ = new_state; | 335 state_ = new_state; |
332 if (!closed_ && state_change_callback_.get()) | 336 if (!closed_ && state_change_callback_.get()) |
333 state_change_callback_->Run(new_state); | 337 state_change_callback_->Run(new_state); |
334 } | 338 } |
335 } | 339 } |
336 | 340 |
| 341 } // namespace protocol |
| 342 |
337 } // namespace remoting | 343 } // namespace remoting |
OLD | NEW |