OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 MSG_DATARECEIVED, | 53 MSG_DATARECEIVED, |
54 MSG_FIRSTPACKETRECEIVED, | 54 MSG_FIRSTPACKETRECEIVED, |
55 MSG_STREAMCLOSEDREMOTELY, | 55 MSG_STREAMCLOSEDREMOTELY, |
56 }; | 56 }; |
57 | 57 |
58 // Value specified in RFC 5764. | 58 // Value specified in RFC 5764. |
59 static const char kDtlsSrtpExporterLabel[] = "EXTRACTOR-dtls_srtp"; | 59 static const char kDtlsSrtpExporterLabel[] = "EXTRACTOR-dtls_srtp"; |
60 | 60 |
61 static const int kAgcMinus10db = -10; | 61 static const int kAgcMinus10db = -10; |
62 | 62 |
63 static void SetSessionError(BaseSession* session, BaseSession::Error error, | |
64 const std::string& error_desc) { | |
65 session->SetError(error, error_desc); | |
66 } | |
67 | |
68 static void SafeSetError(const std::string& message, std::string* error_desc) { | 63 static void SafeSetError(const std::string& message, std::string* error_desc) { |
69 if (error_desc) { | 64 if (error_desc) { |
70 *error_desc = message; | 65 *error_desc = message; |
71 } | 66 } |
72 } | 67 } |
73 | 68 |
74 struct PacketMessageData : public rtc::MessageData { | 69 struct PacketMessageData : public rtc::MessageData { |
75 rtc::Buffer packet; | 70 rtc::Buffer packet; |
76 rtc::DiffServCodePoint dscp; | 71 rtc::DiffServCodePoint dscp; |
77 }; | 72 }; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 } | 139 } |
145 | 140 |
146 static const MediaContentDescription* GetContentDescription( | 141 static const MediaContentDescription* GetContentDescription( |
147 const ContentInfo* cinfo) { | 142 const ContentInfo* cinfo) { |
148 if (cinfo == NULL) | 143 if (cinfo == NULL) |
149 return NULL; | 144 return NULL; |
150 return static_cast<const MediaContentDescription*>(cinfo->description); | 145 return static_cast<const MediaContentDescription*>(cinfo->description); |
151 } | 146 } |
152 | 147 |
153 BaseChannel::BaseChannel(rtc::Thread* thread, | 148 BaseChannel::BaseChannel(rtc::Thread* thread, |
154 MediaChannel* media_channel, BaseSession* session, | 149 MediaChannel* media_channel, |
155 const std::string& content_name, bool rtcp) | 150 TransportController* transport_controller, |
151 const std::string& content_name, | |
152 bool rtcp) | |
156 : worker_thread_(thread), | 153 : worker_thread_(thread), |
157 session_(session), | 154 transport_controller_(transport_controller), |
158 media_channel_(media_channel), | 155 media_channel_(media_channel), |
159 content_name_(content_name), | 156 content_name_(content_name), |
160 rtcp_(rtcp), | 157 rtcp_(rtcp), |
161 transport_channel_(NULL), | 158 transport_channel_(NULL), |
162 rtcp_transport_channel_(NULL), | 159 rtcp_transport_channel_(NULL), |
163 enabled_(false), | 160 enabled_(false), |
164 writable_(false), | 161 writable_(false), |
165 rtp_ready_to_send_(false), | 162 rtp_ready_to_send_(false), |
166 rtcp_ready_to_send_(false), | 163 rtcp_ready_to_send_(false), |
167 was_ever_writable_(false), | 164 was_ever_writable_(false), |
(...skipping 16 matching lines...) Expand all Loading... | |
184 // We must destroy the media channel before the transport channel, otherwise | 181 // We must destroy the media channel before the transport channel, otherwise |
185 // the media channel may try to send on the dead transport channel. NULLing | 182 // the media channel may try to send on the dead transport channel. NULLing |
186 // is not an effective strategy since the sends will come on another thread. | 183 // is not an effective strategy since the sends will come on another thread. |
187 delete media_channel_; | 184 delete media_channel_; |
188 set_transport_channel(nullptr); | 185 set_transport_channel(nullptr); |
189 set_rtcp_transport_channel(nullptr); | 186 set_rtcp_transport_channel(nullptr); |
190 LOG(LS_INFO) << "Destroyed channel"; | 187 LOG(LS_INFO) << "Destroyed channel"; |
191 } | 188 } |
192 | 189 |
193 bool BaseChannel::Init() { | 190 bool BaseChannel::Init() { |
194 if (!SetTransportChannels(session(), rtcp())) { | 191 if (!SetTransportChannels(content_name(), rtcp())) { |
195 return false; | 192 return false; |
196 } | 193 } |
197 | 194 |
198 if (!SetDtlsSrtpCiphers(transport_channel(), false)) { | 195 if (!SetDtlsSrtpCiphers(transport_channel(), false)) { |
199 return false; | 196 return false; |
200 } | 197 } |
201 if (rtcp() && !SetDtlsSrtpCiphers(rtcp_transport_channel(), true)) { | 198 if (rtcp() && !SetDtlsSrtpCiphers(rtcp_transport_channel(), true)) { |
202 return false; | 199 return false; |
203 } | 200 } |
204 | 201 |
205 // Both RTP and RTCP channels are set, we can call SetInterface on | 202 // Both RTP and RTCP channels are set, we can call SetInterface on |
206 // media channel and it can set network options. | 203 // media channel and it can set network options. |
207 media_channel_->SetInterface(this); | 204 media_channel_->SetInterface(this); |
208 return true; | 205 return true; |
209 } | 206 } |
210 | 207 |
211 void BaseChannel::Deinit() { | 208 void BaseChannel::Deinit() { |
212 media_channel_->SetInterface(NULL); | 209 media_channel_->SetInterface(NULL); |
213 } | 210 } |
214 | 211 |
215 bool BaseChannel::SetTransportChannels(BaseSession* session, bool rtcp) { | 212 bool BaseChannel::SetTransport(const std::string& transport_name) { |
216 return worker_thread_->Invoke<bool>(Bind( | 213 // Only enable an RTCP transport channel if we already had one. |
217 &BaseChannel::SetTransportChannels_w, this, session, rtcp)); | 214 bool rtcp = (rtcp_transport_channel() != nullptr); |
215 if (!SetTransportChannels(transport_name, rtcp)) { | |
216 return false; | |
217 } | |
218 return true; | |
218 } | 219 } |
219 | 220 |
220 bool BaseChannel::SetTransportChannels_w(BaseSession* session, bool rtcp) { | 221 bool BaseChannel::SetTransportChannels( |
222 const std::string& transport_name, bool rtcp) { | |
223 return worker_thread_->Invoke<bool>(Bind( | |
224 &BaseChannel::SetTransportChannels_w, this, transport_name, rtcp)); | |
225 } | |
226 | |
227 bool BaseChannel::SetTransportChannels_w( | |
228 const std::string& transport_name, bool rtcp) { | |
221 ASSERT(worker_thread_ == rtc::Thread::Current()); | 229 ASSERT(worker_thread_ == rtc::Thread::Current()); |
222 | 230 |
223 set_transport_channel(session->CreateChannel( | 231 set_transport_channel(transport_controller_->CreateTransportChannel_w( |
224 content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP)); | 232 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTP)); |
225 if (!transport_channel()) { | 233 if (!transport_channel()) { |
226 return false; | 234 return false; |
227 } | 235 } |
228 if (rtcp) { | 236 if (rtcp) { |
229 set_rtcp_transport_channel(session->CreateChannel( | 237 LOG(LS_INFO) << "Create RTCP TransportChannel for " << content_name() |
230 content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP)); | 238 << " on " << transport_name << " transport "; |
239 set_rtcp_transport_channel(transport_controller_->CreateTransportChannel_w( | |
240 transport_name, cricket::ICE_CANDIDATE_COMPONENT_RTCP)); | |
231 if (!rtcp_transport_channel()) { | 241 if (!rtcp_transport_channel()) { |
232 return false; | 242 return false; |
233 } | 243 } |
234 } else { | 244 } else { |
235 set_rtcp_transport_channel(nullptr); | 245 set_rtcp_transport_channel(nullptr); |
236 } | 246 } |
247 transport_name_ = transport_name; | |
237 | 248 |
238 return true; | 249 return true; |
239 } | 250 } |
240 | 251 |
241 void BaseChannel::set_transport_channel(TransportChannel* new_tc) { | 252 void BaseChannel::set_transport_channel(TransportChannel* new_tc) { |
242 ASSERT(worker_thread_ == rtc::Thread::Current()); | 253 ASSERT(worker_thread_ == rtc::Thread::Current()); |
243 | 254 |
244 TransportChannel* old_tc = transport_channel_; | 255 TransportChannel* old_tc = transport_channel_; |
245 | 256 |
246 if (old_tc == new_tc) { | 257 if (old_tc == new_tc) { |
258 if (old_tc) { | |
259 // Need to make sure ref count is decremented | |
260 transport_controller_->DestroyTransportChannel_w( | |
261 transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
262 } | |
pthatcher1
2015/08/10 20:40:17
This doesn't seem right. If we set_transport_chan
Taylor Brandstetter
2015/08/11 01:20:07
I did this because "CreateTransportChannel_w" abov
pthatcher1
2015/08/18 22:32:46
I think it's right to decrement the pointer of the
| |
247 return; | 263 return; |
248 } | 264 } |
249 if (old_tc) { | 265 if (old_tc) { |
250 DisconnectFromTransportChannel(old_tc); | 266 DisconnectFromTransportChannel(old_tc); |
251 session()->DestroyChannel( | 267 transport_controller_->DestroyTransportChannel_w( |
252 content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP); | 268 transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTP); |
253 } | 269 } |
254 | 270 |
255 transport_channel_ = new_tc; | 271 transport_channel_ = new_tc; |
256 | 272 |
257 if (new_tc) { | 273 if (new_tc) { |
258 ConnectToTransportChannel(new_tc); | 274 ConnectToTransportChannel(new_tc); |
275 for (const auto& pair : socket_options_) { | |
276 new_tc->SetOption(pair.first, pair.second); | |
277 } | |
278 | |
279 OnWritableState(new_tc); | |
280 SetReadyToSend(new_tc, new_tc->writable()); | |
pthatcher1
2015/08/10 20:40:17
Can you put in a nice comment about why we need to
Taylor Brandstetter
2015/08/11 01:20:07
Done.
| |
259 } | 281 } |
260 } | 282 } |
261 | 283 |
262 void BaseChannel::set_rtcp_transport_channel(TransportChannel* new_tc) { | 284 void BaseChannel::set_rtcp_transport_channel(TransportChannel* new_tc) { |
263 ASSERT(worker_thread_ == rtc::Thread::Current()); | 285 ASSERT(worker_thread_ == rtc::Thread::Current()); |
264 | 286 |
265 TransportChannel* old_tc = rtcp_transport_channel_; | 287 TransportChannel* old_tc = rtcp_transport_channel_; |
266 | 288 |
267 if (old_tc == new_tc) { | 289 if (old_tc == new_tc) { |
268 return; | 290 return; |
269 } | 291 } |
270 if (old_tc) { | 292 if (old_tc) { |
271 DisconnectFromTransportChannel(old_tc); | 293 DisconnectFromTransportChannel(old_tc); |
272 session()->DestroyChannel( | 294 transport_controller_->DestroyTransportChannel_w( |
273 content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 295 transport_name_, cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
274 } | 296 } |
275 | 297 |
276 rtcp_transport_channel_ = new_tc; | 298 rtcp_transport_channel_ = new_tc; |
277 | 299 |
278 if (new_tc) { | 300 if (new_tc) { |
279 ConnectToTransportChannel(new_tc); | 301 ConnectToTransportChannel(new_tc); |
302 for (const auto& pair : rtcp_socket_options_) { | |
303 new_tc->SetOption(pair.first, pair.second); | |
304 } | |
305 | |
306 OnWritableState(new_tc); | |
307 SetReadyToSend(new_tc, new_tc->writable()); | |
280 } | 308 } |
281 } | 309 } |
282 | 310 |
283 void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) { | 311 void BaseChannel::ConnectToTransportChannel(TransportChannel* tc) { |
284 ASSERT(worker_thread_ == rtc::Thread::Current()); | 312 ASSERT(worker_thread_ == rtc::Thread::Current()); |
285 | 313 |
286 tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState); | 314 tc->SignalWritableState.connect(this, &BaseChannel::OnWritableState); |
287 tc->SignalReadPacket.connect(this, &BaseChannel::OnChannelRead); | 315 tc->SignalReadPacket.connect(this, &BaseChannel::OnChannelRead); |
288 tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend); | 316 tc->SignalReadyToSend.connect(this, &BaseChannel::OnReadyToSend); |
289 } | 317 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 rtc::DiffServCodePoint dscp) { | 417 rtc::DiffServCodePoint dscp) { |
390 return SendPacket(true, packet, dscp); | 418 return SendPacket(true, packet, dscp); |
391 } | 419 } |
392 | 420 |
393 int BaseChannel::SetOption(SocketType type, rtc::Socket::Option opt, | 421 int BaseChannel::SetOption(SocketType type, rtc::Socket::Option opt, |
394 int value) { | 422 int value) { |
395 TransportChannel* channel = NULL; | 423 TransportChannel* channel = NULL; |
396 switch (type) { | 424 switch (type) { |
397 case ST_RTP: | 425 case ST_RTP: |
398 channel = transport_channel_; | 426 channel = transport_channel_; |
427 socket_options_.push_back( | |
428 std::pair<rtc::Socket::Option, int>(opt, value)); | |
399 break; | 429 break; |
400 case ST_RTCP: | 430 case ST_RTCP: |
401 channel = rtcp_transport_channel_; | 431 channel = rtcp_transport_channel_; |
432 rtcp_socket_options_.push_back( | |
433 std::pair<rtc::Socket::Option, int>(opt, value)); | |
402 break; | 434 break; |
403 } | 435 } |
404 return channel ? channel->SetOption(opt, value) : -1; | 436 return channel ? channel->SetOption(opt, value) : -1; |
405 } | 437 } |
406 | 438 |
407 void BaseChannel::OnWritableState(TransportChannel* channel) { | 439 void BaseChannel::OnWritableState(TransportChannel* channel) { |
408 ASSERT(channel == transport_channel_ || channel == rtcp_transport_channel_); | 440 ASSERT(channel == transport_channel_ || channel == rtcp_transport_channel_); |
409 if (transport_channel_->writable() | 441 if (transport_channel_->writable() |
410 && (!rtcp_transport_channel_ || rtcp_transport_channel_->writable())) { | 442 && (!rtcp_transport_channel_ || rtcp_transport_channel_->writable())) { |
411 ChannelWritable_w(); | 443 ChannelWritable_w(); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
738 if (it->best_connection) { | 770 if (it->best_connection) { |
739 LOG(LS_INFO) << "Using " << it->local_candidate.ToSensitiveString() | 771 LOG(LS_INFO) << "Using " << it->local_candidate.ToSensitiveString() |
740 << "->" << it->remote_candidate.ToSensitiveString(); | 772 << "->" << it->remote_candidate.ToSensitiveString(); |
741 break; | 773 break; |
742 } | 774 } |
743 } | 775 } |
744 | 776 |
745 // If we're doing DTLS-SRTP, now is the time. | 777 // If we're doing DTLS-SRTP, now is the time. |
746 if (!was_ever_writable_ && ShouldSetupDtlsSrtp()) { | 778 if (!was_ever_writable_ && ShouldSetupDtlsSrtp()) { |
747 if (!SetupDtlsSrtp(false)) { | 779 if (!SetupDtlsSrtp(false)) { |
748 SignalDtlsSetupFailure(this, false); | 780 SignalDtlsSetupFailure_w(false); |
749 return; | 781 return; |
750 } | 782 } |
751 | 783 |
752 if (rtcp_transport_channel_) { | 784 if (rtcp_transport_channel_) { |
753 if (!SetupDtlsSrtp(true)) { | 785 if (!SetupDtlsSrtp(true)) { |
754 SignalDtlsSetupFailure(this, true); | 786 SignalDtlsSetupFailure_w(true); |
755 return; | 787 return; |
756 } | 788 } |
757 } | 789 } |
758 } | 790 } |
759 | 791 |
760 was_ever_writable_ = true; | 792 was_ever_writable_ = true; |
761 writable_ = true; | 793 writable_ = true; |
762 ChangeState(); | 794 ChangeState(); |
763 } | 795 } |
764 | 796 |
(...skipping 22 matching lines...) Expand all Loading... | |
787 | 819 |
788 bool BaseChannel::ShouldSetupDtlsSrtp() const { | 820 bool BaseChannel::ShouldSetupDtlsSrtp() const { |
789 return true; | 821 return true; |
790 } | 822 } |
791 | 823 |
792 // This function returns true if either DTLS-SRTP is not in use | 824 // This function returns true if either DTLS-SRTP is not in use |
793 // *or* DTLS-SRTP is successfully set up. | 825 // *or* DTLS-SRTP is successfully set up. |
794 bool BaseChannel::SetupDtlsSrtp(bool rtcp_channel) { | 826 bool BaseChannel::SetupDtlsSrtp(bool rtcp_channel) { |
795 bool ret = false; | 827 bool ret = false; |
796 | 828 |
797 TransportChannel *channel = rtcp_channel ? | 829 TransportChannel* channel = rtcp_channel ? rtcp_transport_channel_ |
798 rtcp_transport_channel_ : transport_channel_; | 830 : transport_channel_; |
799 | 831 |
800 // No DTLS | 832 // No DTLS |
801 if (!channel->IsDtlsActive()) | 833 if (!channel->IsDtlsActive()) |
802 return true; | 834 return true; |
803 | 835 |
804 std::string selected_cipher; | 836 std::string selected_cipher; |
805 | 837 |
806 if (!channel->GetSrtpCipher(&selected_cipher)) { | 838 if (!channel->GetSrtpCipher(&selected_cipher)) { |
807 LOG(LS_ERROR) << "No DTLS-SRTP selected cipher"; | 839 LOG(LS_ERROR) << "No DTLS-SRTP selected cipher"; |
808 return false; | 840 return false; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
994 } | 1026 } |
995 | 1027 |
996 void BaseChannel::ActivateRtcpMux() { | 1028 void BaseChannel::ActivateRtcpMux() { |
997 worker_thread_->Invoke<void>(Bind( | 1029 worker_thread_->Invoke<void>(Bind( |
998 &BaseChannel::ActivateRtcpMux_w, this)); | 1030 &BaseChannel::ActivateRtcpMux_w, this)); |
999 } | 1031 } |
1000 | 1032 |
1001 void BaseChannel::ActivateRtcpMux_w() { | 1033 void BaseChannel::ActivateRtcpMux_w() { |
1002 if (!rtcp_mux_filter_.IsActive()) { | 1034 if (!rtcp_mux_filter_.IsActive()) { |
1003 rtcp_mux_filter_.SetActive(); | 1035 rtcp_mux_filter_.SetActive(); |
1004 set_rtcp_transport_channel(NULL); | 1036 set_rtcp_transport_channel(nullptr); |
1005 } | 1037 } |
1006 } | 1038 } |
1007 | 1039 |
1008 bool BaseChannel::SetRtcpMux_w(bool enable, ContentAction action, | 1040 bool BaseChannel::SetRtcpMux_w(bool enable, ContentAction action, |
1009 ContentSource src, | 1041 ContentSource src, |
1010 std::string* error_desc) { | 1042 std::string* error_desc) { |
1011 bool ret = false; | 1043 bool ret = false; |
1012 switch (action) { | 1044 switch (action) { |
1013 case CA_OFFER: | 1045 case CA_OFFER: |
1014 ret = rtcp_mux_filter_.SetOffer(enable, src); | 1046 ret = rtcp_mux_filter_.SetOffer(enable, src); |
1015 break; | 1047 break; |
1016 case CA_PRANSWER: | 1048 case CA_PRANSWER: |
1017 ret = rtcp_mux_filter_.SetProvisionalAnswer(enable, src); | 1049 ret = rtcp_mux_filter_.SetProvisionalAnswer(enable, src); |
1018 break; | 1050 break; |
1019 case CA_ANSWER: | 1051 case CA_ANSWER: |
1020 ret = rtcp_mux_filter_.SetAnswer(enable, src); | 1052 ret = rtcp_mux_filter_.SetAnswer(enable, src); |
1021 if (ret && rtcp_mux_filter_.IsActive()) { | 1053 if (ret && rtcp_mux_filter_.IsActive()) { |
1022 // We activated RTCP mux, close down the RTCP transport. | 1054 // We activated RTCP mux, close down the RTCP transport. |
1023 set_rtcp_transport_channel(NULL); | 1055 LOG(LS_INFO) << "Enabling rtcp-mux for " << content_name() |
1056 << " by destroying RTCP transport channel for " | |
1057 << transport_name(); | |
1058 set_rtcp_transport_channel(nullptr); | |
1024 } | 1059 } |
1025 break; | 1060 break; |
1026 case CA_UPDATE: | 1061 case CA_UPDATE: |
1027 // No RTCP mux info. | 1062 // No RTCP mux info. |
1028 ret = true; | 1063 ret = true; |
1029 break; | 1064 break; |
1030 default: | 1065 default: |
1031 break; | 1066 break; |
1032 } | 1067 } |
1033 if (!ret) { | 1068 if (!ret) { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1283 worker_thread_->Clear(this, MSG_RTCPPACKET, &rtcp_messages); | 1318 worker_thread_->Clear(this, MSG_RTCPPACKET, &rtcp_messages); |
1284 for (rtc::MessageList::iterator it = rtcp_messages.begin(); | 1319 for (rtc::MessageList::iterator it = rtcp_messages.begin(); |
1285 it != rtcp_messages.end(); ++it) { | 1320 it != rtcp_messages.end(); ++it) { |
1286 worker_thread_->Send(this, MSG_RTCPPACKET, it->pdata); | 1321 worker_thread_->Send(this, MSG_RTCPPACKET, it->pdata); |
1287 } | 1322 } |
1288 } | 1323 } |
1289 | 1324 |
1290 VoiceChannel::VoiceChannel(rtc::Thread* thread, | 1325 VoiceChannel::VoiceChannel(rtc::Thread* thread, |
1291 MediaEngineInterface* media_engine, | 1326 MediaEngineInterface* media_engine, |
1292 VoiceMediaChannel* media_channel, | 1327 VoiceMediaChannel* media_channel, |
1293 BaseSession* session, | 1328 TransportController* transport_controller, |
1294 const std::string& content_name, | 1329 const std::string& content_name, |
1295 bool rtcp) | 1330 bool rtcp) |
1296 : BaseChannel(thread, media_channel, session, content_name, | 1331 : BaseChannel(thread, media_channel, transport_controller, content_name, |
1297 rtcp), | 1332 rtcp), |
1298 media_engine_(media_engine), | |
pthatcher1
2015/08/10 20:40:17
Do we not need to set the media engine any more?
Taylor Brandstetter
2015/08/11 01:20:07
Good catch... I must have deleted that line on acc
| |
1299 received_media_(false) { | 1333 received_media_(false) { |
1300 } | 1334 } |
1301 | 1335 |
1302 VoiceChannel::~VoiceChannel() { | 1336 VoiceChannel::~VoiceChannel() { |
1303 StopAudioMonitor(); | 1337 StopAudioMonitor(); |
1304 StopMediaMonitor(); | 1338 StopMediaMonitor(); |
1305 // this can't be done in the base class, since it calls a virtual | 1339 // this can't be done in the base class, since it calls a virtual |
1306 DisableMedia_w(); | 1340 DisableMedia_w(); |
1307 Deinit(); | 1341 Deinit(); |
1308 } | 1342 } |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1678 break; | 1712 break; |
1679 } | 1713 } |
1680 } | 1714 } |
1681 | 1715 |
1682 void VoiceChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { | 1716 void VoiceChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { |
1683 GetSupportedAudioCryptoSuites(ciphers); | 1717 GetSupportedAudioCryptoSuites(ciphers); |
1684 } | 1718 } |
1685 | 1719 |
1686 VideoChannel::VideoChannel(rtc::Thread* thread, | 1720 VideoChannel::VideoChannel(rtc::Thread* thread, |
1687 VideoMediaChannel* media_channel, | 1721 VideoMediaChannel* media_channel, |
1688 BaseSession* session, | 1722 TransportController* transport_controller, |
1689 const std::string& content_name, | 1723 const std::string& content_name, |
1690 bool rtcp) | 1724 bool rtcp) |
1691 : BaseChannel(thread, media_channel, session, content_name, | 1725 : BaseChannel(thread, media_channel, transport_controller, content_name, |
1692 rtcp), | 1726 rtcp), |
1693 renderer_(NULL), | 1727 renderer_(NULL), |
1694 previous_we_(rtc::WE_CLOSE) { | 1728 previous_we_(rtc::WE_CLOSE) { |
1695 } | 1729 } |
1696 | 1730 |
1697 bool VideoChannel::Init() { | 1731 bool VideoChannel::Init() { |
1698 if (!BaseChannel::Init()) { | 1732 if (!BaseChannel::Init()) { |
1699 return false; | 1733 return false; |
1700 } | 1734 } |
1701 media_channel()->SignalMediaError.connect( | 1735 media_channel()->SignalMediaError.connect( |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2116 } | 2150 } |
2117 } | 2151 } |
2118 | 2152 |
2119 | 2153 |
2120 void VideoChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { | 2154 void VideoChannel::GetSrtpCiphers(std::vector<std::string>* ciphers) const { |
2121 GetSupportedVideoCryptoSuites(ciphers); | 2155 GetSupportedVideoCryptoSuites(ciphers); |
2122 } | 2156 } |
2123 | 2157 |
2124 DataChannel::DataChannel(rtc::Thread* thread, | 2158 DataChannel::DataChannel(rtc::Thread* thread, |
2125 DataMediaChannel* media_channel, | 2159 DataMediaChannel* media_channel, |
2126 BaseSession* session, | 2160 TransportController* transport_controller, |
2127 const std::string& content_name, | 2161 const std::string& content_name, |
2128 bool rtcp) | 2162 bool rtcp) |
2129 : BaseChannel(thread, media_channel, session, content_name, rtcp), | 2163 : BaseChannel(thread, media_channel, transport_controller, content_name, |
2164 rtcp), | |
2130 data_channel_type_(cricket::DCT_NONE), | 2165 data_channel_type_(cricket::DCT_NONE), |
2131 ready_to_send_data_(false) { | 2166 ready_to_send_data_(false) { |
2132 } | 2167 } |
2133 | 2168 |
2134 DataChannel::~DataChannel() { | 2169 DataChannel::~DataChannel() { |
2135 StopMediaMonitor(); | 2170 StopMediaMonitor(); |
2136 // this can't be done in the base class, since it calls a virtual | 2171 // this can't be done in the base class, since it calls a virtual |
2137 DisableMedia_w(); | 2172 DisableMedia_w(); |
2138 | 2173 |
2139 Deinit(); | 2174 Deinit(); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2473 return (data_channel_type_ == DCT_RTP); | 2508 return (data_channel_type_ == DCT_RTP); |
2474 } | 2509 } |
2475 | 2510 |
2476 void DataChannel::OnStreamClosedRemotely(uint32 sid) { | 2511 void DataChannel::OnStreamClosedRemotely(uint32 sid) { |
2477 rtc::TypedMessageData<uint32>* message = | 2512 rtc::TypedMessageData<uint32>* message = |
2478 new rtc::TypedMessageData<uint32>(sid); | 2513 new rtc::TypedMessageData<uint32>(sid); |
2479 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2514 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2480 } | 2515 } |
2481 | 2516 |
2482 } // namespace cricket | 2517 } // namespace cricket |
OLD | NEW |