OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 // Destroy any existing impl_. | 49 // Destroy any existing impl_. |
50 if (impl_) { | 50 if (impl_) { |
51 impl_->GetTransport()->DestroyChannel(impl_->component()); | 51 impl_->GetTransport()->DestroyChannel(impl_->component()); |
52 } | 52 } |
53 | 53 |
54 // Adopt the supplied impl, and connect to its signals. | 54 // Adopt the supplied impl, and connect to its signals. |
55 impl_ = impl; | 55 impl_ = impl; |
56 | 56 |
57 if (impl_) { | 57 if (impl_) { |
58 impl_->SignalReadableState.connect( | |
59 this, &TransportChannelProxy::OnReadableState); | |
60 impl_->SignalWritableState.connect( | 58 impl_->SignalWritableState.connect( |
61 this, &TransportChannelProxy::OnWritableState); | 59 this, &TransportChannelProxy::OnWritableState); |
| 60 impl_->SignalReceivingState.connect( |
| 61 this, &TransportChannelProxy::OnReceivingState); |
62 impl_->SignalReadPacket.connect( | 62 impl_->SignalReadPacket.connect( |
63 this, &TransportChannelProxy::OnReadPacket); | 63 this, &TransportChannelProxy::OnReadPacket); |
64 impl_->SignalReadyToSend.connect( | 64 impl_->SignalReadyToSend.connect( |
65 this, &TransportChannelProxy::OnReadyToSend); | 65 this, &TransportChannelProxy::OnReadyToSend); |
66 impl_->SignalRouteChange.connect( | 66 impl_->SignalRouteChange.connect( |
67 this, &TransportChannelProxy::OnRouteChange); | 67 this, &TransportChannelProxy::OnRouteChange); |
68 for (const auto& pair : options_) { | 68 for (const auto& pair : options_) { |
69 impl_->SetOption(pair.first, pair.second); | 69 impl_->SetOption(pair.first, pair.second); |
70 } | 70 } |
71 | 71 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 222 } |
223 | 223 |
224 IceRole TransportChannelProxy::GetIceRole() const { | 224 IceRole TransportChannelProxy::GetIceRole() const { |
225 ASSERT(rtc::Thread::Current() == worker_thread_); | 225 ASSERT(rtc::Thread::Current() == worker_thread_); |
226 if (!impl_) { | 226 if (!impl_) { |
227 return ICEROLE_UNKNOWN; | 227 return ICEROLE_UNKNOWN; |
228 } | 228 } |
229 return impl_->GetIceRole(); | 229 return impl_->GetIceRole(); |
230 } | 230 } |
231 | 231 |
232 void TransportChannelProxy::OnReadableState(TransportChannel* channel) { | |
233 ASSERT(rtc::Thread::Current() == worker_thread_); | |
234 ASSERT(channel == impl_); | |
235 set_readable(impl_->readable()); | |
236 // Note: SignalReadableState fired by set_readable. | |
237 } | |
238 | |
239 void TransportChannelProxy::OnWritableState(TransportChannel* channel) { | 232 void TransportChannelProxy::OnWritableState(TransportChannel* channel) { |
240 ASSERT(rtc::Thread::Current() == worker_thread_); | 233 ASSERT(rtc::Thread::Current() == worker_thread_); |
241 ASSERT(channel == impl_); | 234 ASSERT(channel == impl_); |
242 set_writable(impl_->writable()); | 235 set_writable(impl_->writable()); |
243 // Note: SignalWritableState fired by set_readable. | 236 // Note: SignalWritableState fired by set_writable. |
| 237 } |
| 238 |
| 239 void TransportChannelProxy::OnReceivingState(TransportChannel* channel) { |
| 240 ASSERT(rtc::Thread::Current() == worker_thread_); |
| 241 ASSERT(channel == impl_); |
| 242 set_receiving(impl_->receiving()); |
| 243 // Note: SignalReceivingState fired by set_receiving. |
244 } | 244 } |
245 | 245 |
246 void TransportChannelProxy::OnReadPacket( | 246 void TransportChannelProxy::OnReadPacket( |
247 TransportChannel* channel, const char* data, size_t size, | 247 TransportChannel* channel, const char* data, size_t size, |
248 const rtc::PacketTime& packet_time, int flags) { | 248 const rtc::PacketTime& packet_time, int flags) { |
249 ASSERT(rtc::Thread::Current() == worker_thread_); | 249 ASSERT(rtc::Thread::Current() == worker_thread_); |
250 ASSERT(channel == impl_); | 250 ASSERT(channel == impl_); |
251 SignalReadPacket(this, data, size, packet_time, flags); | 251 SignalReadPacket(this, data, size, packet_time, flags); |
252 } | 252 } |
253 | 253 |
254 void TransportChannelProxy::OnReadyToSend(TransportChannel* channel) { | 254 void TransportChannelProxy::OnReadyToSend(TransportChannel* channel) { |
255 ASSERT(rtc::Thread::Current() == worker_thread_); | 255 ASSERT(rtc::Thread::Current() == worker_thread_); |
256 ASSERT(channel == impl_); | 256 ASSERT(channel == impl_); |
257 SignalReadyToSend(this); | 257 SignalReadyToSend(this); |
258 } | 258 } |
259 | 259 |
260 void TransportChannelProxy::OnRouteChange(TransportChannel* channel, | 260 void TransportChannelProxy::OnRouteChange(TransportChannel* channel, |
261 const Candidate& candidate) { | 261 const Candidate& candidate) { |
262 ASSERT(rtc::Thread::Current() == worker_thread_); | 262 ASSERT(rtc::Thread::Current() == worker_thread_); |
263 ASSERT(channel == impl_); | 263 ASSERT(channel == impl_); |
264 SignalRouteChange(this, candidate); | 264 SignalRouteChange(this, candidate); |
265 } | 265 } |
266 | 266 |
267 void TransportChannelProxy::OnMessage(rtc::Message* msg) { | 267 void TransportChannelProxy::OnMessage(rtc::Message* msg) { |
268 ASSERT(rtc::Thread::Current() == worker_thread_); | 268 ASSERT(rtc::Thread::Current() == worker_thread_); |
269 if (msg->message_id == MSG_UPDATESTATE) { | 269 if (msg->message_id == MSG_UPDATESTATE) { |
270 // If impl_ is already readable or writable, push up those signals. | 270 // If impl_ is already receiving or writable, push up those signals. |
271 set_readable(impl_ ? impl_->readable() : false); | 271 set_writable(impl_ ? impl_->writable() : false); |
272 set_writable(impl_ ? impl_->writable() : false); | 272 set_receiving(impl_ ? impl_->receiving() : false); |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 } // namespace cricket | 276 } // namespace cricket |
OLD | NEW |